evalModules: Add internal option for the check argument
This commit is contained in:
parent
e4a06f35b1
commit
e3eff53037
|
@ -25,6 +25,16 @@ rec {
|
||||||
|
|
||||||
internal = true;
|
internal = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
__internal.check = mkOption {
|
||||||
|
description = "Whether to check whether all option definitions have matching declarations.";
|
||||||
|
|
||||||
|
type = types.uniq types.bool;
|
||||||
|
|
||||||
|
internal = true;
|
||||||
|
|
||||||
|
default = check;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -45,7 +55,7 @@ rec {
|
||||||
if isOption v then v.value
|
if isOption v then v.value
|
||||||
else yieldConfig (prefix ++ [n]) v) set) ["_definedNames"];
|
else yieldConfig (prefix ++ [n]) v) set) ["_definedNames"];
|
||||||
in
|
in
|
||||||
if check && set ? _definedNames then
|
if options.__internal.check.value && set ? _definedNames then
|
||||||
fold (m: res:
|
fold (m: res:
|
||||||
fold (name: res:
|
fold (name: res:
|
||||||
if set ? ${name} then res else throw "The option `${showOption (prefix ++ [name])}' defined in `${m.file}' does not exist.")
|
if set ? ${name} then res else throw "The option `${showOption (prefix ++ [name])}' defined in `${m.file}' does not exist.")
|
||||||
|
|
|
@ -31,10 +31,9 @@ in rec {
|
||||||
# Merge the option definitions in all modules, forming the full
|
# Merge the option definitions in all modules, forming the full
|
||||||
# system configuration.
|
# system configuration.
|
||||||
inherit (lib.evalModules {
|
inherit (lib.evalModules {
|
||||||
inherit prefix;
|
inherit prefix check;
|
||||||
modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ];
|
modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ];
|
||||||
args = extraArgs;
|
args = extraArgs;
|
||||||
check = check && options.environment.checkConfigurationOptions.value;
|
|
||||||
}) config options;
|
}) config options;
|
||||||
|
|
||||||
# These are the extra arguments passed to every module. In
|
# These are the extra arguments passed to every module. In
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
{ lib, ... }:
|
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
{
|
|
||||||
options = {
|
|
||||||
environment.checkConfigurationOptions = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
default = true;
|
|
||||||
description = ''
|
|
||||||
Whether to check the validity of the entire configuration.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -43,7 +43,6 @@
|
||||||
./installer/tools/nixos-checkout.nix
|
./installer/tools/nixos-checkout.nix
|
||||||
./installer/tools/tools.nix
|
./installer/tools/tools.nix
|
||||||
./misc/assertions.nix
|
./misc/assertions.nix
|
||||||
./misc/check-config.nix
|
|
||||||
./misc/crashdump.nix
|
./misc/crashdump.nix
|
||||||
./misc/ids.nix
|
./misc/ids.nix
|
||||||
./misc/lib.nix
|
./misc/lib.nix
|
||||||
|
|
|
@ -136,6 +136,8 @@ in zipModules ([]
|
||||||
|
|
||||||
++ obsolete [ "services" "mysql55" ] [ "services" "mysql" ]
|
++ obsolete [ "services" "mysql55" ] [ "services" "mysql" ]
|
||||||
|
|
||||||
|
++ obsolete [ "environment" "checkConfigurationOptions" ] [ "__internal" "check" ]
|
||||||
|
|
||||||
# Options that are obsolete and have no replacement.
|
# Options that are obsolete and have no replacement.
|
||||||
++ obsolete' [ "boot" "loader" "grub" "bootDevice" ]
|
++ obsolete' [ "boot" "loader" "grub" "bootDevice" ]
|
||||||
++ obsolete' [ "boot" "initrd" "luks" "enable" ]
|
++ obsolete' [ "boot" "initrd" "luks" "enable" ]
|
||||||
|
|
Loading…
Reference in New Issue