update-flake.sh 710 B

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