macos: /nix hydration via a Namespace macOS Application (nix snapshot package) #125

Merged
founder merged 1 commit from claude/macos-nix-snapshot into main 2026-08-17 02:00:01 +00:00
Owner

KSE-0186 D8 / founder direction 2026-08-17: macOS runners cannot put /nix on a cache volume, so hydrate it at VM start from a Namespace macOS Application (nsc macos package → nscr.io, attached by forgejo-nsc through the Compute API CreateInstanceRequest.Applications), built in the same pipeline as the custom base images.

Inert until pinned: ops/namespace/macos-nix-snapshot/pin.json ships empty, so the dispatcher YAML only gains macos_application_image: '' and the deployed dispatcher (92cd5bb0) keeps today's nsc create path byte-for-byte. Verified: nix build of services.forgejo-nsc.dispatcher.configFile from this branch, and forgejo-nsc config.Load (pinned 92cd5bb0 and the sibling branch claude/macos-application-request) both accept it.

  • Scripts/namespace-macos-nix-snapshot.sh — producer (aarch64-darwin): resolves dev-shell:apple-release (+ bashInteractive), signed zstd file:// binary cache + roots/manifest/daemon settings + entrypoint, 3.5 GiB package cap (nsc macos package tars in memory), nsc macos package --name key-store/macos-nix-snapshot, digest pin (--skip-if-unchanged, --build-only/--package-only, --dry-run).
  • ops/namespace/macos-nix-snapshot/entrypoint.sh — POSIX sh payload: markers started → nix-ready → done|failed → finished under /var/tmp/key-store-nix-snapshot, Determinate install with the bootstrap's exact invocation, nix.custom.conf daemon settings, root nix copy --from file://…/snapshot + gcroots + verify. Holds after the markers (JOB workload: the instance dies when the command exits) until SIGTERM or <state>/release; --no-hold for manual runs (tested under dash / bash 5 / /bin/sh on the forge: no-hold exit, hold + release, hold + SIGTERM, failure path).
  • Scripts/nix-snapshot-state.sh + ensure-nix.sh / hydrate-nix-binary-cache.sh — job-time readers (never a second installer, wait while pending, skip hydration when covered).
  • namespace-build-images.yml — macos-nix-snapshot job on namespace-profile-macos-large behind vars.KEYSTORE_NAMESPACE_MACOS_NIX_SNAPSHOT_ENABLED / build_macos_nix_snapshot; records the pin as repo variables + artifact.
  • Forge handoff — keyStore.deploy.namespaceMacOSNixSnapshotEnable/-Image; common.nix emits namespace.macos_application_image and, only when pinned, name/command/args + macos_application_ready_file=<state>/finished.
  • docs/infrastructure/namespace-macos-nix-snapshot.md — contract + rollout.

Rollout after merge: forgejo-nsc claude/macos-application-request (Compute API create + application) → pin bump → forge deploy → live probe of the compute create → enable the producer → land pin.json.

Workflow-orchestrated (2 implementers + 2 adversarial reviewers); reviewer fixes folded in.

🤖 Generated with Claude Code

KSE-0186 D8 / founder direction 2026-08-17: macOS runners cannot put `/nix` on a cache volume, so hydrate it at VM start from a **Namespace macOS Application** (`nsc macos package` → nscr.io, attached by forgejo-nsc through the Compute API `CreateInstanceRequest.Applications`), built in the same pipeline as the custom base images. **Inert until pinned:** `ops/namespace/macos-nix-snapshot/pin.json` ships empty, so the dispatcher YAML only gains `macos_application_image: ''` and the deployed dispatcher (92cd5bb0) keeps today's `nsc create` path byte-for-byte. Verified: `nix build` of `services.forgejo-nsc.dispatcher.configFile` from this branch, and forgejo-nsc `config.Load` (pinned 92cd5bb0 and the sibling branch `claude/macos-application-request`) both accept it. - `Scripts/namespace-macos-nix-snapshot.sh` — producer (aarch64-darwin): resolves `dev-shell:apple-release` (+ bashInteractive), signed zstd `file://` binary cache + roots/manifest/daemon settings + entrypoint, 3.5 GiB package cap (`nsc macos package` tars in memory), `nsc macos package --name key-store/macos-nix-snapshot`, digest pin (`--skip-if-unchanged`, `--build-only/--package-only`, `--dry-run`). - `ops/namespace/macos-nix-snapshot/entrypoint.sh` — POSIX sh payload: markers `started → nix-ready → done|failed → finished` under `/var/tmp/key-store-nix-snapshot`, Determinate install with the bootstrap's exact invocation, `nix.custom.conf` daemon settings, root `nix copy --from file://…/snapshot` + gcroots + verify. **Holds after the markers** (JOB workload: the instance dies when the command exits) until SIGTERM or `<state>/release`; `--no-hold` for manual runs (tested under dash / bash 5 / /bin/sh on the forge: no-hold exit, hold + release, hold + SIGTERM, failure path). - `Scripts/nix-snapshot-state.sh` + `ensure-nix.sh` / `hydrate-nix-binary-cache.sh` — job-time readers (never a second installer, wait while pending, skip hydration when covered). - `namespace-build-images.yml` — `macos-nix-snapshot` job on `namespace-profile-macos-large` behind `vars.KEYSTORE_NAMESPACE_MACOS_NIX_SNAPSHOT_ENABLED` / `build_macos_nix_snapshot`; records the pin as repo variables + artifact. - Forge handoff — `keyStore.deploy.namespaceMacOSNixSnapshotEnable/-Image`; `common.nix` emits `namespace.macos_application_image` and, only when pinned, name/command/args + `macos_application_ready_file=<state>/finished`. - `docs/infrastructure/namespace-macos-nix-snapshot.md` — contract + rollout. Rollout after merge: forgejo-nsc `claude/macos-application-request` (Compute API create + application) → pin bump → forge deploy → live probe of the compute create → enable the producer → land `pin.json`. Workflow-orchestrated (2 implementers + 2 adversarial reviewers); reviewer fixes folded in. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
macos: /nix hydration via a Namespace macOS Application (nix snapshot package)
Some checks failed
build-release.yml / macos: /nix hydration via a Namespace macOS Application (nix snapshot package) (push) Failing after 0s
build-release.yml / macos: /nix hydration via a Namespace macOS Application (nix snapshot package) (pull_request) Failing after 0s
Build: Apple / Check (SwiftLint) (pull_request) Successful in 17s
Build: KaiOS / Build (KaiOS) (pull_request) Successful in 33s
Build: Web / Build (Web) (pull_request) Successful in 33s
Build: Apple / Build (visionOS) (pull_request) Successful in 32s
Build: Apple / Build (iOS) (pull_request) Successful in 42s
Build: Apple / Build (macOS) (pull_request) Successful in 2m1s
080b625bed
macOS runners cannot put /nix on a cache volume, so every Apple job pays the
apple-release closure download from nix.key.store. This adds the founder-
requested alternative (KSE-0186 D8, ApplicationRequest): a Namespace macOS
Application built in the same pipeline as the custom base images that
hydrates /nix at VM start, cluster-locally, from a zstd snapshot.

