summary refs log tree commit diff
path: root/pkgs/build-support/dotnet/build-dotnet-module/default.nix
diff options
context:
space:
mode:
authorAtemu <atemu.main@gmail.com>2023-02-28 19:00:14 +0100
committerAtemu <atemu.main@gmail.com>2023-02-28 19:04:56 +0100
commit014eba883e7d81771c9c8cb938618e5a3f35208d (patch)
treebb2655a38d6aa9dac6fd20f61d45e7328e32274a /pkgs/build-support/dotnet/build-dotnet-module/default.nix
parent988cc958c57ce4350ec248d2d53087777f9e1949 (diff)
downloadnixpkgs-014eba883e7d81771c9c8cb938618e5a3f35208d.tar
nixpkgs-014eba883e7d81771c9c8cb938618e5a3f35208d.tar.gz
nixpkgs-014eba883e7d81771c9c8cb938618e5a3f35208d.tar.bz2
nixpkgs-014eba883e7d81771c9c8cb938618e5a3f35208d.tar.lz
nixpkgs-014eba883e7d81771c9c8cb938618e5a3f35208d.tar.xz
nixpkgs-014eba883e7d81771c9c8cb938618e5a3f35208d.tar.zst
nixpkgs-014eba883e7d81771c9c8cb938618e5a3f35208d.zip
buildDotnetModule: point fetch-deps at module's deps file by default
Previously, you had to provide the path to the deps.nix of the package inside
your Nixpkgs checkout as an argument manually. Now it just does that by default
when no argument is passed.
Diffstat (limited to 'pkgs/build-support/dotnet/build-dotnet-module/default.nix')
-rw-r--r--pkgs/build-support/dotnet/build-dotnet-module/default.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix
index 514255f324a..311eb2b293e 100644
--- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix
+++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix
@@ -168,6 +168,15 @@ stdenvNoCC.mkDerivation (args // {
           if runtimeId != null
           then [ runtimeId ]
           else map (system: dotnetCorePackages.systemToDotnetRid system) platforms;
+        defaultDepsFile =
+          # Wire in the nugetDeps file such that running the script with no args
+          # runs it agains the correct deps file by default.
+          # 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 "/nix/store/" (toString nugetDeps)
+          then toString nugetDeps
+          else ''$(mktemp -t "${pname}-deps-XXXXXX.nix")'';
       in
       writeShellScript "fetch-${pname}-deps" ''
         set -euo pipefail
@@ -238,7 +247,8 @@ stdenvNoCC.mkDerivation (args // {
         export DOTNET_NOLOGO=1
         export DOTNET_CLI_TELEMETRY_OPTOUT=1
 
-        depsFile=$(realpath "''${1:-$(mktemp -t "${pname}-deps-XXXXXX.nix")}")
+        depsFile=$(realpath "''${1:-${defaultDepsFile}}")
+        echo Will write lockfile to "$depsFile"
         mkdir -p "$tmp/nuget_pkgs"
 
         storeSrc="${srcOnly args}"