Make config merging smarter

This commit is contained in:
Brian Picciano 2024-01-06 15:57:47 +01:00
parent f814ddd972
commit 83b17c5cee

View File

@ -8,7 +8,20 @@
}: let
config = (import ./config/default.nix) // hostConfig ;
recursiveMerge = with pkgs.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;
config = recursiveMerge [ (import ./config/default.nix) hostConfig ];
in rec {