diff options
author | Shea Levy <shea@shealevy.com> | 2014-05-05 16:23:57 -0400 |
---|---|---|
committer | Nicolas B. Pierron <nicolas.b.pierron@gmail.com> | 2015-03-12 23:42:57 +0100 |
commit | e3eff53037f1b7abb7a44ba72f59f20649023642 (patch) | |
tree | 4e48d6f16aca424ee144a05390c481aa824ee070 | |
parent | e4a06f35b1d88ab98fa8b6962e7a3f802232d165 (diff) |
evalModules: Add internal option for the check argument
-rw-r--r-- | lib/modules.nix | 12 | ||||
-rw-r--r-- | nixos/lib/eval-config.nix | 3 | ||||
-rw-r--r-- | nixos/modules/misc/check-config.nix | 15 | ||||
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/rename.nix | 2 |
5 files changed, 14 insertions, 19 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index 84ca209d3671..1d7c7b22765e 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -25,6 +25,16 @@ rec { 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 = { @@ -45,7 +55,7 @@ rec { if isOption v then v.value else yieldConfig (prefix ++ [n]) v) set) ["_definedNames"]; in - if check && set ? _definedNames then + if options.__internal.check.value && set ? _definedNames then fold (m: res: fold (name: res: if set ? ${name} then res else throw "The option `${showOption (prefix ++ [name])}' defined in `${m.file}' does not exist.") diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index 460f5601ae76..4ee1c61f54ff 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -31,10 +31,9 @@ in rec { # Merge the option definitions in all modules, forming the full # system configuration. inherit (lib.evalModules { - inherit prefix; + inherit prefix check; modules = modules ++ extraModules ++ baseModules ++ [ pkgsModule ]; args = extraArgs; - check = check && options.environment.checkConfigurationOptions.value; }) config options; # These are the extra arguments passed to every module. In diff --git a/nixos/modules/misc/check-config.nix b/nixos/modules/misc/check-config.nix deleted file mode 100644 index e9803de21961..000000000000 --- a/nixos/modules/misc/check-config.nix +++ /dev/null @@ -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. - ''; - }; - }; -} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 23809796878f..95337168d104 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -43,7 +43,6 @@ ./installer/tools/nixos-checkout.nix ./installer/tools/tools.nix ./misc/assertions.nix - ./misc/check-config.nix ./misc/crashdump.nix ./misc/ids.nix ./misc/lib.nix diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index e820b2cb9ce4..b898dc23522d 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -136,6 +136,8 @@ in zipModules ([] ++ obsolete [ "services" "mysql55" ] [ "services" "mysql" ] +++ obsolete [ "environment" "checkConfigurationOptions" ] [ "__internal" "check" ] + # Options that are obsolete and have no replacement. ++ obsolete' [ "boot" "loader" "grub" "bootDevice" ] ++ obsolete' [ "boot" "initrd" "luks" "enable" ] |