about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSophie Tauchert <sophie@999eagle.moe>2023-07-06 23:03:51 +0200
committerSophie Tauchert <sophie@999eagle.moe>2023-09-18 08:24:35 +0200
commitb32918012814fcca1c5cd6c815b5565d71e96610 (patch)
tree023cc0c0bf6c8629174ea8a7d60bd2ab9bbf1458 /nixos
parentb7c41da8d68c7e82c9957cc530e1141f0ca5aba6 (diff)
nixos/synapse: add option to configure redis automatically
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/matrix/synapse.nix18
1 files changed, 18 insertions, 0 deletions
diff --git a/nixos/modules/services/matrix/synapse.nix b/nixos/modules/services/matrix/synapse.nix
index decf9c42c8482..60ad1fa42bc74 100644
--- a/nixos/modules/services/matrix/synapse.nix
+++ b/nixos/modules/services/matrix/synapse.nix
@@ -770,6 +770,14 @@ in {
           NixOps is in use.
         '';
       };
+
+      configureRedisLocally = lib.mkOption {
+        type = types.bool;
+        default = false;
+        description = lib.mdDoc ''
+          Whether to automatically configure a local redis server for matrix-synapse.
+        '';
+      };
     };
   };
 
@@ -794,6 +802,11 @@ in {
       }
     ];
 
+    services.matrix-synapse.settings.redis = lib.mkIf cfg.configureRedisLocally {
+      enabled = true;
+      path = config.services.redis.servers.matrix-synapse.unixSocket;
+    };
+
     services.matrix-synapse.configFile = configFile;
     services.matrix-synapse.package = wrapped;
 
@@ -886,6 +899,11 @@ in {
         ];
       };
 
+    services.redis.servers.matrix-synapse = lib.mkIf cfg.configureRedisLocally {
+      enable = true;
+      user = "matrix-synapse";
+    };
+
     environment.systemPackages = [ registerNewMatrixUser ];
   };