summary refs log tree commit diff
path: root/host/Rory-nginx/services/matrix/synapse/workers/stream-writers
diff options
context:
space:
mode:
Diffstat (limited to 'host/Rory-nginx/services/matrix/synapse/workers/stream-writers')
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/stream-writers/__OLD__module.nix113
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix62
2 files changed, 99 insertions, 76 deletions
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/__OLD__module.nix b/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/__OLD__module.nix
index a661911..d4a9ff4 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/__OLD__module.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/__OLD__module.nix
@@ -1,53 +1,66 @@
-{ config, pkgs, lib, ... }:
+{
+  config,
+  pkgs,
+  lib,
+  ...
+}:
 let
   cfg = config.services.matrix-synapse;
-  #eventWriters = lib.range 0 (count - 1);
-  #typingWriters = lib.range 0 (count - 1);
-  #deviceWriters = lib.range 0 (count - 1);
-  #accountDataWriters = lib.range 0 (count - 1);
-  #receiptsWriters = lib.range 0 (count - 1);
-  #presenceWriters = lib.range 0 (count - 1);
-  #pusherWriters = lib.range 0 (count - 1);
 in
+#eventWriters = lib.range 0 (count - 1);
+#typingWriters = lib.range 0 (count - 1);
+#deviceWriters = lib.range 0 (count - 1);
+#accountDataWriters = lib.range 0 (count - 1);
+#receiptsWriters = lib.range 0 (count - 1);
+#presenceWriters = lib.range 0 (count - 1);
+#pusherWriters = lib.range 0 (count - 1);
 {
-  options.services.matrix-synapse = lib.listToAttrs (lib.map (option: {
-        name = "${option}StreamWriters";
-        value = lib.mkOption {
-          type = lib.types.int;
-          default = 1;
-          description = "Number of writers for ${option} streams";
-        };
-      }) [
-        "event"
-        "typing"
-        "toDevice"
-        "accountData"
-        "receipts"
-        "presence"
-        "pushRule"
-      ]) // {
-        enableStreamWriters = lib.mkEnableOption "Enable stream writers";
-        federationSenders = lib.mkOption {
-          type = lib.types.int;
-          default = 1;
-          description = "Number of federation senders";
-        };
-        pushers = lib.mkOption {
-          type = lib.types.int;
-          default = 1;
-          description = "Number of pushers";
-        };
+  options.services.matrix-synapse =
+    lib.listToAttrs (
+      lib.map
+        (option: {
+          name = "${option}StreamWriters";
+          value = lib.mkOption {
+            type = lib.types.int;
+            default = 1;
+            description = "Number of writers for ${option} streams";
+          };
+        })
+        [
+          "event"
+          "typing"
+          "toDevice"
+          "accountData"
+          "receipts"
+          "presence"
+          "pushRule"
+        ]
+    )
+    // {
+      enableStreamWriters = lib.mkEnableOption "Enable stream writers";
+      federationSenders = lib.mkOption {
+        type = lib.types.int;
+        default = 1;
+        description = "Number of federation senders";
+      };
+      pushers = lib.mkOption {
+        type = lib.types.int;
+        default = 1;
+        description = "Number of pushers";
       };
+    };
 
   config = lib.mkIf cfg.enableStreamWriters {
     services.matrix-synapse = {
       settings = {
-        instance_map = lib.listToAttrs (lib.map (port: {
-          name = "stream-writer-${toString port}";
-          value = {
-            path = "/run/matrix-synapse/stream-writer-${toString port}.sock";
-          };
-        }) federationSenders);
+        instance_map = lib.listToAttrs (
+          lib.map (port: {
+            name = "stream-writer-${toString port}";
+            value = {
+              path = "/run/matrix-synapse/stream-writer-${toString port}.sock";
+            };
+          }) federationSenders
+        );
 
         stream_writers = {
           events = lib.map (port: "stream-writer-events-${toString port}") federationSenders;
@@ -60,13 +73,15 @@ in
         };
       };
 
-      workers = lib.listToAttrs (lib.map (port: {
-        name = "stream-writerr-${toString port}";
-        value = {
-          worker_app = "synapse.app.generic_worker";
-          worker_listeners = [ ];
-        };
-      }) federationSenders);
+      workers = lib.listToAttrs (
+        lib.map (port: {
+          name = "stream-writerr-${toString port}";
+          value = {
+            worker_app = "synapse.app.generic_worker";
+            worker_listeners = [ ];
+          };
+        }) federationSenders
+      );
     };
   };
-}
\ No newline at end of file
+}
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix b/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix
index af7e544..42e9251 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix
@@ -1,5 +1,9 @@
-
-{ config, pkgs, lib, ... }:
+{
+  config,
+  pkgs,
+  lib,
+  ...
+}:
 let
   cfg = config.services.matrix-synapse;
   streamWriters = lib.range 0 (cfg.eventStreamWriters - 1);
@@ -7,35 +11,39 @@ in
 {
   services.matrix-synapse = {
     settings = {
-      instance_map = lib.listToAttrs (lib.map (port: {
-        name = "stream-writer-${toString port}";
-        value = {
-          path = "/run/matrix-synapse/stream-writer-${toString port}.sock";
-        };
-      }) streamWriters);
+      instance_map = lib.listToAttrs (
+        lib.map (port: {
+          name = "stream-writer-${toString port}";
+          value = {
+            path = "/run/matrix-synapse/stream-writer-${toString port}.sock";
+          };
+        }) streamWriters
+      );
 
       stream_writers = {
         events = lib.map (index: "stream-writer-events-${toString index}") streamWriters;
       };
     };
 
-    workers = lib.listToAttrs (lib.map (index: {
-      name = "stream-writer-${toString index}";
-      value = {
-        worker_app = "synapse.app.generic_worker";
-        worker_listeners = [
-          {
-            type = "http";
-            path = "/run/matrix-synapse/stream-writer-${toString index}.sock";
-            resources = [
-              {
-                names = ["replication"];
-                compress = false;
-              }
-            ];
-          }
-        ];
-      };
-    }) streamWriters);
+    workers = lib.listToAttrs (
+      lib.map (index: {
+        name = "stream-writer-${toString index}";
+        value = {
+          worker_app = "synapse.app.generic_worker";
+          worker_listeners = [
+            {
+              type = "http";
+              path = "/run/matrix-synapse/stream-writer-${toString index}.sock";
+              resources = [
+                {
+                  names = [ "replication" ];
+                  compress = false;
+                }
+              ];
+            }
+          ];
+        };
+      }) streamWriters
+    );
   };
-}
\ No newline at end of file
+}