nixos/eval-config: Avoid evalModules args and check parameters
This commit is contained in:
parent
b37f099ae7
commit
59c4a35aab
1 changed files with 27 additions and 11 deletions
|
@ -8,6 +8,7 @@
|
|||
# as subcomponents (e.g. the container feature, or nixops if network
|
||||
# expressions are ever made modular at the top level) can just use
|
||||
# types.submodule instead of using eval-config.nix
|
||||
evalConfigArgs@
|
||||
{ # !!! system can be set modularly, would be nice to remove
|
||||
system ? builtins.currentSystem
|
||||
, # !!! is this argument needed any more? The pkgs argument can
|
||||
|
@ -28,7 +29,7 @@
|
|||
in if e == "" then [] else [(import e)]
|
||||
}:
|
||||
|
||||
let extraArgs_ = extraArgs; pkgs_ = pkgs;
|
||||
let pkgs_ = pkgs;
|
||||
in
|
||||
|
||||
let
|
||||
|
@ -51,25 +52,40 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
noUserModules = lib.evalModules {
|
||||
inherit prefix check;
|
||||
modules = baseModules ++ extraModules ++ [ pkgsModule ];
|
||||
args = extraArgs;
|
||||
legacyModules =
|
||||
lib.optional (evalConfigArgs?args) {
|
||||
config = {
|
||||
_module.args = extraArgs;
|
||||
};
|
||||
}
|
||||
++ lib.optional (evalConfigArgs?check) {
|
||||
config = {
|
||||
_module.check = lib.mkDefault check;
|
||||
};
|
||||
};
|
||||
allUserModules = modules ++ legacyModules;
|
||||
|
||||
noUserModules = lib.evalModules ({
|
||||
inherit prefix;
|
||||
modules = baseModules ++ extraModules ++ [ pkgsModule modulesModule ];
|
||||
specialArgs =
|
||||
{ modulesPath = builtins.toString ../modules; } // specialArgs;
|
||||
};
|
||||
});
|
||||
|
||||
# These are the extra arguments passed to every module. In
|
||||
# particular, Nixpkgs is passed through the "pkgs" argument.
|
||||
extraArgs = extraArgs_ // {
|
||||
inherit noUserModules baseModules extraModules modules;
|
||||
# Extra arguments that are useful for constructing a similar configuration.
|
||||
modulesModule = {
|
||||
config = {
|
||||
_module.args = {
|
||||
inherit noUserModules baseModules extraModules modules;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
in rec {
|
||||
|
||||
# Merge the option definitions in all modules, forming the full
|
||||
# system configuration.
|
||||
inherit (noUserModules.extendModules { inherit modules; })
|
||||
inherit (noUserModules.extendModules { modules = allUserModules; })
|
||||
config options _module type;
|
||||
|
||||
inherit extraArgs;
|
||||
|
|
Loading…
Reference in a new issue