summary refs log tree commit diff
path: root/lib/modules.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2021-05-05 18:53:34 +0200
committerRobert Hensing <robert@roberthensing.nl>2021-05-05 18:53:34 +0200
commita36e6760e9be0ec260b637a06d751d39e2a78e4e (patch)
treedc278a689d87d11c6b6f13fdbbd925905416119f /lib/modules.nix
parente7412dde1f0a3d141839f05f5a06a12df84dc2c6 (diff)
downloadnixpkgs-a36e6760e9be0ec260b637a06d751d39e2a78e4e.tar
nixpkgs-a36e6760e9be0ec260b637a06d751d39e2a78e4e.tar.gz
nixpkgs-a36e6760e9be0ec260b637a06d751d39e2a78e4e.tar.bz2
nixpkgs-a36e6760e9be0ec260b637a06d751d39e2a78e4e.tar.lz
nixpkgs-a36e6760e9be0ec260b637a06d751d39e2a78e4e.tar.xz
nixpkgs-a36e6760e9be0ec260b637a06d751d39e2a78e4e.tar.zst
nixpkgs-a36e6760e9be0ec260b637a06d751d39e2a78e4e.zip
Revert "lib/modules: Issue type deprecation warnings recursively"
This reverts commit 4b54aedee5e05aaf2838f6d951508b83e33d2baa.
Diffstat (limited to 'lib/modules.nix')
-rw-r--r--lib/modules.nix17
1 files changed, 4 insertions, 13 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index 04b65d791b5..d515ee24d16 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -515,20 +515,11 @@ rec {
       # yield a value computed from the definitions
       value = if opt ? apply then opt.apply res.mergedValue else res.mergedValue;
 
-      # Issue deprecation warnings recursively over all nested types of the
-      # given type. But don't recurse if a type with the same name was already
-      # visited before in order to prevent infinite recursion. So this only
-      # warns once per type name.
-      # Returns the new set of visited type names
-      recursiveWarn = visited: type:
-        let
-          maybeWarn = warnIf (type.deprecationMessage != null)
-            "The type `types.${type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${type.deprecationMessage}";
-        in
-          if visited ? ${type.name} then visited
-          else lib.foldl' recursiveWarn (maybeWarn visited // { ${type.name} = null; }) (lib.attrValues type.nestedTypes);
+      warnDeprecation =
+        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 builtins.seq (recursiveWarn {} opt.type) opt //
+    in warnDeprecation opt //
       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
         inherit (res.defsFinal') highestPrio;
         definitions = map (def: def.value) res.defsFinal;