forked from mirrors/nixpkgs
Add a way to define obsolete options that have no replacement
This commit is contained in:
parent
b5d5afd99a
commit
8f4c5b05d5
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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 != []) {
|
||||
|
|
Loading…
Reference in a new issue