os/lib/recursive-merge.nix
2023-11-10 19:48:06 +01:00

17 lines
331 B
Nix

{ 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;