buildDotnetModule: allow lockFile path to be set in nugetDeps
This allows fetch-deps to find the lock-file for roslyn.
This commit is contained in:
parent
cbf0490176
commit
9c16cea2bb
3 changed files with 19 additions and 6 deletions
|
@ -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" ''
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue