summary refs log tree commit diff
path: root/lib/types.nix
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2021-10-02 16:37:22 +0200
committerSilvan Mosberger <contact@infinisil.com>2021-10-02 16:37:22 +0200
commit48293bd6b6b791b9af745e9b7b94a6856e279fa0 (patch)
tree0ea4d2706a5503ce6837fcb81d4e841d1b28c403 /lib/types.nix
parent54e1db21522a61ca771aeafbbd77c4a474e82f8e (diff)
downloadnixpkgs-48293bd6b6b791b9af745e9b7b94a6856e279fa0.tar
nixpkgs-48293bd6b6b791b9af745e9b7b94a6856e279fa0.tar.gz
nixpkgs-48293bd6b6b791b9af745e9b7b94a6856e279fa0.tar.bz2
nixpkgs-48293bd6b6b791b9af745e9b7b94a6856e279fa0.tar.lz
nixpkgs-48293bd6b6b791b9af745e9b7b94a6856e279fa0.tar.xz
nixpkgs-48293bd6b6b791b9af745e9b7b94a6856e279fa0.tar.zst
nixpkgs-48293bd6b6b791b9af745e9b7b94a6856e279fa0.zip
lib/types: Make types.anything merge functions
Previously it would give an error if there were multiple function
definitions.
Diffstat (limited to 'lib/types.nix')
-rw-r--r--lib/types.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix
index a0be2ff3a45..c2532065d7e 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -192,6 +192,12 @@ rec {
               else (listOf anything).merge;
             # This is the type of packages, only accept a single definition
             stringCoercibleSet = mergeOneOption;
+            lambda = loc: defs: arg: anything.merge
+              (loc ++ [ "<function body>" ])
+              (map (def: {
+                file = def.file;
+                value = def.value arg;
+              }) defs);
             # Otherwise fall back to only allowing all equal definitions
           }.${commonType} or mergeEqualOption;
         in mergeFunction loc defs;