nixos-configs/lib/attrs/default.nix
matt1432 82c8cb4b1f
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: some nix code cleanups
2025-01-06 14:41:55 -05:00

20 lines
394 B
Nix

{
foldl,
hasAttr,
isAttrs,
isList,
mergeAttrsWithFunc,
unique,
...
}: {
inherit (import ../../inputs/lib.nix) recursiveUpdateList;
throws = x: !(builtins.tryEval x).success;
hasVersion = x: isAttrs x && hasAttr "version" x;
mergeAttrsList = list:
foldl (mergeAttrsWithFunc (a: b:
if isList a && isList b
then unique (a ++ b)
else b)) {}
list;
}