matrixAccounts url: single-source-of-truth default binding (addresses review)

This commit is contained in:
damocles 2026-06-15 21:48:51 +02:00
commit 354b270d2a

View file

@ -17,6 +17,12 @@ let
# from `userName` to keep them coupled.
userName = config.hyperhive.user.name;
homeDir = "/home/${userName}";
# Single source of truth for the default matrix homeserver URL, shared
# by the `hyperhive.matrix.url` option default and the daemon-unit guard
# that decides whether to set a unit-level HIVE_MATRIX_URL (so the two
# cannot drift). Matches the daemon's own built-in default
# (`paths::DEFAULT_HOMESERVER`).
matrixUrlDefault = "http://localhost:8008";
in
{
# Shared scaffolding for every hyperhive harness container.
@ -288,7 +294,7 @@ in
options.hyperhive.matrix.url = lib.mkOption {
type = lib.types.str;
default = "http://localhost:8008";
default = matrixUrlDefault;
example = "https://matrix.darkest.space";
description = ''
Matrix homeserver URL the agent's `hive-matrix-daemon` connects
@ -1338,7 +1344,7 @@ in
# (non-default) is set unit-level so it wins over the forwarded value;
# at the default we deliberately DON'T set it so the forwarded
# isolation-aware value isn't shadowed.
// lib.optionalAttrs (config.hyperhive.matrix.url != "http://localhost:8008") {
// lib.optionalAttrs (config.hyperhive.matrix.url != matrixUrlDefault) {
HIVE_MATRIX_URL = config.hyperhive.matrix.url;
}
# Multi-account: serialize the *extra* accounts to the JSON the