Skip to content

chore(nix): run deadcode and nilaway with go run, pinned through Renovate - #1052

Merged
cpcloud merged 2 commits into
mainfrom
build-go-with-go2nix
Oct 23, 2026
Merged

cpcloud merged 2 commits into
mainfrom
build-go-with-go2nix

Conversation

@cpcloud

@cpcloud cpcloud commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • No Nix builds of deadcode and nilaway. Every Go or nixpkgs bump made Nix recompile both, often on the first nix develop. CI never used those builds. The Nix wrappers now go run a pinned version, as CI already does, so Nix builds only the wrapper scripts.
  • Why not nixpkgs or golangci-lint. nixpkgs builds both tools with Go 1.26, and that deadcode fails on Go 1.27's standard library. golangci-lint's unused linter no longer reports unused exported functions, and nilaway only runs in a custom-built golangci-lint.
  • Renovate tracks the pins. Each version sits under a # renovate: datasource=go depName=<module> comment in the wrapper script and in lint.yml, and a regex custom manager matches them. A local Renovate dry run with older pins proposed one update per tool covering both files, nilaway's pseudo-version included.
  • go2nix evaluated, not adopted. plans/go2nix.md records why micasa stays on buildGoModule. go2nix cut a one-file Nix rebuild from 30 s to 7-9 s, but it needs a Nix plugin or experimental Nix features, it can't run the same tests, and its lockfile-free mode can trust a poisoned hash cache.

🤖 Generated with Claude Code

cpcloud and others added 2 commits October 23, 2026 07:05
numtide/go2nix compiles each Go package in its own derivation, and it
cut the Nix rebuild of micasa after a one-file edit from 30 s to under
10 s. We evaluated it as a replacement for buildGoModule and decided
not to adopt it yet. This plan records why, so the question is not
re-opened without new facts.

go2nix needs either a Nix plugin built for the exact evaluating Nix
release or three experimental Nix features. Stock Nix in CI and on
user machines has neither, so packages.micasa would stop evaluating
for everyone else. Its test runner also tests every local package that
cmd/micasa reaches, with no way to narrow it, and several of those
tests fail under it. Its lockfile-free mode can trust a poisoned hash
cache, so the safe mode needs a regenerated lockfile on every go.mod
change, which is the same chore vendorHash is today.

deadcode and nilaway are pinned third-party tools, so per-package
rebuilds give them nothing. The plan lists what an opt-in go2nix
output would need and the upstream changes that would justify another
look.

Generated with Claude Code (claude-opus-5-5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every Go or nixpkgs bump made Nix rebuild deadcode and nilaway, often
on the first `nix develop` afterwards. CI never used those builds: its
lint jobs already run the tools with `go install` and `go run`. The Nix
wrappers now run the tools with `go run` too, so Go compiles them once
into its own build cache and only a wrapper script comes from Nix.

The tools from nixpkgs can't be used instead. These tools read code
with the Go version that built them, nixpkgs builds them with Go 1.26,
and that deadcode cannot read Go 1.27's standard library. nixpkgs'
nilaway is also too old for the flags we pass. golangci-lint can't take
over either: its `unused` linter no longer reports unused exported
functions, and nilaway only loads into a custom-built binary.

Nothing tracked these pins before, so they were bumped by hand. Each
pin now sits under a `# renovate:` comment in the wrapper script and in
lint.yml, and a regex custom manager matches those comments. Renovate
then opens one PR per tool that updates both places, nilaway's
pseudo-versions included.

Generated with Claude Code (claude-opus-5-5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cpcloud cpcloud added chore Maintenance and housekeeping nix Nix packaging and build labels Oct 23, 2026
@cpcloud
cpcloud merged commit 2eeebd5 into main Oct 23, 2026
28 checks passed
@cpcloud
cpcloud deleted the build-go-with-go2nix branch October 23, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance and housekeeping nix Nix packaging and build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant