flake.nix, tool/updateflakes: keep the nix vendor hash fresh automatically - #54
Merged
Conversation
…cally The flake hard-coded buildGoModule's vendorHash, and three go.mod changes later it was stale, breaking nix build for anyone using the flake. Port tailscale.com's updateflakes tool (minus its custom toolchain handling): "make tidy" runs go mod tidy and then recomputes the vendor tree's SRI hash in pure Go via tailscale.com/cmd/nardump/nardump, recording it in flakehashes.json, which flake.nix now reads with builtins.fromJSON. The JSON also records a go.mod/go.sum fingerprint so repeat runs are no-ops, and a cache busting line in flake.nix makes nix-direnv re-evaluate when the hash changes. A new tidy CI job runs "make tidy" and fails on any resulting diff, so a PR that changes dependencies without refreshing the hash can't land. No nix is required on the CI runner. Fixes #53 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Change-Id: I9f3c7b21ae584d0c6e2b58f14ad7c93b02c46d1e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The flake hard-coded buildGoModule's vendorHash, and three go.mod
changes later it was stale, breaking nix build for anyone using the
flake.
Port tailscale.com's updateflakes tool (minus its custom toolchain
handling): "make tidy" runs go mod tidy and then recomputes the vendor
tree's SRI hash in pure Go via tailscale.com/cmd/nardump/nardump,
recording it in flakehashes.json, which flake.nix now reads with
builtins.fromJSON. The JSON also records a go.mod/go.sum fingerprint
so repeat runs are no-ops, and a cache busting line in flake.nix makes
nix-direnv re-evaluate when the hash changes.
A new tidy CI job runs "make tidy" and fails on any resulting diff, so
a PR that changes dependencies without refreshing the hash can't land.
No nix is required on the CI runner.
Fixes #53