From 59f4e969c4710aad82fda89541c8e0897e5317d9 Mon Sep 17 00:00:00 2001 From: Daniel Olsen Date: Fri, 7 Oct 2022 16:16:44 +0200 Subject: [PATCH] automatically enable redis --- synapse-module/default.nix | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/synapse-module/default.nix b/synapse-module/default.nix index 17067e0..c6b1122 100644 --- a/synapse-module/default.nix +++ b/synapse-module/default.nix @@ -56,8 +56,7 @@ in }; workers = let - inherit (lib.lists) any; - isReplication = l: any (r: any (n: n == "replication") r.names) l.resources; + isReplication = l: lib.lists.any (r: lib.lists.any (n: n == "replication") r.names) l.resources; dMRL = lib.lists.findFirst isReplication (throw "No replication listener configured!") @@ -71,7 +70,7 @@ in mainReplicationHost = lib.mkOption { type = lib.types.str; - default = dMRH; + default = if (lib.lists.all (x: dMRH != x) ["0.0.0.0" "::"]) then dMRH else "127.0.0.1"; description = "Host of the main synapse instance's replication listener"; }; @@ -356,11 +355,6 @@ in } ]; }; - options.suppress_key_server_warning = lib.mkOption { - type = lib.types.bool; - description = "using matrix.org as a trusted key server will generate a warning if this is false"; - default = false; - }; options.send_federation = lib.mkOption { type = lib.types.bool; @@ -378,6 +372,21 @@ in ''; default = [ ]; }; + + options.redis = lib.mkOption { + type = lib.types.submodule { + freeformType = format.type; + + options.enabled = lib.mkOption { + type = lib.types.bool; + description = "Enables using redis, required for worker support"; + default = (lib.lists.count (x: true) + (lib.attrsets.attrValues cfg.workers.instances)) > 0; + }; + }; + default = { }; + description = "configuration of redis for synapse and workers"; + }; }; };