buildDotnetModule: allow lockFile path to be set in nugetDeps

This allows fetch-deps to find the lock-file for roslyn.

+19 -6
+9 -3
pkgs/build-support/dotnet/build-dotnet-module/default.nix
··· 112 if (nugetDeps != null) then 113 if lib.isDerivation nugetDeps 114 then nugetDeps 115 - else mkNugetDeps { inherit name; nugetDeps = import nugetDeps; } 116 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."; 117 118 # contains the actual package dependencies ··· 138 name = "${name}-nuget-source"; 139 paths = [ dependenciesSource sdkSource ]; 140 }; 141 in 142 stdenvNoCC.mkDerivation (args // { 143 nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [ ··· 180 # Note that toString is necessary here as it results in the path at 181 # eval time (i.e. to the file in your local Nixpkgs checkout) rather 182 # than the Nix store path of the path after it's been imported. 183 - if lib.isPath nugetDeps && !lib.hasPrefix "${builtins.storeDir}/" (toString nugetDeps) 184 - then toString nugetDeps 185 else ''$(mktemp -t "${pname}-deps-XXXXXX.nix")''; 186 in 187 writeShellScript "fetch-${pname}-deps" ''
··· 112 if (nugetDeps != null) then 113 if lib.isDerivation nugetDeps 114 then nugetDeps 115 + else mkNugetDeps { 116 + inherit name; 117 + nugetDeps = import nugetDeps; 118 + sourceFile = nugetDeps; 119 + } 120 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."; 121 122 # contains the actual package dependencies ··· 142 name = "${name}-nuget-source"; 143 paths = [ dependenciesSource sdkSource ]; 144 }; 145 + 146 + nugetDepsFile = _nugetDeps.sourceFile; 147 in 148 stdenvNoCC.mkDerivation (args // { 149 nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [ ··· 186 # Note that toString is necessary here as it results in the path at 187 # eval time (i.e. to the file in your local Nixpkgs checkout) rather 188 # than the Nix store path of the path after it's been imported. 189 + if lib.isPath nugetDepsFile && !lib.hasPrefix "${builtins.storeDir}/" (toString nugetDepsFile) 190 + then toString nugetDepsFile 191 else ''$(mktemp -t "${pname}-deps-XXXXXX.nix")''; 192 in 193 writeShellScript "fetch-${pname}-deps" ''
+4 -2
pkgs/build-support/dotnet/make-nuget-deps/default.nix
··· 1 { linkFarmFromDrvs, fetchurl }: 2 - { name, nugetDeps }: 3 linkFarmFromDrvs "${name}-nuget-deps" (nugetDeps { 4 fetchNuGet = { pname, version, sha256 5 , url ? "https://www.nuget.org/api/v2/package/${pname}/${version}" }: ··· 7 name = "${pname}.${version}.nupkg"; 8 inherit url sha256; 9 }; 10 - })
··· 1 { linkFarmFromDrvs, fetchurl }: 2 + { name, nugetDeps, sourceFile ? null }: 3 linkFarmFromDrvs "${name}-nuget-deps" (nugetDeps { 4 fetchNuGet = { pname, version, sha256 5 , url ? "https://www.nuget.org/api/v2/package/${pname}/${version}" }: ··· 7 name = "${pname}.${version}.nupkg"; 8 inherit url sha256; 9 }; 10 + }) // { 11 + inherit sourceFile; 12 + }
+6 -1
pkgs/development/compilers/roslyn/default.nix
··· 4 , buildDotnetModule 5 , dotnetCorePackages 6 , unzip 7 }: 8 9 buildDotnetModule rec { ··· 21 22 projectFile = [ "src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj" ]; 23 24 - nugetDeps = ./extended-deps.nix; 25 26 dontDotnetFixup = true; 27
··· 4 , buildDotnetModule 5 , dotnetCorePackages 6 , unzip 7 + , mkNugetDeps 8 }: 9 10 buildDotnetModule rec { ··· 22 23 projectFile = [ "src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj" ]; 24 25 + nugetDeps = mkNugetDeps { 26 + name = "${pname}-deps"; 27 + nugetDeps = import ./extended-deps.nix; 28 + sourceFile = ./deps.nix; 29 + }; 30 31 dontDotnetFixup = true; 32