lib: attrs: add 'recursiveMerge'
This commit is contained in:
parent
bd1a2000fe
commit
3fa14ebe71
|
@ -1,6 +1,13 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib) filterAttrs listToAttrs mapAttrs' nameValuePair;
|
||||
inherit (lib)
|
||||
filterAttrs
|
||||
foldl
|
||||
listToAttrs
|
||||
mapAttrs'
|
||||
nameValuePair
|
||||
recursiveUpdate
|
||||
;
|
||||
in
|
||||
{
|
||||
# Filter a generated set of attrs using a predicate function.
|
||||
|
@ -19,6 +26,13 @@ in
|
|||
# attrs
|
||||
genAttrs' = values: f: listToAttrs (map f values);
|
||||
|
||||
# Merge a list of attrs recursively, later values override previous ones.
|
||||
#
|
||||
# recursiveMerge ::
|
||||
# [ attrs ]
|
||||
# attrs
|
||||
recursiveMerge = foldl recursiveUpdate { };
|
||||
|
||||
# Rename each of the attributes in an attribute set using the mapping function
|
||||
#
|
||||
# renameAttrs ::
|
||||
|
|
Loading…
Reference in a new issue