deploy: move the matrix homeserver toggle out of swarm
swarm.matrix.enable was the last toggle still spelled swarm.*, which is the namespace every host in the swarm agrees on - and "does this host run the homeserver" is exactly what differs between them. It moves to deploy.matrix.enable with the rest; the genuinely swarm-wide matrix settings stay where they are. mkRenamedOptionModule keeps existing configs evaluating with one warning naming both paths. The sweep for readers had to be unanchored and cross-language: three of them were outside nix, including a hive-c0re error message telling the operator to set the old name. A dotted grep also cannot see the rename module's own list form, so that was checked separately.
This commit is contained in:
parent
1e4399d49e
commit
2aa924d85a
8 changed files with 40 additions and 34 deletions
|
|
@ -164,6 +164,13 @@ in
|
|||
[ "services" "hyperhive" "matrix" ]
|
||||
[ "services" "hyperhive" "swarm" "matrix" ]
|
||||
)
|
||||
# "does THIS host run it" is a per-host decision, and `swarm.*` is the
|
||||
# namespace every host in the swarm agrees on. The rest of the matrix
|
||||
# settings genuinely are swarm-wide and stay where they are.
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "services" "hyperhive" "swarm" "matrix" "enable" ]
|
||||
[ "services" "hyperhive" "deploy" "matrix" "enable" ]
|
||||
)
|
||||
(lib.mkRemovedOptionModule [ "services" "hyperhive" "swarm" "matrix" "sso" "enable" ] ''
|
||||
SSO is no longer optional: a homeserver that runs at all delegates
|
||||
login to the swarm's authelia.
|
||||
|
|
@ -177,21 +184,6 @@ in
|
|||
];
|
||||
|
||||
options.services.hyperhive.swarm.matrix = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
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 `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.
|
||||
'';
|
||||
};
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.matrix-tuwunel;
|
||||
|
|
@ -254,9 +246,9 @@ in
|
|||
|
||||
apiUrl = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = if cfg.enable then "http://127.0.0.1:${toString cfg.httpPort}" else null;
|
||||
default = if deployCfg.matrix.enable then "http://127.0.0.1:${toString cfg.httpPort}" else null;
|
||||
defaultText = lib.literalExpression ''
|
||||
if services.hyperhive.swarm.matrix.enable
|
||||
if services.hyperhive.deploy.matrix.enable
|
||||
then "http://127.0.0.1:''${toString services.hyperhive.swarm.matrix.httpPort}"
|
||||
else null
|
||||
'';
|
||||
|
|
@ -411,8 +403,8 @@ in
|
|||
gui = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = cfg.enable;
|
||||
defaultText = lib.literalExpression "config.services.hyperhive.swarm.matrix.enable";
|
||||
default = deployCfg.matrix.enable;
|
||||
defaultText = lib.literalExpression "config.services.hyperhive.deploy.matrix.enable";
|
||||
description = ''
|
||||
Serve a matrix web client at `matrix.''${services.hyperhive.domain}/`.
|
||||
Requires `matrix.gatewayHost != null` (default `matrix.<hive>`
|
||||
|
|
@ -498,7 +490,7 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = lib.mkIf deployCfg.matrix.enable {
|
||||
# Matrix's own gateway surface: the sub-domain vhost, the name the
|
||||
# hive resolver answers for, and the Accept-header map that vhost's
|
||||
# SPA fallback reads. All three are matrix knowledge and none of
|
||||
|
|
|
|||
Loading…
Reference in a new issue