dotnetCorePackages.mkNugetDeps: support loading JSON lockfiles

GGG 8ea76507 c94c5087

Changed files
+28 -18
pkgs
build-support
dotnet
make-nuget-deps
+28 -18
pkgs/build-support/dotnet/make-nuget-deps/default.nix
···
-
{ 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; });
-
};
-
}) // {
+
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;
-
})
+
}
+
)