fix scripts/update to not fail because of linuxPackages

This commit is contained in:
2024-10-02 12:08:44 +00:00
parent 695e639fc9
commit 5884ecde42

View File

@@ -63,8 +63,20 @@ let
pkgs = mkPkgs {};
subAttrs = attrs: lib.filterAttrs (name: value: builtins.isAttrs value) attrs;
# subAttrNames :: AttrSet -> [ String ]
# returns the names of all items in `attrs` which are themselves attrsets.
# presumably, this is the list of items which we may wish to descend into.
subAttrNames = attrs: builtins.attrNames (subAttrs attrs);
subAttrs = attrs: lib.filterAttrs
(name: value:
let
# many attributes in the `pkgs` set do not evaluate (even `pkgs.sane`, thanks to e.g. linuxPackages).
# wrap in `tryEval` to deal with that, and not descend into such attributes.
isAttrs = builtins.tryEval (builtins.isAttrs value);
in
isAttrs.success && isAttrs.value
)
attrs;
# given the path to a package, and that package, returns a list of all attr-paths (stringified)
# which should be updated as part of that package (including the package in question).