mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
mkRemovedOptionModule: assert on removed options
We don't want to ignore config that can mess up machines. In general this should always fail evaluation, as you think you are changing behaviour and don't, which can easily create run-time errors we can catch early.
This commit is contained in:
parent
d4212d66a8
commit
b08b0bcbbe
@ -592,11 +592,14 @@ rec {
|
||||
{ options = setAttrByPath optionName (mkOption {
|
||||
visible = false;
|
||||
});
|
||||
config.warnings =
|
||||
let opt = getAttrFromPath optionName options; in
|
||||
optional opt.isDefined ''
|
||||
config.assertions =
|
||||
let opt = getAttrFromPath optionName options; in [{
|
||||
assertion = !opt.isDefined;
|
||||
message = ''
|
||||
The option definition `${showOption optionName}' in ${showFiles opt.files} no longer has any effect; please remove it.
|
||||
${replacementInstructions}'';
|
||||
${replacementInstructions}
|
||||
'';
|
||||
}];
|
||||
};
|
||||
|
||||
/* Return a module that causes a warning to be shown if the
|
||||
|
@ -49,6 +49,6 @@ in
|
||||
(mkRemovedOptionModule [ "insecure" ] ''
|
||||
This option was replaced by 'prometheus.exporters.nginx.sslVerify'.
|
||||
'')
|
||||
({ options.warnings = options.warnings; })
|
||||
({ options.warnings = options.warnings; options.assertions = options.assertions; })
|
||||
];
|
||||
}
|
||||
|
@ -305,7 +305,7 @@ let
|
||||
optional (defined ipv6Address && defined ipv6PrefixLength)
|
||||
{ address = ipv6Address; prefixLength = ipv6PrefixLength; }))
|
||||
|
||||
({ options.warnings = options.warnings; })
|
||||
({ options.warnings = options.warnings; options.assertions = options.assertions; })
|
||||
];
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user