lib: mkTypedMerge: fix to work with recursive attrsets
This commit is contained in:
parent
45a1c07210
commit
4d3248d315
|
@ -20,9 +20,13 @@ sane-lib = rec {
|
|||
isPrefixOfList = p: l: (lib.sublist 0 (lib.length p) l) == p;
|
||||
|
||||
# merges N attrsets
|
||||
# Type: flattenAttrsList :: [AttrSet] -> AttrSet
|
||||
# Type: joinAttrsets :: [AttrSet] -> AttrSet
|
||||
joinAttrsets = l: lib.foldl' lib.attrsets.unionOfDisjoint {} l;
|
||||
|
||||
# merges N attrsets, recursively
|
||||
# Type: joinAttrsetsRecursive :: [AttrSet] -> AttrSet
|
||||
joinAttrsetsRecursive = l: lib.foldl' (lib.attrsets.recursiveUpdateUntil (path: lhs: rhs: false)) {} l;
|
||||
|
||||
# evaluate a `{ name, value }` pair in the same way that `listToAttrs` does.
|
||||
# Type: nameValueToAttrs :: { name :: String, value :: Any } -> Any
|
||||
nameValueToAttrs = { name, value }: {
|
||||
|
|
|
@ -17,7 +17,7 @@ rec {
|
|||
merged = builtins.map (p: lib.setAttrByPath p (mergeAtPath p discharged)) pathsToMerge;
|
||||
in
|
||||
assert builtins.all (assertNoExtraPaths pathsToMerge) discharged;
|
||||
sane-lib.joinAttrsets merged;
|
||||
sane-lib.joinAttrsetsRecursive merged;
|
||||
|
||||
# `take` is as in mkTypedMerge. this function queries which items `take` is interested in.
|
||||
# for example:
|
||||
|
|
Loading…
Reference in New Issue