Deployment and updates
The fleet is deployed with colmena 🡕: a single command builds and applies the configuration on one or more hosts, remotely, from the admin workstation.
Apply a configuration
Section titled “Apply a configuration”just apply <target> [action] # alias : a- target = hostname, pattern (
'*'), list (a,b) or colmena tag (@server). - action =
switch(default),boot,testorbuild.
| Command | Purpose |
|---|---|
just apply <target> | Build + activate on the target(s) |
just apply-local | Apply on the current machine (alias al) |
just apply-verbose <target> | Same as apply in trace mode (alias av) |
Deploy safely
Section titled “Deploy safely”Build confidence through action: each step is less risky than the next.
just apply <host> build # downloads + compiles: 100% safe, nothing is activatedjust apply <host> test # activates without switching: no generation, no bootjust apply <host> # switch: activates and creates a new generationProgress from core to edge: deploy nodes in this order, to never cut off access to a node by the one preceding it.
Updating
Section titled “Updating”The system is locked down by flakes. Updating = refreshing the inputs, then redeploying.
just update-flake # met à jour dnf/ + racine, commit les locksjust apply '*' # déploie la mise à jourUpdating the fleet with fleet-update
Section titled “Updating the fleet with fleet-update”fleet-update chains the entire update into a single command : flakes,
building all hosts, publishing the locks across the fleet, testing in waves
(hosts the network depends on first), then final activation of the approved
hosts.

