summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2021-11-03 19:45:06 +0100
committerRobert Hensing <robert@roberthensing.nl>2021-11-03 19:47:03 +0100
commit844a9e746f92ac7278ece51c2b7819d0e6c5c05d (patch)
tree38e4ff8402b3f6ab37b3e0bac25d7d20b276d009 /lib
parent541ce53a3bfa9c769ce4aa755d1c452cb3bdc2dd (diff)
downloadnixpkgs-844a9e746f92ac7278ece51c2b7819d0e6c5c05d.tar
nixpkgs-844a9e746f92ac7278ece51c2b7819d0e6c5c05d.tar.gz
nixpkgs-844a9e746f92ac7278ece51c2b7819d0e6c5c05d.tar.bz2
nixpkgs-844a9e746f92ac7278ece51c2b7819d0e6c5c05d.tar.lz
nixpkgs-844a9e746f92ac7278ece51c2b7819d0e6c5c05d.tar.xz
nixpkgs-844a9e746f92ac7278ece51c2b7819d0e6c5c05d.tar.zst
nixpkgs-844a9e746f92ac7278ece51c2b7819d0e6c5c05d.zip
lib/modules: Use strict fold' as recursiveUpdate is also strict
recursiveUpdate does not produce an attrset until it has evaluated
both its arguments to weak head normal form.

    nix-repl> lib.recursiveUpdate (throw "a") (throw "b")
    error: b

    nix-repl> lib.recursiveUpdate (throw "a") {}
    error: a
Diffstat (limited to 'lib')
-rw-r--r--lib/modules.nix3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/modules.nix b/lib/modules.nix
index 99f51d22dcd..e3abf846625 100644
--- a/lib/modules.nix
+++ b/lib/modules.nix
@@ -13,7 +13,6 @@ let
     elem
     filter
     findFirst
-    foldl
     foldl'
     getAttrFromPath
     head
@@ -863,7 +862,7 @@ rec {
   mkMergedOptionModule = from: to: mergeFn:
     { config, options, ... }:
     {
-      options = foldl recursiveUpdate {} (map (path: setAttrByPath path (mkOption {
+      options = foldl' recursiveUpdate {} (map (path: setAttrByPath path (mkOption {
         visible = false;
         # To use the value in mergeFn without triggering errors
         default = "_mkMergedOptionModule";