Watch
0
0
Fork
You've already forked hyperhive
0

the rendered meta flake pins each agent config by forge URL at its forge main

This commit is contained in:
atlas 2026-10-18 22:24:49 +02:00 • committed by mara
commit 09cabf8398
8 changed files with 432 additions and 163 deletions

View file

@ -115,26 +115,24 @@ until you create ruth again from the swarm dashboard.
The hive-c0re-owned repo at `/var/lib/hyperhive/meta/`
declares one flake input per agent (`agent-<n>.url =
"git+file://<applied>"`, the agent's local `applied` mirror) and one
"git+<forge>/agent-configs/<n>.git?rev=<sha>"`) and one
`nixosConfigurations.<n>` output per agent. Each output wraps
`inputs.agent-<n>.nixosModules.default` with the identity +
`HIVE_PORT` / `HIVE_LABEL` / `HIVE_DASHBOARD_PORT` injection module.
Containers run against `--flake /var/lib/hyperhive/meta#<n>`.
The declared input url is the agent's **local `applied` mirror**
(`/var/lib/hyperhive/applied/<n>`) of its forge config repo
(`agent-configs/<n>`, the one config PRs merge into). The meta flake
therefore resolves entirely from on-disk state: building, and booting,
never depend on the forge being reachable. hive-c0re fills the mirror
by fast-forwarding `applied/<n>/main` to the merged config commit,
reading the forge with the hive's read token
(`forge::reader_token()`); the forge repo is the review and audit
surface, not a flake input. The rebuild paths re-lock the input with
`--override-input agent-<n> git+file:///var/lib/hyperhive/applied/<n>`,
locking the exact config `applied/<n>/main` was fast-forwarded to.
Rebuilds fire on crash-restart and meta bumps, not just config
merges, so the lock stays on that head. `sync_agents` re-renders and
re-locks the persistent input.
The declared input url is the head of `main` on the agent's forge config repo
(`agent-configs/<n>`, the one config PRs merge into), which `sync_agents`
reads at render time. The flake text depends only on those shas and the
agent set, so any machine that can reach the forge resolves it. `sync_agents` fetches
each repo's `main` with the hive's read token (`forge::reader_token()`),
pins its head, and takes the canonical `follows` lines from the
`flake.lock` at that commit. If the forge is unreachable or a repo has no
`main`, `sync_agents` fails for that agent with its name and writes
nothing; there is no fallback to a local path. A config that sits only in
the hive's `applied/<n>` mirror, not on forge `main`, never deploys.
The rebuild paths re-lock the input with `nix flake update agent-<n>` against that
same pinned url, so `flake.nix` and `flake.lock` name no local path.
Lock updates are single-phase and commit when the lock changed:
`meta::lock_update_for_rebuild(name)` relocks one agent's input for a