24 lines
535 B
Nix
24 lines
535 B
Nix
let
|
|
|
|
pkgs = import <nixpkgs> { };
|
|
# Somehow, if fed the pkgs from a nix-build, it creates an infinite recursion, hence the search path
|
|
lib = pkgs.lib;
|
|
|
|
recursiveMerge = with lib; attrList:
|
|
let f = attrPath:
|
|
zipAttrsWith (n: values:
|
|
if tail values == [ ]
|
|
then head values
|
|
else if all isList values
|
|
then unique (concatLists values)
|
|
else if all isAttrs values
|
|
then f (attrPath ++ [ n ]) values
|
|
else last values
|
|
);
|
|
in f [ ] attrList;
|
|
|
|
|
|
in
|
|
|
|
recursiveMerge
|