about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2019-09-30 16:39:40 +0200
committerGitHub <noreply@github.com>2019-09-30 16:39:40 +0200
commitc75a18fea6f25dd5dfcc7d76c91cf49e3c53c6c5 (patch)
tree5eb9195038a5556fb71ea1daa08a9877e63c8f84 /lib
parent185778312847f3b0c50bd435800df8e02c34e1dc (diff)
parentb08b0bcbbec77046e5a7082177cedc12fbf1dc6c (diff)
downloadnixlib-c75a18fea6f25dd5dfcc7d76c91cf49e3c53c6c5.tar
nixlib-c75a18fea6f25dd5dfcc7d76c91cf49e3c53c6c5.tar.gz
nixlib-c75a18fea6f25dd5dfcc7d76c91cf49e3c53c6c5.tar.bz2
nixlib-c75a18fea6f25dd5dfcc7d76c91cf49e3c53c6c5.tar.lz
nixlib-c75a18fea6f25dd5dfcc7d76c91cf49e3c53c6c5.tar.xz
nixlib-c75a18fea6f25dd5dfcc7d76c91cf49e3c53c6c5.tar.zst
nixlib-c75a18fea6f25dd5dfcc7d76c91cf49e3c53c6c5.zip
mkRemovedOptionModule: assert on removed options (#69419)
mkRemovedOptionModule: assert on removed options
Diffstat (limited to 'lib')
-rw-r--r--lib/modules.nix11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index c3c903c1dfa8..00c7712487bd 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