hylonix/lib/default.nix

32 lines
820 B
Nix
Raw Permalink Normal View History

2026-02-22 17:59:18 +00:00
lib: {
hylonix = {
recursiveMerge =
let
f =
x: y:
if y == null then
x
else if builtins.typeOf x != builtins.typeOf y then
y
else if builtins.typeOf x == "set" then
builtins.listToAttrs (
builtins.map (name: {
inherit name;
value = f (x.${name} or null) (y.${name} or null);
}) (builtins.attrNames y ++ builtins.attrNames x)
)
else if builtins.typeOf x == "list" then
x ++ y
else
y;
in
f;
recursiveMergeAll = builtins.foldl' lib.hylonix.recursiveMerge null;
compose = lib.trivial.flip (lib.foldr lib.trivial.id);
};
inherit (lib.hylonix) compose recursiveMerge recursiveMergeAll;
2026-02-22 17:59:18 +00:00
}