diff --git a/docs/1-getting-started/nixos.md b/docs/1-getting-started/nixos.md index 8a06fa01b..851d5ab0f 100644 --- a/docs/1-getting-started/nixos.md +++ b/docs/1-getting-started/nixos.md @@ -51,7 +51,7 @@ guessed value here is a wrong hostname that evaluates cleanly and deploys. | option | what it does | without it | | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | -| `deploy.hive-controller.enable` | Runs a hive on this host: `hive-c0re`, which owns every agent container, plus the bridge and gateway for the agents. | No agents can run here. Leave it off on a host that only runs shared swarm services. | +| `deploy.hive-controller.enable` | Runs a hive on this host: `hive-c0re`, which owns every agent container, plus the bridge, the gateway and `boot.enableContainers` for the agents. | No agents can run here. Leave it off on a host that only runs shared swarm services. | | `swarm.domain` | The swarm's DNS domain. Each hive lives in a sub-domain of it. Use the same value on every host of the swarm. | Eval fails on any host that runs a hyperhive service. | | `deploy.hive-controller.hiveName` | This hive's label inside the swarm, and the first part of its address, `.`. It's also the hive's identity in the secret store. | Eval fails on a host that runs a hive. | | `swarm.hives` | The directory of every hive in the swarm, this one included. Entries need no fields: each `domain` defaults to `.`. Every host of the swarm shares one identical copy. | Eval fails, naming the missing entry for `hiveName`. | diff --git a/nix/host-modules/hive-c0re/default.nix b/nix/host-modules/hive-c0re/default.nix index 61ba6ac2e..5b6a0e466 100644 --- a/nix/host-modules/hive-c0re/default.nix +++ b/nix/host-modules/hive-c0re/default.nix @@ -132,6 +132,11 @@ in services.hyperhive.gateway.dns.enable = lib.mkDefault true; services.hyperhive.network.enable = lib.mkDefault true; + # nixpkgs defaults this to `config.containers != { }`; with no declarative + # container the `container@.service` template is missing and every + # `nixos-container start` fails with "Unit container@.service not found". + boot.enableContainers = true; + assertions = [ { # The pinned claude reaches agents as a bare path, so this diff --git a/nix/module-eval/core-toggle.nix b/nix/module-eval/core-toggle.nix index 0faef703f..3165a68f7 100644 --- a/nix/module-eval/core-toggle.nix +++ b/nix/module-eval/core-toggle.nix @@ -1579,6 +1579,16 @@ let && bare.services.dnsmasq.enable && bare.networking.bridges ? hive-br0; } + { + # `bare` declares no container, so nixpkgs' own default for the option + # is false there; `centralToggleOff` is the absence arm. + name = "a hive with no declarative container still gets the container@ template its agents start from"; + ok = + bare.containers == { } + && bare.boot.enableContainers + && bare.systemd.services ? "container@" + && !centralToggleOff.boot.enableContainers; + } { # The bridge→loopback drop is a unit of its own that loads its own nft # table, so it does not depend on which firewall backend the host runs.