Make config merging smarter
This commit is contained in:
parent
f814ddd972
commit
83b17c5cee
15
default.nix
15
default.nix
@ -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 {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user