diff --git a/pkgs/build-support/dotnet/make-nuget-deps/default.nix b/pkgs/build-support/dotnet/make-nuget-deps/default.nix index efc3d07e9777..668ce30404f2 100644 --- a/pkgs/build-support/dotnet/make-nuget-deps/default.nix +++ b/pkgs/build-support/dotnet/make-nuget-deps/default.nix @@ -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; + } +)