lib: attrs: add 'recursiveMerge'
This commit is contained in:
parent
c13e57f584
commit
8ce123c527
|
@ -1,6 +1,13 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib) filterAttrs listToAttrs mapAttrs' nameValuePair;
|
inherit (lib)
|
||||||
|
filterAttrs
|
||||||
|
foldl
|
||||||
|
listToAttrs
|
||||||
|
mapAttrs'
|
||||||
|
nameValuePair
|
||||||
|
recursiveUpdate
|
||||||
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Filter a generated set of attrs using a predicate function.
|
# Filter a generated set of attrs using a predicate function.
|
||||||
|
@ -19,6 +26,13 @@ in
|
||||||
# attrs
|
# attrs
|
||||||
genAttrs' = values: f: listToAttrs (map f values);
|
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
|
# Rename each of the attributes in an attribute set using the mapping function
|
||||||
#
|
#
|
||||||
# renameAttrs ::
|
# renameAttrs ::
|
||||||
|
|
Loading…
Reference in a new issue