summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-04-27 13:52:15 +0000
committerAlyssa Ross <hi@alyssa.is>2021-04-28 21:44:21 +0000
commita8afbb45c12be27b9b93a802e9e276595899ed5a (patch)
treeb4065c9ea79cf310b1b76976f21067761c206d88 /lib/modules.nix
parent81e1e68eaf6c765147da964d356f704030734dd2 (diff)
downloadnixpkgs-a8afbb45c12be27b9b93a802e9e276595899ed5a.tar
nixpkgs-a8afbb45c12be27b9b93a802e9e276595899ed5a.tar.gz
nixpkgs-a8afbb45c12be27b9b93a802e9e276595899ed5a.tar.bz2
nixpkgs-a8afbb45c12be27b9b93a802e9e276595899ed5a.tar.lz
nixpkgs-a8afbb45c12be27b9b93a802e9e276595899ed5a.tar.xz
nixpkgs-a8afbb45c12be27b9b93a802e9e276595899ed5a.tar.zst
nixpkgs-a8afbb45c12be27b9b93a802e9e276595899ed5a.zip
treewide: use lib.warnIf where appropriate
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index d3f10944e70..d515ee24d16 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -37,7 +37,7 @@ let
     setAttrByPath
     toList
     types
-    warn
+    warnIf
     ;
   inherit (lib.options)
     isOption
@@ -516,8 +516,8 @@ rec {
       value = if opt ? apply then opt.apply res.mergedValue else res.mergedValue;
 
       warnDeprecation =
-        if opt.type.deprecationMessage == null then id
-        else warn "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}";
+        warnIf (opt.type.deprecationMessage != null)
+          "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}";
 
     in warnDeprecation opt //
       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;