Unverified Commit cd6818ba authored by Alyssa Ross's avatar Alyssa Ross Committed by Alyssa Ross
Browse files

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.
parent e0ba4bd0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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) {