solana-validator: adapt update script to new nix-prefetch-github

The update script is also already broken and needs:

1. Add missing packages to the shebang.
2. Retrieve cargo hash from the proper package.

We also take the opportunity to switch ot using the newer "hash" and
"cargoHash" properties.

+15 -15
+4 -4
pkgs/applications/blockchains/solana-validator/default.nix
··· 42 42 let 43 43 pinData = lib.importJSON ./pin.json; 44 44 version = pinData.version; 45 - sha256 = pinData.sha256; 46 - cargoSha256 = pinData.cargoSha256; 45 + hash = pinData.hash; 46 + cargoHash = pinData.cargoHash; 47 47 in 48 48 rustPlatform.buildRustPackage rec { 49 49 pname = "solana-validator"; ··· 53 53 owner = "solana-labs"; 54 54 repo = "solana"; 55 55 rev = "v${version}"; 56 - inherit sha256; 56 + inherit hash; 57 57 }; 58 58 59 59 # partly inspired by https://github.com/obsidiansystems/solana-bridges/blob/develop/default.nix#L29 60 - inherit cargoSha256; 60 + inherit cargoHash; 61 61 62 62 cargoBuildFlags = builtins.map (n: "--bin=${n}") solanaPkgs; 63 63
+2 -2
pkgs/applications/blockchains/solana-validator/pin.json
··· 1 1 { 2 2 "version": "1.10.35", 3 - "sha256": "sha256-y7+ogMJ5E9E/+ZaTCHWOQWG7iR+BGuVqvlNUDT++Ghc=", 4 - "cargoSha256": "sha256-idlu9qkh2mrF6MxstRcvemKrtTGNY/InBnIDqRvDQPs" 3 + "hash": "sha256-y7+ogMJ5E9E/+ZaTCHWOQWG7iR+BGuVqvlNUDT++Ghc=", 4 + "cargoHash": "sha256-idlu9qkh2mrF6MxstRcvemKrtTGNY/InBnIDqRvDQPs" 5 5 }
+9 -9
pkgs/applications/blockchains/solana-validator/update.sh
··· 1 1 #!/usr/bin/env nix-shell 2 - #! nix-shell -i oil -p jq sd nix-prefetch-github ripgrep 2 + #! nix-shell -i oil -p jq moreutils nix-prefetch-github gnused 3 3 4 4 # TODO set to `verbose` or `extdebug` once implemented in oil 5 5 shopt --set xtrace 6 - # we need failures inside of command subs to get the correct cargoSha256 6 + # we need failures inside of command subs to get the correct cargoHash 7 7 shopt --unset inherit_errexit 8 8 9 9 const directory = $(dirname $0 | xargs realpath) ··· 11 11 const repo = "solana" 12 12 const latest_rev = $(curl -q https://api.github.com/repos/${owner}/${repo}/releases/latest | \ 13 13 jq -r '.tag_name') 14 - const latest_version = $(echo $latest_rev | sd 'v' '') 14 + const latest_version = $(echo ${latest_rev#v}) 15 15 const current_version = $(jq -r '.version' $directory/pin.json) 16 16 if ("$latest_version" === "$current_version") { 17 17 echo "solana is already up-to-date" 18 18 return 0 19 19 } else { 20 20 const tarball_meta = $(nix-prefetch-github $owner $repo --rev "$latest_rev") 21 - const tarball_hash = "sha256-$(echo $tarball_meta | jq -r '.sha256')" 21 + const tarball_hash = $(echo $tarball_meta | jq -r '.hash') 22 22 23 23 jq ".version = \"$latest_version\" | \ 24 - .\"sha256\" = \"$tarball_hash\" | \ 25 - .\"cargoSha256\" = \"\"" $directory/pin.json | sponge $directory/pin.json 24 + .\"hash\" = \"$tarball_hash\" | \ 25 + .\"cargoHash\" = \"\"" $directory/pin.json | sponge $directory/pin.json 26 26 27 - const new_cargo_sha256 = $(nix-build -A solana-testnet 2>&1 | \ 27 + const new_cargo_hash = $(nix-build -A solana-validator 2>&1 | \ 28 28 tail -n 2 | \ 29 29 head -n 1 | \ 30 - sd '\s+got:\s+' '') 30 + sed 's/\s*got:\s*//') 31 31 32 - jq ".cargoSha256 = \"$new_cargo_sha256\"" $directory/pin.json | sponge $directory/pin.json 32 + jq ".cargoHash = \"$new_cargo_hash\"" $directory/pin.json | sponge $directory/pin.json 33 33 }