summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix11
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