diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix index a9c49d1e526e..0e9cd21a3b35 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix @@ -112,7 +112,11 @@ let if (nugetDeps != null) then if lib.isDerivation nugetDeps then nugetDeps - else mkNugetDeps { inherit name; nugetDeps = import nugetDeps; } + else mkNugetDeps { + inherit name; + nugetDeps = import nugetDeps; + sourceFile = nugetDeps; + } else throw "Defining the `nugetDeps` attribute is required, as to lock the NuGet dependencies. This file can be generated by running the `passthru.fetch-deps` script."; # contains the actual package dependencies @@ -138,6 +142,8 @@ let name = "${name}-nuget-source"; paths = [ dependenciesSource sdkSource ]; }; + + nugetDepsFile = _nugetDeps.sourceFile; in stdenvNoCC.mkDerivation (args // { nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [ @@ -180,8 +186,8 @@ stdenvNoCC.mkDerivation (args // { # Note that toString is necessary here as it results in the path at # eval time (i.e. to the file in your local Nixpkgs checkout) rather # than the Nix store path of the path after it's been imported. - if lib.isPath nugetDeps && !lib.hasPrefix "${builtins.storeDir}/" (toString nugetDeps) - then toString nugetDeps + if lib.isPath nugetDepsFile && !lib.hasPrefix "${builtins.storeDir}/" (toString nugetDepsFile) + then toString nugetDepsFile else ''$(mktemp -t "${pname}-deps-XXXXXX.nix")''; in writeShellScript "fetch-${pname}-deps" '' diff --git a/pkgs/build-support/dotnet/make-nuget-deps/default.nix b/pkgs/build-support/dotnet/make-nuget-deps/default.nix index 723646c5fdca..8281976df626 100644 --- a/pkgs/build-support/dotnet/make-nuget-deps/default.nix +++ b/pkgs/build-support/dotnet/make-nuget-deps/default.nix @@ -1,5 +1,5 @@ { linkFarmFromDrvs, fetchurl }: -{ name, nugetDeps }: +{ name, nugetDeps, sourceFile ? null }: linkFarmFromDrvs "${name}-nuget-deps" (nugetDeps { fetchNuGet = { pname, version, sha256 , url ? "https://www.nuget.org/api/v2/package/${pname}/${version}" }: @@ -7,4 +7,6 @@ linkFarmFromDrvs "${name}-nuget-deps" (nugetDeps { name = "${pname}.${version}.nupkg"; inherit url sha256; }; -}) +}) // { + inherit sourceFile; +} diff --git a/pkgs/development/compilers/roslyn/default.nix b/pkgs/development/compilers/roslyn/default.nix index 4fa028bc00ef..0ed6c89681db 100644 --- a/pkgs/development/compilers/roslyn/default.nix +++ b/pkgs/development/compilers/roslyn/default.nix @@ -4,6 +4,7 @@ , buildDotnetModule , dotnetCorePackages , unzip +, mkNugetDeps }: buildDotnetModule rec { @@ -21,7 +22,11 @@ buildDotnetModule rec { projectFile = [ "src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj" ]; - nugetDeps = ./extended-deps.nix; + nugetDeps = mkNugetDeps { + name = "${pname}-deps"; + nugetDeps = import ./extended-deps.nix; + sourceFile = ./deps.nix; + }; dontDotnetFixup = true;