nixos/synapse: move services.matrix-synapse.workers.config to services.matrix-synapse.workers

This commit is contained in:
Sophie Tauchert 2023-09-10 15:35:59 +02:00
parent 53ab84cf49
commit ca1ffe5869
No known key found for this signature in database
GPG Key ID: 52701DE5F5F51125
2 changed files with 62 additions and 81 deletions

View File

@ -13,7 +13,7 @@ let
usePostgresql = cfg.settings.database.name == "psycopg2";
hasLocalPostgresDB = let args = cfg.settings.database.args; in
usePostgresql && (!(args ? host) || (elem args.host [ "localhost" "127.0.0.1" "::1" ]));
hasWorkers = cfg.workers.enable && (cfg.workers.config != { });
hasWorkers = cfg.workers != { };
registerNewMatrixUser =
let
@ -832,30 +832,22 @@ in {
workers = lib.mkOption {
default = { };
description = lib.mdDoc ''
Options for configuring workers. See `services.matrix-synapse.workers.enable`
for a more detailed description.
'';
type = types.submodule {
options = {
enable = lib.mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Whether to enable matrix synapse workers.
Options for configuring workers. Worker support will be enabled if at least one worker is configured here.
See the [worker documention](https://matrix-org.github.io/synapse/latest/workers.html#worker-configuration)
for possible options for each worker. Worker-specific options overriding the shared homeserver configuration can be
specified here for each worker.
::: {.note}
Enabling this will add a replication listener to the default
value of `services.matrix-synapse.settings.listeners` and configure that
Worker support will add a replication listener to the default
value of [`services.matrix-synapse.settings.listeners`](#opt-services.matrix-synapse.settings.listeners) and configure that
listener as `services.matrix-synapse.settings.instance_map.main`.
If you set either of those options, make sure to configure a replication
listener yourself.
If you set either of those options, make sure to configure a replication listener yourself.
A redis server is required for running workers. A local one can be enabled
using `services.matrix-synapse.configureRedisLocally`.
using [`services.matrix-synapse.configureRedisLocally`](#opt-services.matrix-synapse.configureRedisLocally).
:::
'';
};
config = lib.mkOption {
type = types.attrsOf (types.submodule ({name, ...}: {
freeformType = format.type;
options = {
@ -889,11 +881,6 @@ in {
};
}));
default = { };
description = lib.mdDoc ''
List of workers to configure. See the
[worker documention](https://matrix-org.github.io/synapse/latest/workers.html#worker-configuration)
for possible values.
'';
example = lib.literalExpression ''
{
"federation_sender" = { };
@ -914,9 +901,6 @@ in {
}
'';
};
};
};
};
extraConfigFiles = mkOption {
type = types.listOf types.path;
@ -1131,7 +1115,7 @@ in {
}
];
}
// (lib.mapAttrs' genWorkerService cfg.workers.config);
// (lib.mapAttrs' genWorkerService cfg.workers);
services.redis.servers.matrix-synapse = lib.mkIf cfg.configureRedisLocally {
enable = true;

View File

@ -35,14 +35,11 @@ import ../make-test-python.nix ({ pkgs, ... }: {
};
configureRedisLocally = true;
workers = {
enable = true;
config = {
"federation_sender" = { };
};
};
};
};
};
testScript = ''
start_all()