about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorBob van der Linden <bobvanderlinden@gmail.com>2023-02-10 10:20:13 +0100
committerWinter <winter@winter.cafe>2023-02-14 16:14:08 -0500
commite3a10a12c7731479b3539fc8a81d9d61f547a4fa (patch)
treedb83d83d5784a552a7bb958ea0f1e73799199beb /pkgs/build-support
parent4a816703fd5de49b05c5fc9faa71818eb8fe9711 (diff)
rustPlatform.cargoSetupHook: improve cargoHash instructions
Currently cargo-setup-hook instructs the builder upon cargoSha256 or
cargoHash being out-of-date compared to the Cargo.lock file.

The instructions can be simplified a bit, because nowadays it is fine to
keep a hash empty, instead of filling it with
`0000000000000000000000000000000000000000000000000000`.

Nix nowadays outputs SRI hashes, which should usually be placed in
`cargoHash` instead of `cargoSha256`, but the instructions are still
only referring to `cargoSha256`.

Lastly, the output of Nix doesn't include `got: sha256: ` anymore, as it
now outputs `got: sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=`.
It would be nice to make it clear that the trailing `=` is important as
well, so the full example SRI hash is mentioned.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/rust/hooks/cargo-setup-hook.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/pkgs/build-support/rust/hooks/cargo-setup-hook.sh b/pkgs/build-support/rust/hooks/cargo-setup-hook.sh
index 8146573e79dba..90a81d68b5200 100644
--- a/pkgs/build-support/rust/hooks/cargo-setup-hook.sh
+++ b/pkgs/build-support/rust/hooks/cargo-setup-hook.sh
@@ -61,14 +61,15 @@ cargoSetupPostPatchHook() {
       fi
 
       echo
-      echo "ERROR: cargoSha256 is out of date"
+      echo "ERROR: cargoHash or cargoSha256 is out of date"
       echo
       echo "Cargo.lock is not the same in $cargoDepsCopy"
       echo
       echo "To fix the issue:"
-      echo '1. Use "0000000000000000000000000000000000000000000000000000" as the cargoSha256 value'
-      echo "2. Build the derivation and wait for it to fail with a hash mismatch"
-      echo "3. Copy the 'got: sha256:' value back into the cargoSha256 field"
+      echo '1. Set cargoHash/cargoSha256 to an empty string: `cargoHash = "";`'
+      echo '2. Build the derivation and wait for it to fail with a hash mismatch'
+      echo '3. Copy the "got: sha256-..." value back into the cargoHash field'
+      echo '   You should have: cargoHash = "sha256-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=";'
       echo
 
       exit 1