diff --git a/lib/modules.nix b/lib/modules.nix index 697caddb..5843d503 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -30,11 +30,9 @@ in lib.evalModules { modules = modules ++ [ ../modules/top-level - - # Pass our locked nixpkgs into the configuration { _file = ""; - nixpkgs.source = lib.mkOptionDefault flake.inputs.nixpkgs; + flake = lib.mkOptionDefault flake; } ]; specialArgs = { diff --git a/modules/misc/context.nix b/modules/misc/context.nix index 353d6a09..f36c6fb6 100644 --- a/modules/misc/context.nix +++ b/modules/misc/context.nix @@ -1,6 +1,20 @@ { lib, ... }: +let + isFlake = x: x._type or null == "flake"; + flakeType = lib.types.addCheck lib.types.path isFlake // { + name = "flake"; + description = "flake"; + }; +in { options = { + flake = lib.mkOption { + type = flakeType; + description = '' + Nixvim's flake. + ''; + internal = true; + }; isTopLevel = lib.mkOption { type = lib.types.bool; default = false; diff --git a/modules/top-level/nixpkgs.nix b/modules/top-level/nixpkgs.nix index 96d89252..dd7e0d11 100644 --- a/modules/top-level/nixpkgs.nix +++ b/modules/top-level/nixpkgs.nix @@ -129,7 +129,7 @@ in # NOTE: This is a nixvim-specific option; there's no equivalent in nixos source = lib.mkOption { type = lib.types.path; - # NOTE: default is only set if `flake` is passed to our lib + default = config.flake.inputs.nixpkgs; defaultText = lib.literalMD "Nixvim's flake `input.nixpkgs`"; description = '' The path to import Nixpkgs from.