summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorSilvan Mosberger <infinisil@icloud.com>2019-09-28 03:52:01 +0200
committerSilvan Mosberger <infinisil@icloud.com>2019-09-28 04:10:22 +0200
commitebb136da9f4e743c8c1f873e9d85840559127265 (patch)
tree110a51cb26e5f403998796d3d116adb298a0f585 /lib/modules.nix
parent07ca91187c5fd973c97cc1e40c526977f738e3c6 (diff)
downloadnixpkgs-ebb136da9f4e743c8c1f873e9d85840559127265.tar
nixpkgs-ebb136da9f4e743c8c1f873e9d85840559127265.tar.gz
nixpkgs-ebb136da9f4e743c8c1f873e9d85840559127265.tar.bz2
nixpkgs-ebb136da9f4e743c8c1f873e9d85840559127265.tar.lz
nixpkgs-ebb136da9f4e743c8c1f873e9d85840559127265.tar.xz
nixpkgs-ebb136da9f4e743c8c1f873e9d85840559127265.tar.zst
nixpkgs-ebb136da9f4e743c8c1f873e9d85840559127265.zip
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.
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index c3c903c1dfa..629e7fb13fe 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -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