summary refs log tree commit diff
path: root/pkgs/build-support/rust
diff options
context:
space:
mode:
authorDaniël de Kok <me@danieldk.eu>2021-02-15 07:06:31 +0100
committerDaniël de Kok <me@danieldk.eu>2021-02-15 07:06:31 +0100
commitd92396039df6cf4c609cf1be47d0802496560e17 (patch)
tree0c2355ce904a0e93d887c4cc6327888fb7dc8345 /pkgs/build-support/rust
parent2b37fe7a77b618ed259f55c73280312435d42aca (diff)
downloadnixpkgs-d92396039df6cf4c609cf1be47d0802496560e17.tar
nixpkgs-d92396039df6cf4c609cf1be47d0802496560e17.tar.gz
nixpkgs-d92396039df6cf4c609cf1be47d0802496560e17.tar.bz2
nixpkgs-d92396039df6cf4c609cf1be47d0802496560e17.tar.lz
nixpkgs-d92396039df6cf4c609cf1be47d0802496560e17.tar.xz
nixpkgs-d92396039df6cf4c609cf1be47d0802496560e17.tar.zst
nixpkgs-d92396039df6cf4c609cf1be47d0802496560e17.zip
buildRustPackage: add cargoDepsName attribute
The directory in the tarball of vendored dependencies contains `name`,
which is by default set to `${pname}-${version}`. This adds an
additional attribute to permit setting the name to something of the
user's choosing.

Since `cargoSha256`/`cargoHash` depend on the name of the directory of
vendored dependencies, `cargoDepsName` can be used to e.g. make the
hash invariant to the package version by setting `cargoDepsName =
pname`.
Diffstat (limited to 'pkgs/build-support/rust')
-rw-r--r--pkgs/build-support/rust/default.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
index dc86a7dc581..4213598b8a3 100644
--- a/pkgs/build-support/rust/default.nix
+++ b/pkgs/build-support/rust/default.nix
@@ -23,6 +23,9 @@
   # Legacy hash
 , cargoSha256 ? ""
 
+  # Name for the vendored dependencies tarball
+, cargoDepsName ? name
+
 , src ? null
 , srcs ? null
 , unpackPhase ? null
@@ -60,7 +63,8 @@ let
 
   cargoDeps = if cargoVendorDir == null
     then fetchCargoTarball ({
-        inherit name src srcs sourceRoot unpackPhase cargoUpdateHook;
+        inherit src srcs sourceRoot unpackPhase cargoUpdateHook;
+        name = cargoDepsName;
         hash = cargoHash;
         patches = cargoPatches;
         sha256 = cargoSha256;