- Scripts/namespace-macos-nix-snapshot.sh: on aarch64-darwin resolves the
  apple-release dev shell (+ bashInteractive), exports it as a signed zstd
  file:// binary cache with roots/manifest/daemon settings + the entrypoint,
  size-guards the package (nsc macos package tars in memory; 3.5 GiB default
  cap), pushes with "nsc macos package --name key-store/macos-nix-snapshot"
  and pins the digest into ops/namespace/macos-nix-snapshot/pin.json
  (--skip-if-unchanged / --build-only / --package-only / --dry-run).
- ops/namespace/macos-nix-snapshot/entrypoint.sh (POSIX sh) + optional Go
  launcher shim: markers under /var/tmp/key-store-nix-snapshot (started,
  nix-ready, done|failed, finished), Determinate install with the bootstrap's
  exact invocation, daemon settings via /etc/nix/nix.custom.conf, root
  "nix copy --from file://.../snapshot" + gcroots + verify. Namespace macOS
  Applications are JOB workloads (the instance dies when the command exits),
  so after the markers the entrypoint holds until teardown (SIGTERM or
  <state>/release); --no-hold for manual runs/tests.
- Scripts/nix-snapshot-state.sh (status|wait|covers|info) consulted by
  ensure-nix.sh (never a second installer; waits while pending) and
  hydrate-nix-binary-cache.sh (skips when the snapshot covers the closure).
- namespace-build-images.yml: macos-nix-snapshot job on
  namespace-profile-macos-large behind vars.KEYSTORE_NAMESPACE_MACOS_NIX_SNAPSHOT_ENABLED
  / build_macos_nix_snapshot input; records the pin as repo variables and an
  artifact (landing pin.json stays a reviewed PR).
- Forge handoff: keyStore.deploy.namespaceMacOSNixSnapshotEnable/-Image; the
  dispatcher YAML gets namespace.macos_application_image (empty pin = nothing
  attached, byte-for-byte today's nsc create path) and, only when pinned,
  name/command/args + macos_application_ready_file=<state>/finished for the
  forgejo-nsc Compute API create (branch claude/macos-application-request).
- docs/infrastructure/namespace-macos-nix-snapshot.md: contract + rollout.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
founder force-pushed claude/macos-nix-snapshot from 080b625bed
Some checks failed
build-release.yml / macos: /nix hydration via a Namespace macOS Application (nix snapshot package) (push) Failing after 0s
build-release.yml / macos: /nix hydration via a Namespace macOS Application (nix snapshot package) (pull_request) Failing after 0s
Build: Apple / Check (SwiftLint) (pull_request) Successful in 17s
Build: KaiOS / Build (KaiOS) (pull_request) Successful in 33s
Build: Web / Build (Web) (pull_request) Successful in 33s
Build: Apple / Build (visionOS) (pull_request) Successful in 32s
Build: Apple / Build (iOS) (pull_request) Successful in 42s
Build: Apple / Build (macOS) (pull_request) Successful in 2m1s
to ec450ad4a5
Some checks failed
build-release.yml / macos: /nix hydration via a Namespace macOS Application (nix snapshot package) (push) Failing after 0s
build-release.yml / macos: /nix hydration via a Namespace macOS Application (nix snapshot package) (pull_request) Failing after 0s
Namespace: Build Images / Refresh macOS Nix snapshot application (push) Has been skipped
Namespace: Build Images / Refresh macOS runner lane (push) Successful in 4s
Release: If Needed / Check (Release Needed) (push) Successful in 8s
Namespace: Build Images / Refresh Linux runner image (push) Successful in 46s
Deploy: Web / Deploy (Web) (push) Successful in 2m27s
Deploy: API / Deploy (API) (push) Successful in 2m45s
2026-08-17 01:59:57 +00:00
Compare
founder deleted branch claude/macos-nix-snapshot 2026-08-17 02:00:01 +00:00
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
key-store/key.store!125
No description provided.