···
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" ]));
16
-
hasWorkers = cfg.workers.enable && (cfg.workers.config != { });
16
+
hasWorkers = cfg.workers != { };
···
description = lib.mdDoc ''
835
-
Options for configuring workers. See `services.matrix-synapse.workers.enable`
836
-
for a more detailed description.
835
+
Options for configuring workers. Worker support will be enabled if at least one worker is configured here.
837
+
See the [worker documention](https://matrix-org.github.io/synapse/latest/workers.html#worker-configuration)
838
+
for possible options for each worker. Worker-specific options overriding the shared homeserver configuration can be
839
+
specified here for each worker.
842
+
Worker support will add a replication listener to the default
843
+
value of [`services.matrix-synapse.settings.listeners`](#opt-services.matrix-synapse.settings.listeners) and configure that
844
+
listener as `services.matrix-synapse.settings.instance_map.main`.
845
+
If you set either of those options, make sure to configure a replication listener yourself.
847
+
A redis server is required for running workers. A local one can be enabled
848
+
using [`services.matrix-synapse.configureRedisLocally`](#opt-services.matrix-synapse.configureRedisLocally).
838
-
type = types.submodule {
851
+
type = types.attrsOf (types.submodule ({name, ...}: {
852
+
freeformType = format.type;
840
-
enable = lib.mkOption {
854
+
worker_app = lib.mkOption {
855
+
type = types.enum [
856
+
"synapse.app.generic_worker"
857
+
"synapse.app.media_repository"
859
+
description = "Type of this worker";
860
+
default = "synapse.app.generic_worker";
862
+
worker_listeners = lib.mkOption {
864
+
type = types.listOf listenerType;
description = lib.mdDoc ''
844
-
Whether to enable matrix synapse workers.
847
-
Enabling this will add a replication listener to the default
848
-
value of `services.matrix-synapse.settings.listeners` and configure that
849
-
listener as `services.matrix-synapse.settings.instance_map.main`.
850
-
If you set either of those options, make sure to configure a replication
853
-
A redis server is required for running workers. A local one can be enabled
854
-
using `services.matrix-synapse.configureRedisLocally`.
866
+
List of ports that this worker should listen on, their purpose and their configuration.
858
-
config = lib.mkOption {
859
-
type = types.attrsOf (types.submodule ({name, ...}: {
860
-
freeformType = format.type;
862
-
worker_app = lib.mkOption {
863
-
type = types.enum [
864
-
"synapse.app.generic_worker"
865
-
"synapse.app.media_repository"
867
-
description = "Type of this worker";
868
-
default = "synapse.app.generic_worker";
870
-
worker_listeners = lib.mkOption {
872
-
type = types.listOf listenerType;
873
-
description = lib.mdDoc ''
874
-
List of ports that this worker should listen on, their purpose and their configuration.
877
-
worker_log_config = lib.mkOption {
879
-
default = genLogConfigFile "synapse-${name}";
880
-
defaultText = logConfigText "synapse-${name}";
881
-
description = lib.mdDoc ''
882
-
The file for log configuration.
869
+
worker_log_config = lib.mkOption {
871
+
default = genLogConfigFile "synapse-${name}";
872
+
defaultText = logConfigText "synapse-${name}";
873
+
description = lib.mdDoc ''
874
+
The file for log configuration.
884
-
See the [python documentation](https://docs.python.org/3/library/logging.config.html#configuration-dictionary-schema)
885
-
for the schema and the [upstream repository](https://github.com/matrix-org/synapse/blob/v${pkgs.matrix-synapse-unwrapped.version}/docs/sample_log_config.yaml)
892
-
description = lib.mdDoc ''
893
-
List of workers to configure. See the
894
-
[worker documention](https://matrix-org.github.io/synapse/latest/workers.html#worker-configuration)
895
-
for possible values.
876
+
See the [python documentation](https://docs.python.org/3/library/logging.config.html#configuration-dictionary-schema)
877
+
for the schema and the [upstream repository](https://github.com/matrix-org/synapse/blob/v${pkgs.matrix-synapse-unwrapped.version}/docs/sample_log_config.yaml)
897
-
example = lib.literalExpression ''
884
+
example = lib.literalExpression ''
886
+
"federation_sender" = { };
887
+
"federation_receiver" = {
888
+
worker_listeners = [
899
-
"federation_sender" = { };
900
-
"federation_receiver" = {
901
-
worker_listeners = [
905
-
bind_addresses = [ "127.0.0.1" ];
907
-
x_forwarded = true;
909
-
names = [ "federation" ];
892
+
bind_addresses = [ "127.0.0.1" ];
894
+
x_forwarded = true;
896
+
names = [ "federation" ];
extraConfigFiles = mkOption {
···
1134
-
// (lib.mapAttrs' genWorkerService cfg.workers.config);
1118
+
// (lib.mapAttrs' genWorkerService cfg.workers);
services.redis.servers.matrix-synapse = lib.mkIf cfg.configureRedisLocally {