Skip to content

Make hunk and lazydiff available outside the Mac - #89

Draft
alycda wants to merge 2 commits into
mainfrom
hunk-lazydiff-cross-platform
Draft

Make hunk and lazydiff available outside the Mac#89
alycda wants to merge 2 commits into
mainfrom
hunk-lazydiff-cross-platform

Conversation

@alycda

@alycda alycda commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Both hunk and lazydiff were installed through macOS-only paths, so
neither 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 → nixpkgs

It was a brew in darwin/modules/homebrew.nix, and nix-darwin's Homebrew
module only runs on Darwin. But nixpkgs carries hunk at 0.17.7 — the
same version the formula ships — with aarch64-linux and aarch64-darwin
both in meta.platforms. Moved to lib/core-packages.nix, so the Mac keeps
it and the containers gain it. Net effect is one fewer Homebrew dependency.

lazydiff: install script → real derivation

It lived only in profiles/work.nix as an activation script piping
upstream's installer into sh.

Moving that to common.nix unchanged would have broken the arm64
container
: the installer's platform case block knows only
linux-x86_64, macos-arm64 and windows-x86_64, so on aarch64 Linux it
hits error "unsupported OS/Arch: linux/arm64"; exit 1, and the old
|| exit 1 guard promotes that to a hard activation failure. Same shape as
the base-image collision lesson in CLAUDE.md — nix build stays green
because activation only runs on the target machine.

The binary was there all along: the release publishes
lazydiff-linux-aarch64.tar.gz and a musl variant. The install script is
just stale relative to its own assets. So modules/tools/lazydiff.nix
fetches the asset directly:

  • stdenvNoCC + fetchurl, per-system sha256s taken from the .sha256
    files published next to each tarball
  • Linux uses the static musl builds — no interpreter or RPATH to patch,
    so dontPatchELF/dontStrip leave them as shipped
  • sourceRoot = ".", since the tarball is a bare binary with no wrapping dir
  • unsupported systems throw a named error at eval rather than failing
    obscurely mid-activation

work.nix drops its sessionPath and activation block; the module is
imported from common.nix so 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-systems passes
  • statix and deadnix clean
  • both derivations build and run on aarch64-linux
    (hunk --version0.17.7; lazydiff runs)
  • both resolve in alyssa@dev and alyssa@work-dev

One quirk recorded in a code comment: lazydiff --version self-reports
0.1.0-alpha.16 from the alpha.17 tag — upstream didn't bump the
internal string. The pin is correct; don't chase the printed number.

Not yet activated anywhere — no home-manager switch run, per usual.

🤖 Generated with Claude Code

alycda and others added 2 commits August 5, 2026 21:37
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>
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

⊕ Entity-level changes

darwin/modules/homebrew.nix

Status Type Name
Δ binding homebrew

home-manager/modules/common.nix

Status Type Name
Δ binding imports

home-manager/modules/tools/lazydiff.nix

Status Type Name
+ orphan module-level
+ binding version
+ orphan module-level
+ binding assets
+ orphan module-level
+ binding asset
+ binding lazydiff
+ orphan module-level
+ binding home.packages
+ orphan module-level

home-manager/profiles/work.nix

Status Type Name
Δ binding home

lib/core-packages.nix

Status Type Name
Δ orphan module-level

Summary: 10 added, 4 modified across 5 files (5 added orphans, 1 modified orphan)

functions and classes, not lines · sem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant