refactor: some nix code cleanups

This commit is contained in:
matt1432 2025-01-06 14:41:55 -05:00
parent df9a370408
commit 82c8cb4b1f
24 changed files with 392 additions and 715 deletions
lib/attrs

View file

@ -1,9 +1,20 @@
{...}: let
inherit (builtins) hasAttr isAttrs tryEval;
inputsLib = import ../../inputs/lib.nix;
in {
inherit (inputsLib) recursiveUpdateList;
{
foldl,
hasAttr,
isAttrs,
isList,
mergeAttrsWithFunc,
unique,
...
}: {
inherit (import ../../inputs/lib.nix) recursiveUpdateList;
throws = x: !(tryEval x).success;
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;
}