Repository-Metriken
- Stars
- (7.981 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 5T 19h) (41 gemergte PRs in 30 T)
Beschreibung
Purpose of this bug report is to document my current findings on this issue in a public place.
I would like a script that can automatically update the hashes in the flakes.
https://github.com/teslamate-org/teslamate/blob/9b2de5ffa0d0943c9bd89825af681fea14af91df/flake.nix#L27 https://github.com/teslamate-org/teslamate/blob/9b2de5ffa0d0943c9bd89825af681fea14af91df/flake.nix#L35
Here is a solution for npm: https://sitr.us/2024/03/08/nix-npm-and-dependabot.html/
Mix is the problem, I don't know obtain the new hash without building with fakeHash, and then replacing the hash with the hash in the error.
Google search showed me this project which attempted to solve this problem https://github.com/argoproj/argo-workflows/pull/12520 with the following shell script:
# this is reliant on the vendorHash being on line 195
sed -i '195s/vendorHash = \"\([^\"]*\)\"/vendorHash = ""/g' ./dev/nix/flake.nix
NIX_HASH=$(nix --log-format raw build ./dev/nix 2>&1 | grep "got: " | awk '{ split($0,a,"got: "); print a[2] }')
sed -i '195s|vendorHash = \"\([^\"]*\)\"|vendorHash = "'$NIX_HASH'"|g' ./dev/nix/flake.nix
echo "Changed Nix hash to : $NIX_HASH"
rm -rf result
Unfortunately this is broken, it will try to build the project with the old hash, and if the old hash exists, it will be the wrong version.