* Add script to automate Nix vendorHash updates - Create update-nix-hash.sh to automate vendorHash calculation - Update vendorHash (to be usedafter recent Go dependency changes) - Script uses ed for OS agnostic in-place editing and extracts hash from nix output Co-Authored-By: Claude <noreply@anthropic.com> * Fix Test Nix Flake CI job * Revert CI change - bd outputs help by default without 'help' arg --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Steve Yegge <stevey@sourcegraph.com>
25 lines
790 B
Bash
Executable File
25 lines
790 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e && cd "$(dirname "$0")/.."
|
|
|
|
# Update the vendorHash in default.nix after Go dependency changes
|
|
# Usage: ./scripts/update-nix-hash.sh
|
|
|
|
echo "Getting correct vendorHash from nix..."
|
|
|
|
# Set pkgs.lib.fakeHash to force nix to output the correct one
|
|
printf ',s|vendorHash = ".*";|vendorHash = pkgs.lib.fakeHash;|\nw\n' | ed -s default.nix
|
|
|
|
# Extract correct hash from nix build error
|
|
CORRECT_HASH=$(nix build --no-link 2>&1 | grep "got:" | awk '{print $2}')
|
|
|
|
if [ -z "$CORRECT_HASH" ]; then
|
|
echo "Error: Could not get hash from nix build"
|
|
git restore default.nix
|
|
exit 1
|
|
fi
|
|
|
|
# Update with correct hash
|
|
printf ',s|vendorHash = pkgs\.lib\.fakeHash;|vendorHash = "%s";|\nw\n' "$CORRECT_HASH" | ed -s default.nix
|
|
|
|
echo "✓ Updated vendorHash to: $CORRECT_HASH"
|