treewide: remove all cargoSha256 usage#323983
Conversation
|
Logically speaking it should not cause such rebuilds (or actually it will)? |
|
Yeah, I am not sure if it's worth the rebuilding effort. Improvements like this can come atomically, like when updating that specific package. |
|
Ah, I see. The hash here will not only be consumed by buildRustPackage, it also exists as an environment variable.
In theory we should deprecate it and avoid further usages altogether. We have already done that for golang's vendorHash (vendorSha256). |
I don't know about this. It feels like it's better to do a treewide into staging and let hydra take the hit once, rather than keep spending review time on it for random PRs. It will probably also make a higher percentage of new PRs use |
|
Once we have all treewide changes done, we can let it throw a warning, and let |
ea1c933 to
bde993f
Compare
bde993f to
c23dfb1
Compare
03b9e02 to
7cf5762
Compare
Most of the time it won't make a difference because something else in staging will have caused the rust toolchain to rebuild from source anyway. |
|
Oh the conflict is in staging, not master |
5522af8 to
2e3cd81
Compare
This is done with the following bash script:
```
#!/usr/bin/env bash
process_line() {
local filename=${1%:}
if [[ $4 =~ \"(.*)\"\; ]]; then
local sha256="${BASH_REMATCH[1]}"
fi
[[ -z $sha256 ]] && return 0
local hash=$(nix hash to-sri --type sha256 $sha256)
echo "Processing: $filename"
echo " $sha256 => $hash"
sed -i "s|cargoSha256 = \"$sha256\"|cargoHash = \"$hash\"|"
$filename
}
# split output by line
grep -r 'cargoSha256 = ' . | while IFS= read -r line; do
# split them further by space
read -r -a parts <<< "$line"
process_line "${parts[@]}"
done
```
2e3cd81 to
f6ee8a0
Compare
JohnRTitor
left a comment
There was a problem hiding this comment.
LGTM, passes my eyeball test
This is a mismatch after merging both of: - NixOS#323983 - NixOS#322749
|
Missed |
Description of changes
First treewide (easy)
Treewide command:
Second treewide
Treewide bash script (which was executed in
pkgs):There are some exceptions, basically using a wrapped builder, or writing in
let. I've manually fixed them. Would be better to check again.buildRustPackage changes
I'm not really sure about this part.
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.