diff options
author | Robin Gloster <mail@glob.in> | 2019-09-25 17:13:29 +0200 |
---|---|---|
committer | Linus Heckemann <git@sphalerite.org> | 2019-09-30 12:07:13 +0200 |
commit | b08b0bcbbec77046e5a7082177cedc12fbf1dc6c (patch) | |
tree | b80838572ca28282dc278db44abd462c2d49cb63 /lib/modules.nix | |
parent | d4212d66a8c793413bdb317a3af5f70f10c1f60c (diff) | |
download | nixpkgs-b08b0bcbbec77046e5a7082177cedc12fbf1dc6c.tar nixpkgs-b08b0bcbbec77046e5a7082177cedc12fbf1dc6c.tar.gz nixpkgs-b08b0bcbbec77046e5a7082177cedc12fbf1dc6c.tar.bz2 nixpkgs-b08b0bcbbec77046e5a7082177cedc12fbf1dc6c.tar.lz nixpkgs-b08b0bcbbec77046e5a7082177cedc12fbf1dc6c.tar.xz nixpkgs-b08b0bcbbec77046e5a7082177cedc12fbf1dc6c.tar.zst nixpkgs-b08b0bcbbec77046e5a7082177cedc12fbf1dc6c.zip |
mkRemovedOptionModule: assert on removed options
We don't want to ignore config that can mess up machines. In general this should always fail evaluation, as you think you are changing behaviour and don't, which can easily create run-time errors we can catch early.
Diffstat (limited to 'lib/modules.nix')
-rw-r--r-- | lib/modules.nix | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index c3c903c1dfa..00c7712487b 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -592,11 +592,14 @@ rec { { options = setAttrByPath optionName (mkOption { visible = false; }); - config.warnings = - let opt = getAttrFromPath optionName options; in - optional opt.isDefined '' + config.assertions = + let opt = getAttrFromPath optionName options; in [{ + assertion = !opt.isDefined; + message = '' The option definition `${showOption optionName}' in ${showFiles opt.files} no longer has any effect; please remove it. - ${replacementInstructions}''; + ${replacementInstructions} + ''; + }]; }; /* Return a module that causes a warning to be shown if the |