lib.mkRemovedOptionModule: Show replacement for option usage too #69746
+1
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for this change
Previously
mkRemovedOptionModule
would only show the replacementinstructions 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 nevertrigger without this change because almost everybody only uses the
option and isn't defining it.
This was discovered while I updated to nixos-unstable where I got the following error for my usage of
security.acme.directory
, even though replacement instructions were defined innixpkgs/nixos/modules/rename.nix
Line 265 in 6fd3fea
With this change I get the expected error of
One concern with this is that replacement instructions might not have been written with both defining and using the option in mind, but I'd say any replacement instructions are better than none.
To my amusement, this change can only even have this effect because of my recent #66407, which I originally didn't think could be this useful.
See also #60219 which removed the
security.acme.directory
option.Ping @rycee @nbp @Profpatsch @samueldr @worldofpeace
Things done
nix-build nixos -A config.security.acme.directory