3
0
Fork 0
forked from mirrors/nixpkgs

rustPlatform: forward unpack hooks to cargo fetch

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.

Packages that use preUnpack or postUnpack and Cargo FODs seem to be
very rare.  I searched Nixpkgs for files containing one of
"cargoHash", "cargoDeps", and "cargoSha256", and one of "preUnpack" or
"postUnpack", and only found two such packages:
python3.pkgs.tokenizers and rustdesk.  Neither of their Cargo FOD
hashes are affected by this change.  So if that's any indication,
we're unlikely to be breaking many out-of-tree hashes with these
changes either.
This commit is contained in:
Alyssa Ross 2022-09-30 21:09:03 +00:00 committed by Alyssa Ross
parent e0ba4bd0e7
commit cd6818baf7
No known key found for this signature in database
GPG key ID: F9DBED4859B271C0

View file

@ -24,7 +24,9 @@
, src ? null
, srcs ? null
, preUnpack ? null
, unpackPhase ? null
, postUnpack ? null
, cargoPatches ? []
, patches ? []
, sourceRoot ? null
@ -68,7 +70,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) {