update-dotnet-lockfiles: skip packages that don't evaluate

This allows the script to run on platforms that can't fetch all of the
packages, or without allowing unfree.
This commit is contained in:
David McFarland 2024-09-12 10:56:34 -03:00
parent be577a25f4
commit 3a7d2b8bbf

View File

@ -17,28 +17,30 @@ let
packagesWith = cond: pkgs: packagesWith = cond: pkgs:
let let
packagesWithInner = attrs: packagesWithInner = attrs:
lib.unique ( lib.concatLists (
lib.concatLists ( lib.mapAttrsToList (name: elem:
lib.mapAttrsToList (name: elem: let
let result = builtins.tryEval elem;
result = builtins.tryEval elem; in
in if result.success then
if result.success then let
let value = result.value;
value = result.value; in
in if lib.isDerivation value then
if lib.isDerivation value then lib.optional (cond value) value
lib.optional (cond value) value else
else if lib.isAttrs value && (value.recurseForDerivations or false || value.recurseForRelease or false) then
if lib.isAttrs value && (value.recurseForDerivations or false || value.recurseForRelease or false) then packagesWithInner value
packagesWithInner value else []
else [] else []) attrs);
else []) attrs));
in in
packagesWithInner pkgs; packagesWithInner pkgs;
packages = packages = lib.unique
packagesWith (pkgs: pkgs ? fetch-deps) pkgs; (lib.filter (p:
(builtins.tryEval p.outPath).success ||
builtins.trace "warning: skipping ${p.name} because it failed to evaluate" false)
(packagesWith (p: p ? fetch-deps) pkgs));
helpText = '' helpText = ''
Please run: Please run: