nixos-configs/lib/attrs/default.nix

21 lines
394 B
Nix
Raw Normal View History

2025-01-06 14:41:55 -05:00
{
foldl,
hasAttr,
isAttrs,
isList,
mergeAttrsWithFunc,
unique,
...
}: {
inherit (import ../../inputs/lib.nix) recursiveUpdateList;
2024-12-29 05:40:30 -05:00
2025-01-06 14:41:55 -05:00
throws = x: !(builtins.tryEval x).success;
2024-12-29 05:40:30 -05:00
hasVersion = x: isAttrs x && hasAttr "version" x;
2025-01-06 14:41:55 -05:00
mergeAttrsList = list:
foldl (mergeAttrsWithFunc (a: b:
if isList a && isList b
then unique (a ++ b)
else b)) {}
list;
}