Skip to content

Commit

Permalink
lib.mkRemovedOptionModule: Show replacement for option usage too
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
infinisil committed Sep 28, 2019
1 parent 07ca911 commit ebb136d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ebb136d

Please sign in to comment.