[RFC PATCH nixpkgs 6/9] rustPlatform: forward unpack hooks to cargo fetch

Alyssa Ross
2022-09-28T17:01:50Z

Sometimes it's more ergonomic to set up the build environment in
hooks, to add to the default behaviour rather than replacing it. It's
very surprising that the fetcher works fine with a custom unpackPhase,
but not with custom preUnpack or postUnpack.

Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
---
pkgs/build-support/rust/build-rust-package/default.nix | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pkgs/build-support/rust/build-rust-package/default.nix b/pkgs/build-support/rust/build-rust-package/default.nix
index db0d2c53bb1..c35f906ba08 100644
--- a/pkgs/build-support/rust/build-rust-package/default.nix
+++ b/pkgs/build-support/rust/build-rust-package/default.nix
@@ -22,7 +22,9 @@

, src ? null
, srcs ? null
+, preUnpack ? null
, unpackPhase ? null
+, postUnpack ? null
, cargoPatches ? []
, patches ? []
, sourceRoot ? null
@@ -63,7 +65,7 @@ let
if cargoVendorDir != null then null
else if cargoLock != null then importCargoLock cargoLock
else fetchCargoTarball ({
- inherit src srcs sourceRoot unpackPhase cargoUpdateHook;
+ inherit src srcs sourceRoot preUnpack unpackPhase postUnpack cargoUpdateHook;
name = cargoDepsName;
patches = cargoPatches;
} // lib.optionalAttrs (args ? cargoHash) {
--
2.37.1