dotnetCorePackages.mkNugetDeps: support loading JSON lockfiles

This commit is contained in:
GGG
2024-12-05 20:29:28 -03:00
parent c94c5087cc
commit 8ea76507ab

View File

@@ -1,23 +1,33 @@
{ symlinkJoin
, fetchurl
, stdenvNoCC
, lib
, unzip
, patchNupkgs
, nugetPackageHook
, fetchNupkg
{
symlinkJoin,
lib,
fetchNupkg,
}:
lib.makeOverridable(
{ name
, nugetDeps ? import sourceFile
, sourceFile ? null
, installable ? false
lib.makeOverridable (
{
name,
nugetDeps ? null,
sourceFile ? null,
installable ? false,
}:
(symlinkJoin {
name = "${name}-nuget-deps";
paths = nugetDeps {
fetchNuGet = args: fetchNupkg (args // { inherit installable; });
};
}) // {
inherit sourceFile;
paths =
let
loadDeps =
if nugetDeps != null then
nugetDeps
else if lib.hasSuffix ".nix" sourceFile then
assert (lib.isPath sourceFile);
import sourceFile
else
{ fetchNuGet }: builtins.map fetchNuGet (lib.importJSON sourceFile);
in
loadDeps {
fetchNuGet = args: fetchNupkg (args // { inherit installable; });
};
})
// {
inherit sourceFile;
}
)