Skip to content

feat(cachix): auto-push tower/leod builds to soft-nix cache#150

Merged
etrobert merged 9 commits into
mainfrom
cachix-push-from-tower-leod
May 30, 2026
Merged

feat(cachix): auto-push tower/leod builds to soft-nix cache#150
etrobert merged 9 commits into
mainfrom
cachix-push-from-tower-leod

Conversation

@etrobert-bot

@etrobert-bot etrobert-bot commented May 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Enables services.cachix-watch-store inside modules/nixos-workstation.nix so local builds on tower and leod automatically push freshly-built store paths to soft-nix.cachix.org. CI already does this; this extends the same behavior to interactive builds.
  • Single shared cachix-token.age encrypted for both hosts. Per-host tokens were rejected because lateral SSH between machines is unrestricted — compromising one host already gives access to the other.
  • Inlined directly into nixos-workstation rather than a separate module: applicability matches exactly (tower + leod), and one services block isn't worth its own file.
  • aaron is intentionally out of scope — Determinate Nix already owns the post-build-hook slot on darwin. See plans/cachix-push-from-aaron.md (local) for the deferred plan.

Before merging

The committed cachix-token.age is a placeholder (encrypted "replace with real token" string). It keeps CI green but won't decrypt to a usable cachix token. Steps to finish:

  1. Generate a write-scoped token at https://app.cachix.org/cache/soft-nix (Settings → Auth Tokens → "Generate New Token", Write scope).
  2. agenix -e secrets/cachix-token.age — paste the token.
  3. Commit and push.
  4. Deploy tower and leod normally; the cachix-watch-store-agent systemd service will start and begin pushing.

Test plan

  • nix flake check --all-systems --no-build passes
  • CI build of tower and leod toplevel passes (placeholder secret is valid for build; decryption only runs at activation)
  • After deploying with real token: systemctl status cachix-watch-store-agent shows running on both hosts
  • Build a small package on tower (nix build nixpkgs#hello --rebuild); confirm new path on the soft-nix dashboard
  • Same from leod

etrobert and others added 4 commits May 29, 2026 17:20
Wires the upstream services.cachix-watch-store NixOS module via a new
flake module so local builds on tower and leod push freshly-built store
paths to soft-nix.cachix.org. aaron is intentionally out of scope (see
plans/cachix-push-from-aaron.md): Determinate Nix already owns the
post-build-hook on darwin.

Per-host write tokens limit blast radius if one machine is compromised.
The committed .age files are placeholders to keep CI green; replace each
with a real cachix write token via \`agenix -e\` before deploying.
Lateral SSH between machines is unrestricted, so a per-host token does
not meaningfully reduce blast radius — compromising tower lets the
attacker read leod's secret too. Single shared token is simpler.
The previous extraction was overkill for a single attribute set, and the
applicability matches nixos-workstation exactly: tower and leod use it,
aaron uses the cross-platform workstation module, pi is not a
workstation.
Statix flagged repeated `services` keys after inlining
cachix-watch-store. Merge the three sibling assignments into one
attribute set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@etrobert etrobert force-pushed the cachix-push-from-tower-leod branch from 156a060 to 83f1950 Compare May 29, 2026 15:20
etrobert and others added 5 commits May 30, 2026 11:49
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@etrobert etrobert merged commit e61d8e4 into main May 30, 2026
5 checks passed
@etrobert etrobert deleted the cachix-push-from-tower-leod branch May 30, 2026 22:11
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