Launch
Section titled “Launch”just fleet-update [options]The recipe picks the tool to run, in this order :
| Situation | Tool run |
|---|---|
Co-development (src/dnf-fleet-update/ present) | The sources, with bun |
Active darkone.admin.fleet-update module | The installed fleet-update command |
| Any other case | nix run .#fleet-update, per the project’s flake.lock |
How a rollout unfolds
Section titled “How a rollout unfolds”- Update:
nix flake updatefor the project, then fordnf/(co-development),just clean, one commit per repository. - Selection: hosts, profiles and zones read from
var/generated/, filtered by--on; the current zone deduced from the local IP; one builder elected per host. - Build: all selected hosts, reachable or not, each on its own builder. Presence probed through the deployment SSH connection, which also joins a roaming host.
- Publication: the closure of each reachable host is brought into its store, outside waves, before any activation.
- Test:
switch-to-configuration test, one wave per profile; the next wave starts once all its hosts are OK or set aside. - Switch: all hosts validated in test, in a single go, out of wave order.
Three options shorten this sequence :
| Option | Effect |
|---|---|
--build-only | Stops after the build; in interactive mode, offers to continue |
--skip-test | No test: the switch happens wave by wave, right after the build |
--skip-switch | No switch: the rollout stops at whatever the test left in place |
Distributed builds
Section titled “Distributed builds”The deployment machine must not be the fleet’s bottleneck. Each host is
therefore built by the elected builder for it. The election is recalculated on
every run from var/generated/, never declared : changing the
deployment topology must not rebuild the fleet.
| Order | Selected builder | Condition |
|---|---|---|
| 1 | The host itself | auto-build feature |
| 2 | Its zone’s harmonia host | The zone has one |
| 3 | The global harmonia host | One exists in the fleet |
| 4 | The deployment machine | Default |
A roaming host (roaming) is located at launch :
the tool asks it which harmonia answers to the neutral name harmonia.dnf.internal.
- Connected to a zone : that zone’s
harmonia, declared or not. - Outside any zone : the deployment machine, or itself if it is also
auto-build. - Unreachable : the deployment machine.
The rule comes down to one sentence : a builder must be able to serve what it
builds. Hence the choice of harmonia hosts, whose /nix/store is already the
cache for their zone, with nothing to bootstrap. A gateway without harmonia is
not suitable : its paths are in no substituter.
features: ["auto-build"]The --no-distributed-build option brings everything back to the center,
whatever the election. It is a debugging escape hatch : the rule comes from
the fleet, the exception from the command line.
Wave order and critical hosts
Section titled “Wave order and critical hosts”The fleet’s default values are declared in config.yaml :
network: fleetUpdate: deploymentOrder: "hcs:gateway:server:[others]:laptop" criticalProfiles: "hcs:gateway:server"| Key | Role |
|---|---|
deploymentOrder | One test wave per host profile, in that order |
criticalProfiles | Profiles whose failures also go to the incident room |
Profiles separated by :, [others] designates the unlisted profiles. Optional block : without it, the tool applies the values above. The --deployment-order and --critical-profiles options take precedence over config.yaml.
Delays and monitoring
Section titled “Delays and monitoring”Two other optional blocks in config.yaml control the durations:
network: fleetUpdate: pingInterval: 15 timeouts: build: 10800| Key | Role | Default |
|---|---|---|
pingInterval | Seconds between two presence checks | 15 |
timeouts.<clé> | Maximum duration of an operation, in seconds | depends on the operation |
Keys in timeouts, in order of execution:
timeouts.<clé> | Default (s) |
|---|---|
flakeUpdate | 300 |
clean | 60 |
commit | 60 |
eval | 1200 |
build | 10800 |
publish | 3600 |
copy | 3600 |
activation | 300 |
ssh | 30 |
ping | 5 |
matrix | 30 |
killGrace | 10 |
Errors, diagnostics and repair
Section titled “Errors, diagnostics and repair”A common error should be readable without knowing Nix. The tool keeps a signature table: a recognized pattern in a command’s output gives a plain-language message and the action to take.
| Recognized pattern | What it means | Action |
|---|---|---|
mismatch in field 'narHash' | nix-eval-jobs isn’t bound to the same Nix as the system | Stop |
lacks a signature by a trusted key | The deployment account isn’t a trusted user on this host | Stop |
The message is shown as the run progresses (hint:), once only, and is also
found in the report’s Known errors section. It is added to the host’s reason,
it never replaces it: the full trace stays in logs/.
| Table action | What the tool does |
|---|---|
| Retry | Replays the command, at most three times, if it is replayable: evaluation, build, derivation copy, pull |
| Exclude | Continues without the host; if already activated, first brings it back to its origin |
| Stop | Stops the run, without asking any question |
No signature calls for a retry today: the two known entries are stops.
Deterministic collection. A host that fails while remaining reachable is
interrogated before any decision: systemctl status, list of failing units, then
each one’s log since the start of its wave.
| What is collected | Where it goes |
|---|---|
| Full output of commands and logs | logs/<hôte>.diag in the run folder |
| Failing units, error extract | Report’s Diagnostics section, incident message |
Unit restart. An activation that ends with failing units leaves the host in
error state. The tool then attempts a simple repair.
- Ten-second wait: a unit that is slow to start isn’t a failing unit.
systemctl restartof all the failing units, in a single command.- Re-reading the failing-unit list: it is what concludes, not the exit code.
Everything comes back up → the host resumes its course, rejoins the switch with
the others, and the report notes a probable activation-order issue
(Notes section). A unit resists → the host stays in error, its name and the
unit’s are in the report.
AI analysis
Section titled “AI analysis”AI explains a failure: it reads the run state, logs, and if needed the code, then produces a plain-language analysis. With --ai-error-action repair it can then act: on failed units, or on the code (see Repairing a service). An analysis that fails, times out, or exceeds its budget leaves the host exactly where it was.
Two options control it, both set to none by default: nothing is sent to an AI until you ask for it. A third chooses the tool.
| Option | Default | Role |
|---|---|---|
--ai-analysis none|passive|active | none | Analysis depth, and end-of-run summary added to the report |
--ai-error-action none|analysis|repair | none | What the AI does when a host fails |
--ai-model <tool>[:<model>][@<effort>] | claude:opus@high | Tool and model, for example opencode:ollama/qwen3:32b |
--ai-context <text> | none | Instruction or context added to all AI prompts |
--ai-commit-message | disabled | Subjects of update commits written by the AI |
just fleet-update --ai-analysis passive # enriched report, nothing morejust fleet-update --ai-error-action analysis # each failure is explainedFor example, --ai-context "Reply in French and stay concise." guides the style of responses. To avoid repeating it on every run, set it once for the host with the aiContext module option: it writes it to /etc/fleet-update/ai-context, which every run reads, both just fleet-update and the timer. The --ai-context option takes precedence over this file. On resume, the context from the initial run is reused; an explicit --ai-context replaces it.
# usr/machines/<host>/configuration.nixdarkone.admin.fleet-update.aiContext = "Reply in French and stay concise.";--ai-commit-message makes the AI summarize each update commit: local commits since the previous run, changed flake inputs, and dnf/ commits brought into the project. No valid response → usual message.
The default model for the fleet is set in config.yaml; the option takes precedence:
network: fleetUpdate: aiModel: "claude:opus@high"AI tools are not a dependency of the tool. claude and opencode are looked for in PATH; the module’s aiPackages option adds them there for the daily run. If they are missing or refused → a warning during the run, a note in the report, and the rest proceeds without AI.
What the AI is allowed to do
Section titled “What the AI is allowed to do”The AI has no free shell or SSH. It acts only through the tools of fleet-update, and the requested level fixes the list presented to it: what it does not see there, it cannot ask for.
| Level | Tools presented |
|---|---|
passive | Launch state, host diagnostic, build and activation logs, grouped launch warnings |
active, analysis | + reading, searching and listing the code (project and dnf/), host units and logs (user units included), read-only |
repair | + an action on a host’s failed units, and editing the code that describes them |
The level used is the highest of the two options: --ai-analysis passive --ai-error-action analysis gives active. The built-in tools of claude and opencode are disabled, and the instructions these tools would pick up in the project (CLAUDE.md, user settings) are neutralized: the AI sees only what it is shown.
| Safeguard | Effect |
|---|---|
| Read path | Confined to the project and to dnf/, after resolving links; usr/secrets/ and .trash/ refused |
| Host, unit | Checked against the launch table before any command |
| Excerpts | 200 log lines, 400 source lines, truncated at the end: the error is at the bottom |
| Timeout, budget | 300 seconds per analysis, two hours per repair session; 4 dollars per session for claude |
Every tool call leaves a trace — a line in the launch stream (AI reads usr/modules/nginx.nix) and a line in logs/ai.log of the launch folder. A call refused by a safeguard is traced too, with its reason.
When it intervenes
Section titled “When it intervenes”- A host fails, with
--ai-error-action≠none: after the deterministic collection and the restart of units, before the question that decides its fate. The host showsAI analysisin magenta during this time, then returns to its state. - A build fails, with
--ai-error-action≠none: at the end of the build, one analysis per group of hosts broken by the same error, before the decision (see Repair a build). - A host recovers after a unit restart, with
--ai-analysis≠none: the analysis explains the activation order, without touching the host state. - End of launch, with
--ai-analysis≠none: a synthesis of the whole, written before the report that carries it. - End of launch, with
--ai-analysis active: a review of the warnings, which files improvement suggestions. - Press
a, at any time: a free question. It gets an answer even under--ai-analysis none— without any tool:noneremoves the tools and automatic analysis, not the conversation.
Repairing a service
Section titled “Repairing a service”--ai-error-action repair opens a second session on the host, right after
the analysis and in the AI repair state. The first of its tools acts on
services: systemctl start, stop, restart or reset-failed on the
units the run saw fail. This is the gesture to prefer: it
is local and reversible. When it is not enough, the AI fixes the code
(Repairing through code).
just fleet-update --ai-error-action repair- The grouped deterministic restart failed: the host stays in
error. - The AI analyses, in the
AI analysisstate, read-only. - The AI repairs, in the
AI repairstate: it acts, then re-reads the failed units. - Nothing failing anymore → the host resumes its course and joins the switch. Otherwise → the usual question,
revert/keep/stop/rollback.
| Guard-rail | Effect |
|---|---|
| Units | Only those the collection saw failing on this host; any other is refused |
| Host | Refused if it is not currently being repaired: a read session never acts |
| Attempts | Three actions per host, refusals not counted; the fourth is refused |
| Stopping mid-run | A run that stops repairs nothing: it is a new operation |
| Confirmation | In interactive mode, a button question before each action: apply or skip |
In non-interactive mode (night timer, --no-ui), the action passes without asking.
It is strictly less risky than what the run already does without
witness: the deterministic repair restarts all the host’s
failed units.
Each action is counted, not just traced: it ends up in
state.json and in the AI repair section of the report, refusals included, with its
reason. A repaired host also carries a note in the report.
Repairing through code
Section titled “Repairing through code”When no restart can help, the AI writes the fix into the project, validates it and commits it; the host is rebuilt then redeployed, and the rest of the fleet follows the commit (Align the fleet).
edit_codereplaces an exact passage (present only once), or rewrites a whole file. The git tree must be clean before the first edit, and the diff goes intologs/ai.log.validateruns the project cleanup, then re-evaluates and rebuilds that host alone, from the working trees: an uncommitted edit ofdnf/and a created file are seen there. An edit that does not change the host is reported.commitwritesfix(<scope>): <sujet>, the scope naming what the fix touches (fix(nginx): …). In co-development,dnf/is committed first, then the project and its lock realigned.- The host goes back to
builtwith the committed path; its wave serves it once more: copy, activation, conclusion.
| Safeguard | Effect |
|---|---|
| Paths | The project, and dnf/ in co-development; never usr/secrets/, .trash/, .git/, var/generated/, etc/config.yaml nor a *.lock |
| Outside co-development | dnf/ is a store path: writing it is refused, and would have changed nothing |
| Tree | Dirty before the first edit → refused: a repair commit carries only the fix |
| Attempts | Six per host, one attempt per change: a service action, or the edits until the next validate. Validating and committing cost none |
| Validation | commit refused if the last edit is not validated: what is redeployed is what is committed |
| One commit per fix | Fixing again amends the fix commit of the fix, as long as it is at the head; never the chore(update) nor a human commit |
| One session at a time | Repairs run one after the other: a commit takes the whole tree |
| End of session | Uncommitted edit discarded, tree brought back to the last commit; the diff remains in logs/ai.log, and as a patch in logs/<hôte>.dnf.patch (or .consumer.patch) for git apply |
| Hooks | Never bypassed: the commit goes through the repository gate like any other |
| Message | dnf/ is published: a framework commit that names a fleet host is refused |
Repairing a build
Section titled “Repairing a build”A build can fail because of the code: a package’s tests, a badly written option. With --ai-error-action ≠ none, the AI handles it at the end of the build, before the usual decision; built hosts wait.
- Hosts broken by the same error form one group: one session for all.
- The AI analyzes the group, in the
AI analysisstate, read-only. - With
repair, it fixes in theAI repairstate, through the host that built the failing derivation:edit_code,validate(which rebuilds that host),commit. - Fix committed → the fleet aligns, including the hosts of the group. Nothing committed → the usual decision: exclusion or stop.
| Case | Effect |
|---|---|
Known stop, exclude error | Decides alone, without AI |
| Failure outside the code (killed builder, network) | Usual decision, without AI |
| Fleet evaluation fails | Nothing to attribute, no session |
| All hosts broken | Repair attempted before the no host built stop |
--build-only | Repairs too |
Aligning the fleet
Section titled “Aligning the fleet”Everything the launch publishes and activates comes from a single revision, the last commit. A fix may require several hosts to move together (a server and its clients): each repair commit realigns the fleet.
- All hosts still in the launch are re-evaluated at the last commit, in a single evaluation.
- Only those whose path changes are rebuilt; the others do not move.
- Host not yet served by the step → its wave serves it, new path included. Host already served → served again in a final pass of the step, same phase.
A host that the alignment breaks goes to the decision, never to a new repair. A host can also remain behind:
| Case | The host |
|---|---|
| Rebuild fails, in waves | Keeps its generation and its path |
| Unreachable at the final pass | Returns to its previous state and path |
| Commit during the final pass | No more alignment after it |
The fleet then runs on two revisions: the report and the incident room say so, with the hosts concerned (see Report and Matrix alerts). --resume reuses the aligned paths; cut before the alignment, it rebuilds everything.
Improvement suggestions
Section titled “Improvement suggestions”With --ai-analysis active, the launch ends with a review of its warnings, and of what the repairs left to a human: renamed or deprecated option, a change that would silence a warning, a problem to investigate, a limit of the repair tool. The AI proposes, it changes neither the code nor the fleet.
- The warnings from all launch logs are grouped by shape: the same one on ten hosts counts once. No warning or repair → no review, nothing is paid.
- The AI reads the suggestions already filed and the conclusions of the repairs, then searches the code for where each warning comes from.
- Each useful finding becomes a file
var/deployments/suggestions/<slug>.md: what, where (fichier:ligne), why, and the proposed improvement. - The Suggestions section of the report lists what the launch filed or reviewed. Nothing is sent to Matrix: this is not an alert.
The files survive across launches. A finding that comes back does not rewrite its file: only the Last seen and Runs lines of the header move.
# Replace a deprecated nginx option
- Status: open- First seen: 20260101T020000Z-full- Last seen: 20260108T020000Z-full- Runs: 4
The option is deprecated upstream: `usr/modules/web.nix:12`, …| To | Do |
|---|---|
| Silence a suggestion | Write Status: ignored in its header: it stays tracked, out of the report |
| Forget it | Delete the file: a finding that comes back starts from scratch |
| Apply it | Fix the code, then delete the file |
Scope follows the mode: in co-development, the project and dnf/; otherwise, the project alone (a finding that only the framework fixes is not filed).
Report and Matrix alerts
Section titled “Report and Matrix alerts”Each launch writes its folder in var/deployments/<date>-<mode>/: report.md (the report), state.json (the state that --resume resumes), events.jsonl and the per-host logs. The path is displayed at the end of the launch.
The report details what the launch actually did:
| Section | What it gives |
|---|---|
| Steps, Waves | Duration of each step, composition and duration of each wave |
| Builders | Who built what, fallbacks included |
| Copies | Per host: paths pulled and by which substituter, paths pushed, volume |
| Zones without a cache | Launch zones that no harmonia serves |
| Hosts not deployed | Hosts left aside, and the reason |
| Diagnostics | Per failing host: failed units, then error excerpt |
| Notes | What the launch found: probable activation order after a unit restart |
| AI analysis | AI analysis: one entry per analyzed host, then the launch synthesis |
| AI repair | AI actions: host, action, outcome, and the reason for a refusal |
| Suggestions | Improvement suggestions filed or reviewed by the launch, excluding ignored ones |
| Known errors | Traps recognized by the signature table, in plain language |
The header lists the launch commits, an amended fix counted (amended 2×). After a repair commit, it says whether the fleet is aligned:
| Fleet | Header line |
|---|---|
| Aligned | Repaired by commit: <hôte>, fleet aligned on it |
| On two revisions | Repaired by commit: <hôte>, fleet on two revisions — <raisons> |
The --send-report option sends this report to the channels of the alerts bot, installed beforehand by just configure-alert-bot.
| Situation | Channel | Content |
|---|---|---|
| Launch finished | warnings | Summary: hosts by state, duration, known errors |
| Critical hosts not deployed | incidents | Separate message: hosts concerned, reasons and failed units |
| Fleet on two revisions | incidents | Hosts behind, and why |
| Stop on error | incidents | Error that stopped the launch, then summary |
A host is critical when its profile appears in criticalProfiles. After a stop, the hosts left in test complete the incident message: a restart would bring them back to their previous generation.
Only the end-of-launch synthesis joins the message, never the per-host analyses, and it is limited there to six lines: beyond that, the message points to report.md. An alert channel is not a report.
The message repeats the report header, the exit code in the title:
**Fleet Update Report** (1)
Error: srv-maison: activation failed
- Started at 2026-09-17 02:00:00 UTC, duration: 4m12s- Options: full run, selection all, test skipped, 10 in parallel- Hosts: 5 deployed (hcs, gw-maison, pc-maison, gw-atelier, lt-atelier), 1 failed (srv-maison)- Run stopped on errorDaily run
Section titled “Daily run”On the deployment host, the module installs the tool and, with timer.enable, runs fleet-update --no-ui every day :
# usr/machines/<hôte>/configuration.nixdarkone.admin.fleet-update = { enable = true; user = "admin"; aiContext = "Répondre en français et rester concis."; timer.enable = true;};| Option | Default | Role |
|---|---|---|
user | none | Project owner: git, age key, AI, Matrix |
workDir | /etc/nixos | Consumer project on disk |
aiContext | null | Context added to the AI prompts of every run on the host, written to /etc/fleet-update/ai-context, even without enable ; --ai-context overrides it |
timer.onCalendar | *-*-* 04:00 | Run time |
timer.extraArgs | [ ] | Options added to --no-ui, --send-report for example |
timer.timeout | 6h | Maximum duration of a run |
Binary cache
Section titled “Binary cache”Two services combine to avoid recompiling or re-downloading derivations on every deployment.
| Service | Role |
|---|---|
harmonia | Serves the local, signed /nix/store directly to hosts (LAN, or VPN if global). |
nix-cache | Per-zone nginx proxy that caches the public cache.nixos.org cache on the gateway. |
A harmonia host has a second role : it is the
elected builder for its zone, because it knows how to
serve what it builds.
A host queries these sources in the following priority order. The first retrieval from the Internet is thus shared across the whole zone.
| Priority | Source | Scope |
|---|---|---|
| 20 | Zone’s harmonia | LAN, what the zone has compiled |
| 35 | Zone’s nix-cache proxy | LAN, shared mirror of the public cache |
| 40 | Direct cache.nixos.org | Safety net if the gateway is down |
| 45 | global harmonia | Last resort, over the VPN |
At installation, just install hands the host’s caches to the installer
when the target address belongs to a zone’s network.
Outside a zone (public IP, router LAN) and for any gateway (its zone caches go
through it), the installer queries only cache.nixos.org : the rest comes
from the administration workstation.
Build farm
Section titled “Build farm”Fetching a package and building it are two distinct needs. The binary cache above covers the first. For the second, a powerful host of the network can take on the long compilations of an administrative host.
Declare it with the build-farm feature:
features: ["build-farm"]Each administrative host then adds it to its nix.buildMachines, joined over
SSH by the deployment account nix. Nothing else to configure: the key and the
authorization are already in place across the whole fleet.