diff options
author | David McFarland <corngood@gmail.com> | 2023-06-24 12:52:35 -0300 |
---|---|---|
committer | David McFarland <corngood@gmail.com> | 2023-06-24 17:17:41 -0300 |
commit | 9c16cea2bbd0b8e172bec49382d1e35861892263 (patch) | |
tree | ba16a064b9517ac09d0de0c0bdfd7dd4959721b4 /pkgs/build-support | |
parent | cbf0490176c86e3c674048df1b99a516d125cb91 (diff) |
buildDotnetModule: allow lockFile path to be set in nugetDeps
This allows fetch-deps to find the lock-file for roslyn.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/dotnet/build-dotnet-module/default.nix | 12 | ||||
-rw-r--r-- | pkgs/build-support/dotnet/make-nuget-deps/default.nix | 6 |
2 files changed, 13 insertions, 5 deletions
diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix index a9c49d1e526eb..0e9cd21a3b357 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 723646c5fdcab..8281976df6260 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; +} |