Make hunk and lazydiff available outside the Mac - #89
Draft
alycda wants to merge 2 commits into
Draft
Conversation
hunk was declared as a Homebrew formula in darwin/modules/homebrew.nix, which means nix-darwin only installs it on macOS — so it has never existed in any of the Linux containers, where reviewing agent-authored diffs is exactly what I'm doing most of the time. There was no reason for it to be a brew: nixpkgs carries hunk at 0.17.7, the same version the formula ships, and its meta.platforms covers aarch64-linux and aarch64-darwin among others. Moving it to lib/core-packages.nix puts it in both the devShells and every home-manager profile, so the Mac keeps it and the containers gain it. This also removes a Homebrew dependency rather than adding one, which is the direction this repo has been moving anyway — brews are for things genuinely unavailable to Nix (locked taps, GUI casks), not for packages sitting in nixpkgs. Verified: builds and runs on aarch64-linux (`hunk --version` -> 0.17.7), and it now appears in both alyssa@dev and alyssa@work-dev. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
lazydiff lived only in profiles/work.nix, as an activation script that piped upstream's install script into sh. Two consequences: it existed on the work Mac and nowhere else, and it wasn't reproducible — a curl into sh at activation time, pinned by version string only. Moving it to common.nix as-is would have been worse than useless. The installer's platform case block knows exactly three targets — linux-x86_64, macos-arm64, windows-x86_64 — so on aarch64 Linux it falls through to `error "unsupported OS/Arch: linux/arm64"; exit 1`. Combined with the old guard's `|| exit 1`, that turns into a hard home-manager activation failure: the arm64 container would have stopped switching. And per the base-image-collision lesson already in CLAUDE.md, a green `nix build` would not have caught it, because activation only runs on the target machine. The fix is that the binary was there all along — the release publishes lazydiff-linux-aarch64.tar.gz plus a musl variant, and the install script is simply stale relative to its own assets. So fetch the asset directly: - stdenvNoCC + fetchurl with per-system pinned sha256s, taken from the .sha256 files published alongside each tarball - Linux uses the static musl builds, so there's no interpreter or RPATH to patch; dontPatchELF/dontStrip leave them exactly as shipped - sourceRoot = "." because the tarball is a bare binary with no wrapping directory for the default detection to descend into - an unsupported system throws a named error at eval instead of failing obscurely mid-activation work.nix loses the sessionPath and the activation block entirely; the module is imported from common.nix, so all profiles get it, Mac included. The comment about revisiting this "with a real Nix derivation once it stabilizes" is what this commit does. It's still alpha, so expect to re-pin — the version and four hashes are the only things to touch. Verified: derivation builds on aarch64-linux and the binary runs; statix/deadnix clean; `nix flake check --all-systems` passes; lazydiff resolves in both alyssa@dev and alyssa@work-dev. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
⊕ Entity-level changesdarwin/modules/homebrew.nix
home-manager/modules/common.nix
home-manager/modules/tools/lazydiff.nix
home-manager/profiles/work.nix
lib/core-packages.nix
Summary: 10 added, 4 modified across 5 files (5 added orphans, 1 modified orphan) functions and classes, not lines · sem |
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.
Both
hunkandlazydiffwere installed through macOS-only paths, soneither has ever existed in the Linux containers — which is where I do
most of the diff reviewing they're for.
Two independent fixes, one commit each.
hunk: Homebrew → nixpkgsIt was a brew in
darwin/modules/homebrew.nix, and nix-darwin's Homebrewmodule only runs on Darwin. But nixpkgs carries
hunkat 0.17.7 — thesame version the formula ships — with
aarch64-linuxandaarch64-darwinboth in
meta.platforms. Moved tolib/core-packages.nix, so the Mac keepsit and the containers gain it. Net effect is one fewer Homebrew dependency.
lazydiff: install script → real derivationIt lived only in
profiles/work.nixas an activation script pipingupstream's installer into
sh.Moving that to
common.nixunchanged would have broken the arm64container: the installer's platform case block knows only
linux-x86_64,macos-arm64andwindows-x86_64, so on aarch64 Linux ithits
error "unsupported OS/Arch: linux/arm64"; exit 1, and the old|| exit 1guard promotes that to a hard activation failure. Same shape asthe base-image collision lesson in CLAUDE.md —
nix buildstays greenbecause activation only runs on the target machine.
The binary was there all along: the release publishes
lazydiff-linux-aarch64.tar.gzand a musl variant. The install script isjust stale relative to its own assets. So
modules/tools/lazydiff.nixfetches the asset directly:
stdenvNoCC+fetchurl, per-system sha256s taken from the.sha256files published next to each tarball
so
dontPatchELF/dontStripleave them as shippedsourceRoot = ".", since the tarball is a bare binary with no wrapping dirobscurely mid-activation
work.nixdrops itssessionPathandactivationblock; the module isimported from
common.nixso every profile gets it.Still alpha, so expect to re-pin — the version string and four hashes are
the only things to touch.
Verification
nix flake check --all-systemspasses(
hunk --version→0.17.7; lazydiff runs)alyssa@devandalyssa@work-devOne quirk recorded in a code comment:
lazydiff --versionself-reports0.1.0-alpha.16from thealpha.17tag — upstream didn't bump theinternal string. The pin is correct; don't chase the printed number.
Not yet activated anywhere — no
home-manager switchrun, per usual.🤖 Generated with Claude Code