deploy: give every option an enable, and name the controller one

Two corrections from review, applied forward on this branch rather than
by rewriting it.

`deploy.<service>` was a bare bool, which makes
`deploy.forgejo = { enable; ci; }` unrepresentable -- the nested
CI-runner sub-option this namespace was designed around. Every entry is
now an attrset with an `enable`, so a second per-host deployment
decision becomes an ordinary addition rather than a migration.

`deploy.controller` is now `deploy.swarm-controller`, consistent with
`deploy.swarm-ui`, which was introduced in the same commit.

89 references rewritten across 24 files -- nix, Rust, docs, and the
repo's own CLAUDE.md.

The prefix-anchored sweep missed exactly one, and it was live code:
hive-tls.nix spells it `hyperhiveCfg.deploy.controller` -- the only
`hyperhiveCfg` prefix among 45 references. A suffix grep
(`\.deploy\.<name>`) finds it; a path-anchored one cannot, because the
head of a reference is whatever alias the reading file happens to bind.
This commit is contained in:
atlas 2026-08-30 04:05:28 +02:00 committed by mara
commit d3b40da1c8
24 changed files with 137 additions and 121 deletions

View file

@ -15,10 +15,14 @@
# thing that must differ.
#
# Flat and named for the thing deployed — `deploy.forgejo`, not
# `deploy.swarmServices.forgejo`. Grouping by "swarm service" would
# re-encode the service-side taxonomy into a layer that does not care
# about it: from here, a host deploys forgejo, or a hive, or the lot, and
# what *kind* of thing each one is belongs to the service module.
# `deploy.swarmServices.forgejo`: grouping by "swarm service" re-encodes
# the service-side taxonomy into a layer that does not care about it.
#
# ⚠️ Each entry is an attrset with an `enable`, not a bare bool, so a
# service that grows a second *deployment* decision has somewhere to put
# it — `deploy.forgejo = { enable; ci; }` is then an ordinary addition
# rather than a migration. `ci` ("does this host run the runner too") is
# exactly that shape, and a bare bool leaves it unrepresentable.
#
# ⚠️ The renames below are deliberately in this one file rather than
# spread across the service modules, so the whole move has a single home
@ -35,40 +39,40 @@ in
# paths. Precedent: ./hive-forge/default.nix, ./hive-matrix.nix.
(lib.mkRenamedOptionModule
[ "services" "hyperhive" "swarm" "grafana" "enable" ]
[ "services" "hyperhive" "deploy" "grafana" ]
[ "services" "hyperhive" "deploy" "grafana" "enable" ]
)
(lib.mkRenamedOptionModule
[ "services" "hyperhive" "swarm" "victoriametrics" "enable" ]
[ "services" "hyperhive" "deploy" "victoriametrics" ]
[ "services" "hyperhive" "deploy" "victoriametrics" "enable" ]
)
(lib.mkRenamedOptionModule
[ "services" "hyperhive" "swarm" "victorialogs" "enable" ]
[ "services" "hyperhive" "deploy" "victorialogs" ]
[ "services" "hyperhive" "deploy" "victorialogs" "enable" ]
)
(lib.mkRenamedOptionModule
[ "services" "hyperhive" "swarm" "controller" "enable" ]
[ "services" "hyperhive" "deploy" "controller" ]
[ "services" "hyperhive" "deploy" "swarm-controller" "enable" ]
)
(lib.mkRenamedOptionModule
[ "services" "hyperhive" "swarm" "ui" "enable" ]
[ "services" "hyperhive" "deploy" "swarm-ui" ]
[ "services" "hyperhive" "deploy" "swarm-ui" "enable" ]
)
(lib.mkRenamedOptionModule
[ "services" "hyperhive" "swarm" "authelia" "enable" ]
[ "services" "hyperhive" "deploy" "authelia" ]
[ "services" "hyperhive" "deploy" "authelia" "enable" ]
)
(lib.mkRenamedOptionModule
[ "services" "hyperhive" "swarm" "nats" "enable" ]
[ "services" "hyperhive" "deploy" "nats" ]
[ "services" "hyperhive" "deploy" "nats" "enable" ]
)
(lib.mkRenamedOptionModule
[ "services" "hyperhive" "swarm" "otel" "enable" ]
[ "services" "hyperhive" "deploy" "otel" ]
[ "services" "hyperhive" "deploy" "otel" "enable" ]
)
];
options.services.hyperhive.deploy = {
grafana = lib.mkOption {
grafana.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
@ -81,7 +85,7 @@ in
'';
};
victoriametrics = lib.mkOption {
victoriametrics.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
@ -89,14 +93,14 @@ in
Derives from
{option}`services.hyperhive.swarm.enableRequiredServices` together
with {option}`services.hyperhive.deploy.grafana`: a store with no
UI is unreadable and a UI with no store is empty, so there is no
sensible deployment that takes one and not the other from that
switch. Set either directly to run exactly one.
with {option}`services.hyperhive.deploy.grafana.enable`: a store
with no UI is unreadable and a UI with no store is empty, so there
is no sensible deployment that takes one and not the other from
that switch. Set either directly to run exactly one.
'';
};
victorialogs = lib.mkOption {
victorialogs.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
@ -109,7 +113,7 @@ in
'';
};
authelia = lib.mkOption {
authelia.enable = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
@ -127,7 +131,7 @@ in
'';
};
otel = lib.mkOption {
otel.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
@ -147,7 +151,7 @@ in
'';
};
nats = lib.mkOption {
nats.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
@ -160,7 +164,7 @@ in
'';
};
controller = lib.mkOption {
swarm-controller.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
@ -173,15 +177,16 @@ in
'';
};
swarm-ui = lib.mkOption {
swarm-ui.enable = lib.mkOption {
type = lib.types.bool;
default = deployCfg.controller;
defaultText = lib.literalExpression "services.hyperhive.deploy.controller";
default = deployCfg.swarm-controller.enable;
defaultText = lib.literalExpression "services.hyperhive.deploy.swarm-controller.enable";
example = true;
description = ''
Serve the swarm UI from this host.
Derived from {option}`services.hyperhive.deploy.controller` rather
Derived from
{option}`services.hyperhive.deploy.swarm-controller.enable` rather
than from
{option}`services.hyperhive.swarm.enableRequiredServices`: the UI
is a view onto the controller's state and reaches it over that