3
0
Fork 0
forked from mirrors/nixpkgs

lib.mkRemovedOptionModule: Show replacement for option usage too

Previously mkRemovedOptionModule would only show the replacement
instructions when the removed option was *defined*. With this change, it
also does so when an option is *used*.

This is essential for options that are only intended to be used such as
`security.acme.directory`, whose replacement instructions would never
trigger without this change because almost everybody only uses the
option and isn't defining it.
This commit is contained in:
Silvan Mosberger 2019-09-28 03:52:01 +02:00
parent 07ca91187c
commit ebb136da9f
No known key found for this signature in database
GPG key ID: 9424360B4B85C9E7

View file

@ -591,6 +591,7 @@ rec {
{ options, ... }:
{ options = setAttrByPath optionName (mkOption {
visible = false;
apply = x: throw "The option `${showOption optionName}' can no longer be used since it's been removed. ${replacementInstructions}";
});
config.warnings =
let opt = getAttrFromPath optionName options; in