update-flake.sh 689 B

123456789101112131415161718
  1. #!/bin/sh
  2. # Updates SRI hashes for flake.nix.
  3. set -eu
  4. OUT=$(mktemp -d -t nar-hash-XXXXXX)
  5. rm -rf "$OUT"
  6. ./tool/go mod vendor -o "$OUT"
  7. ./tool/go run tailscale.com/cmd/nardump --sri "$OUT" >go.mod.sri
  8. rm -rf "$OUT"
  9. # nix-direnv only watches the top-level nix file for changes. As a
  10. # result, when we change a referenced SRI file, we have to cause some
  11. # change to shell.nix and flake.nix as well, so that nix-direnv
  12. # notices and reevaluates everything. Sigh.
  13. perl -pi -e "s,# nix-direnv cache busting line:.*,# nix-direnv cache busting line: $(cat go.mod.sri)," shell.nix
  14. perl -pi -e "s,# nix-direnv cache busting line:.*,# nix-direnv cache busting line: $(cat go.mod.sri)," flake.nix