From ebb136da9f4e743c8c1f873e9d85840559127265 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Sat, 28 Sep 2019 03:52:01 +0200 Subject: [PATCH] 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. --- lib/modules.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/modules.nix b/lib/modules.nix index c3c903c1dfa8..629e7fb13fed 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