From d92396039df6cf4c609cf1be47d0802496560e17 Mon Sep 17 00:00:00 2001 From: Daniƫl de Kok Date: Mon, 15 Feb 2021 07:06:31 +0100 Subject: 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`. --- pkgs/build-support/rust/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pkgs/build-support/rust') 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; -- cgit 1.4.1