Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib.mkRemovedOptionModule: Show replacement for option usage too #69746

Merged
merged 1 commit into from Oct 2, 2019

Conversation

infinisil
Copy link
Member

@infinisil infinisil commented Sep 28, 2019

Motivation for this change

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 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 in

(mkRemovedOptionModule [ "security" "acme" "directory"] "ACME Directory is now hardcoded to /var/lib/acme and its permisisons are managed by systemd. See https://github.com/NixOS/nixpkgs/issues/53852 for more info.")

error: The option `security.acme.directory' is used but not defined.

With this change I get the expected error of

error: The option `security.acme.directory' can no longer be used since it's been removed.
  ACME Directory is now hardcoded to /var/lib/acme and its permisisons are managed by 
  systemd. See https://github.com/NixOS/nixpkgs/issues/53852 for more info.

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
  • Tested that this indeed has the desired effect with nix-build nixos -A config.security.acme.directory

@samueldr samueldr added the 9.needs: port to stable A PR needs a backport to the stable release. label Sep 28, 2019
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.
@infinisil infinisil merged commit 2b1e2f2 into NixOS:master Oct 2, 2019
@infinisil
Copy link
Member Author

Backported to 19.09 in 482ba41

@infinisil infinisil deleted the rem-opt-usage-message branch October 2, 2019 21:13
@infinisil infinisil added the 6.topic: module system About NixOS module system internals label Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: module system About NixOS module system internals 9.needs: port to stable A PR needs a backport to the stable release. 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants