Skip to content

herdr-core, herdr-desktop: fetch Zig deps with Nix fetchers - #2

Open
iamppborah wants to merge 4 commits into
tophcodes:init-herdrfrom
iamppborah:herdr-darwin-zig-deps
Open

iamppborah wants to merge 4 commits into
tophcodes:init-herdrfrom
iamppborah:herdr-darwin-zig-deps

Conversation

@iamppborah

@iamppborah iamppborah commented Nov 2, 2026 •

Copy link
Copy Markdown

Fixes the aarch64-darwin failure in matteo-pacini's nixpkgs-review on NixOS#581031 (sandbox = true). My earlier review there passed only because the zig-deps outputs were still in my store from an unsandboxed build; with them removed, it fails the same way here.

Cause: zig_0_16.fetchDeps runs zig build --fetch. On Darwin, Zig only loads root certificates from /System/Library/Keychains/SystemRootCertificates.keychain and /Library/Keychains/System.keychain (std/crypto/Certificate/Bundle/macos.zig), and the sandbox hides the second one, so every download fails with CertificateBundleLoadFailure. __impureHostDeps can't help: /Library/Keychains isn't in allowed-impure-host-deps.

Fix (one commit per package): use the vendored Ghostty's build.zig.zon.nix (generated by zon2nix, the same approach as pkgs/by-name/gh/ghostty/deps.nix), copied as ghostty-deps.nix, and copy the packages into vendor/ghostty/zig-pkg, where Zig 0.16 looks for them. Each package has its own copy, since herdr-core and herdr-app pin their Ghostty submodule separately; today both are identical. The file has to be copied again from vendor/ghostty/build.zig.zon.nix when the vendored Ghostty changes; no update script yet.

Tested on aarch64-darwin with sandbox = true:

  • herdr-core: deleted herdr-core, the deps set and all 39 dependencies first, built with --option substitute false. All 39 were fetched locally in the sandbox; the version check passes.
  • herdr-desktop: builds; the version check passes; Herdr.app/Contents/MacOS/Herdr is the binary, bin/herdr-app links to it.
  • Not built on Linux here; this is how ghostty builds on Linux.

herdr 0.9.5 (the TUI) has the same issue: its zig-deps fails the same way when fetched in the Darwin sandbox, but cache.nixos.org already has it, so it doesn't show.

🤖 Generated with Claude Code

tophcodes and others added 4 commits November 1, 2026 13:09
Assisted-by: Claude Code (claude-opus-5-5)
Co-authored-by: Philip Munksgaard <[email protected]>
Co-authored-by: Prasurjya Pran Borah <[email protected]>
Assisted-by: Claude Code (claude-opus-5-5)
Co-authored-by: Philip Munksgaard <[email protected]>
Co-authored-by: Prasurjya Pran Borah <[email protected]>
zig.fetchDeps runs `zig build --fetch`, and on Darwin Zig only loads
root certificates from /System/Library/Keychains/SystemRootCertificates.keychain
and /Library/Keychains/System.keychain. The sandbox hides the latter, so
the fetch fails with CertificateBundleLoadFailure.

Use the vendored Ghostty's build.zig.zon.nix (generated by zon2nix) instead,
and put the packages in vendor/ghostty/zig-pkg, where Zig 0.16 looks for
them. Copy the file again from vendor/ghostty when the vendored Ghostty
changes.
Same change as for herdr-core: Zig's own fetch cannot load root
certificates in the Darwin sandbox. Use the vendored Ghostty's
build.zig.zon.nix and put the packages in vendor/ghostty/zig-pkg. Copy
the file again from vendor/ghostty when the vendored Ghostty changes.
@tophcodes
tophcodes force-pushed the init-herdr branch 2 times, most recently from 1b4545c to cccbcd4 Compare November 2, 2026 11:52
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.

2 participants