refactor(nix): make all-local a deployment mode, not a default

mara: enableAllLocalDefaults is more of a deployment mode via settings
set, less a default setting.

That reframing is the change. A mode asserts values; an option declares
what it is when nobody asks. Written as default = <flag>, every service
option had to name a switch it has no relationship to, and the answer to
what does all-local turn on was spread across five files.

Two modules now hold the two tiers - local-defaults.nix for the mode and
what it asserts directly, swarm-required-services.nix for the
services-live-here switch and the per-service enables under it. Each
service module keeps its own declaration and loses only the line about
when a deployment wants it.

mkDefault is the right precedence rather than a compromise: it beats an
option default and yields to any explicit definition, so the mode fills
in for an operator who has not spoken and never argues with one who has.
Evaluated config is unchanged in both directions.
This commit is contained in:
atlas 2026-08-05 19:41:11 +02:00
commit 048bdd29a8
8 changed files with 134 additions and 79 deletions

View file

@ -99,19 +99,16 @@ in
options.services.hyperhive.swarm.matrix = {
enable = lib.mkOption {
type = lib.types.bool;
default = config.services.hyperhive.swarm.enableRequiredServices;
defaultText = lib.literalExpression "services.hyperhive.swarm.enableRequiredServices";
default = false;
description = ''
Run hive-matrix a private matrix-tuwunel homeserver (in a
nixos-container) for hyperhive agents.
Matrix is a swarm-wide service one homeserver, not one per
hive so this defaults from
`services.hyperhive.swarm.enableRequiredServices`, which says
the swarm's shared services live on this host. That is off by
default, so this is off by default, as before. Set it directly
to run the homeserver somewhere other than the host that holds
the rest of the swarm's services.
hive so `services.hyperhive.swarm.enableRequiredServices`
turns this on as part of saying the swarm's shared services live
on this host. Set it here directly to run the homeserver
somewhere other than the host that holds the rest of them.
'';
};