From 8f4c5b05d5639c1577ce92c9e42a5d59b8be4cda Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 23 Oct 2013 18:22:26 +0200 Subject: Add a way to define obsolete options that have no replacement --- nixos/lib/eval-config.nix | 3 +-- nixos/modules/rename.nix | 16 +++++++++++++++- nixos/modules/system/boot/loader/grub/grub.nix | 6 ------ nixos/modules/system/boot/luksroot.nix | 8 ++++---- 4 files changed, 20 insertions(+), 13 deletions(-) (limited to 'nixos') diff --git a/nixos/lib/eval-config.nix b/nixos/lib/eval-config.nix index 72ba66cdbac4..cd543c958ff6 100644 --- a/nixos/lib/eval-config.nix +++ b/nixos/lib/eval-config.nix @@ -66,7 +66,6 @@ rec { # Optionally check wether all config values have corresponding # option declarations. config = - let doCheck = optionDefinitions.environment.checkConfigurationOptions; in - assert doCheck -> pkgs.lib.checkModule "" systemModule; + assert optionDefinitions.environment.checkConfigurationOptions -> pkgs.lib.checkModule "" systemModule; systemModule.config; } diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 3e3f6dd10c10..ca3bdc08a8d8 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -30,7 +30,8 @@ let zipAttrsWith (n: v: if tail v != [] then if n == "_type" then (head v) - else if n == "extraConfigs" then (concatLists v) + else if n == "extraConfigs" then concatLists v + else if n == "warnings" then concatLists v else if n == "description" || n == "apply" then abort "Cannot rename an option to multiple options." else zipModules v @@ -62,6 +63,15 @@ let } ]; + obsolete' = option: let option' = splitString "." option; in singleton + { options = setAttrByPath option' (mkOption { + default = null; + visible = false; + }); + config.warnings = optional (getAttrFromPath option' config != null) + "The option `${option}' set in your configuration no longer has any effect; please remove it."; + }; + in zipModules ([] # usage example: @@ -108,4 +118,8 @@ in zipModules ([] # !!! this hardcodes bash, could we detect from config which shell is actually used? ++ rename obsolete "environment.promptInit" "programs.bash.promptInit" +# Options that are obsolete and have no replacement. +++ obsolete' "boot.loader.grub.bootDevice" +++ obsolete' "boot.initrd.luks.enable" + ) # do not add renaming after this. diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index c7c1f675c778..48d16b1c520e 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -86,12 +86,6 @@ in ''; }; - # !!! How can we mark options as obsolete? - bootDevice = mkOption { - default = ""; - description = "Obsolete."; - }; - configurationName = mkOption { default = ""; example = "Stable 2.6.21"; diff --git a/nixos/modules/system/boot/luksroot.nix b/nixos/modules/system/boot/luksroot.nix index 29f5eb4fd771..ba357f5d2de3 100644 --- a/nixos/modules/system/boot/luksroot.nix +++ b/nixos/modules/system/boot/luksroot.nix @@ -44,12 +44,9 @@ in { options = { - boot.initrd.luks.enable = mkOption { - default = false; - description = "Obsolete."; - }; boot.initrd.luks.mitigateDMAAttacks = mkOption { + type = types.bool; default = true; description = '' Unless enabled, encryption keys can be easily recovered by an attacker with physical @@ -62,6 +59,7 @@ in }; boot.initrd.luks.cryptoModules = mkOption { + type = types.listOf types.string; default = [ "aes" "aes_generic" "blowfish" "twofish" "serpent" "cbc" "xts" "lrw" "sha1" "sha256" "sha512" @@ -142,7 +140,9 @@ in }; }; + }; + }; config = mkIf (luks.devices != []) { -- cgit 1.4.1