lib: attrs: add 'recursiveMerge'

This commit is contained in:
Bruno BELANYI 2021-09-23 21:55:17 +02:00
parent bd1a2000fe
commit 3fa14ebe71
1 changed files with 15 additions and 1 deletions

View File

@ -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 ::