summary refs log tree commit diff
path: root/host/Rory-nginx/services/matrix/synapse/workers
diff options
context:
space:
mode:
Diffstat (limited to 'host/Rory-nginx/services/matrix/synapse/workers')
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/appservice.nix13
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/background.nix13
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix49
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/module.nix91
-rw-r--r--host/Rory-nginx/services/matrix/synapse/workers/pusher.nix61
-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
7 files changed, 231 insertions, 171 deletions
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/appservice.nix b/host/Rory-nginx/services/matrix/synapse/workers/appservice.nix
index 5f1323c..d259edd 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/appservice.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/appservice.nix
@@ -1,6 +1,11 @@
-{ config, pkgs, lib, ... }:
+{
+  config,
+  pkgs,
+  lib,
+  ...
+}:
 
-let 
+let
   cfg = config.services.matrix-synapse;
 in
 {
@@ -24,7 +29,7 @@ in
             path = "/run/matrix-synapse/appservice.sock";
             resources = [
               {
-                names = ["replication"];
+                names = [ "replication" ];
                 compress = false;
               }
             ];
@@ -33,4 +38,4 @@ in
       };
     };
   };
-}
\ No newline at end of file
+}
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/background.nix b/host/Rory-nginx/services/matrix/synapse/workers/background.nix
index d267124..c97d647 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/background.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/background.nix
@@ -1,6 +1,11 @@
-{ config, pkgs, lib, ... }:
+{
+  config,
+  pkgs,
+  lib,
+  ...
+}:
 
-let 
+let
   cfg = config.services.matrix-synapse;
 in
 {
@@ -24,7 +29,7 @@ in
             path = "/run/matrix-synapse/background.sock";
             resources = [
               {
-                names = ["replication"];
+                names = [ "replication" ];
                 compress = false;
               }
             ];
@@ -33,4 +38,4 @@ in
       };
     };
   };
-}
\ No newline at end of file
+}
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix b/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix
index c90fe3e..d0b1774 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix
@@ -1,5 +1,10 @@
-{ config, pkgs, lib, ... }:
-let 
+{
+  config,
+  pkgs,
+  lib,
+  ...
+}:
+let
   cfg = config.services.matrix-synapse;
   federationSenders = lib.range 0 (cfg.federationSenders - 1);
 in
@@ -12,23 +17,25 @@ in
       outbound_federation_restricted_to = lib.map (index: "federation_sender-${toString index}") federationSenders;
     };
 
-    workers = lib.listToAttrs (lib.map (index: {
-      name = "federation_sender-${toString index}";
-      value = {
-        worker_app = "synapse.app.generic_worker";
-        worker_listeners = [
-          {
-            type = "http";
-            path = "/run/matrix-synapse/pusher-${toString index}.sock";
-            resources = [
-              {
-                names = ["replication"];
-                compress = false;
-              }
-            ];
-          }
-        ];
-      };
-    }) federationSenders);
+    workers = lib.listToAttrs (
+      lib.map (index: {
+        name = "federation_sender-${toString index}";
+        value = {
+          worker_app = "synapse.app.generic_worker";
+          worker_listeners = [
+            {
+              type = "http";
+              path = "/run/matrix-synapse/pusher-${toString index}.sock";
+              resources = [
+                {
+                  names = [ "replication" ];
+                  compress = false;
+                }
+              ];
+            }
+          ];
+        };
+      }) federationSenders
+    );
   };
-}
\ No newline at end of file
+}
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/module.nix b/host/Rory-nginx/services/matrix/synapse/workers/module.nix
index 9cc3d92..b9c490e 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/module.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/module.nix
@@ -1,14 +1,19 @@
-{ 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);
 {
   imports = [
     ./federation-sender.nix
@@ -16,37 +21,43 @@ in
     ./pusher.nix
     ./stream-writers/event-stream-writer.nix
   ];
-  options.services.matrix-synapse = lib.listToAttrs (lib.map (option: {
-        name = "${option}StreamWriters";
-        value = lib.mkOption {
-          type = lib.types.int;
-          default = 0;
-          description = "Number of writers for ${option} streams";
-        };
-      }) [
-        "event"
-        "typing"
-        "toDevice"
-        "accountData"
-        "receipts"
-        "presence"
-        "pushRule"
-      ]) // {
-        enableStreamWriters = lib.mkEnableOption "Enable stream writers";
-        enableAppserviceWorker = lib.mkEnableOption "Enable dedicated appservice worker";
-        enableBackgroundWorker = lib.mkEnableOption "Enable dedicated background task worker";
+  options.services.matrix-synapse =
+    lib.listToAttrs (
+      lib.map
+        (option: {
+          name = "${option}StreamWriters";
+          value = lib.mkOption {
+            type = lib.types.int;
+            default = 0;
+            description = "Number of writers for ${option} streams";
+          };
+        })
+        [
+          "event"
+          "typing"
+          "toDevice"
+          "accountData"
+          "receipts"
+          "presence"
+          "pushRule"
+        ]
+    )
+    // {
+      enableStreamWriters = lib.mkEnableOption "Enable stream writers";
+      enableAppserviceWorker = lib.mkEnableOption "Enable dedicated appservice worker";
+      enableBackgroundWorker = lib.mkEnableOption "Enable dedicated background task worker";
 
-        federationSenders = lib.mkOption {
-          type = lib.types.int;
-          default = 0;
-          description = "Number of federation senders";
-        };
-        pushers = lib.mkOption {
-          type = lib.types.int;
-          default = 0;
-          description = "Number of pushers";
-        };
+      federationSenders = lib.mkOption {
+        type = lib.types.int;
+        default = 0;
+        description = "Number of federation senders";
+      };
+      pushers = lib.mkOption {
+        type = lib.types.int;
+        default = 0;
+        description = "Number of pushers";
       };
+    };
 
   config = lib.mkIf cfg.enableStreamWriters {
     #services.matrix-synapse = {
@@ -57,7 +68,7 @@ in
     #        path = "/run/matrix-synapse/stream-writer-${toString index}.sock";
     #      };
     #    }) federationSenders);
-#
+    #
     #    stream_writers = {
     #      events = lib.map (index: "stream-writer-events-${toString index}") federationSenders;
     #      typing = lib.map (index: "stream-writer-typing-${toString index}") typingWriters;
@@ -68,7 +79,7 @@ in
     #      push_rules = lib.map (index: "stream-writer-push_rules-${toString index}") pusherWriters;
     #    };
     #  };
-#
+    #
     #  workers = lib.listToAttrs (lib.map (index: {
     #    name = "stream-writerr-${toString index}";
     #    value = {
@@ -78,4 +89,4 @@ in
     #  }) federationSenders);
     #};
   };
-}
\ No newline at end of file
+}
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/pusher.nix b/host/Rory-nginx/services/matrix/synapse/workers/pusher.nix
index c90561e..f5ef601 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/pusher.nix
+++ b/host/Rory-nginx/services/matrix/synapse/workers/pusher.nix
@@ -1,4 +1,9 @@
-{ config, pkgs, lib, ... }:
+{
+  config,
+  pkgs,
+  lib,
+  ...
+}:
 let
   cfg = config.services.matrix-synapse;
   pushers = lib.range 0 (cfg.pushers - 1);
@@ -7,34 +12,38 @@ in
   config = lib.mkIf (cfg.pushers > 0) {
     services.matrix-synapse = {
       settings = {
-        instance_map = lib.listToAttrs (lib.map (index: {
-          name = "pusher-${toString index}";
-          value = {
-            path = "/run/matrix-synapse/pusher-${toString index}.sock";
-          };
-        }) pushers);
+        instance_map = lib.listToAttrs (
+          lib.map (index: {
+            name = "pusher-${toString index}";
+            value = {
+              path = "/run/matrix-synapse/pusher-${toString index}.sock";
+            };
+          }) pushers
+        );
 
         pusher_instances = lib.map (index: "pusher-${toString index}") pushers;
       };
 
-      workers = lib.listToAttrs (lib.map (index: {
-        name = "pusher-${toString index}";
-        value = {
-          worker_app = "synapse.app.generic_worker";
-          worker_listeners = [
-            {
-              type = "http";
-              path = "/run/matrix-synapse/pusher-${toString index}.sock";
-              resources = [
-                {
-                  names = ["replication"];
-                  compress = false;
-                }
-              ];
-            }
-          ];
-        };
-      }) pushers);
+      workers = lib.listToAttrs (
+        lib.map (index: {
+          name = "pusher-${toString index}";
+          value = {
+            worker_app = "synapse.app.generic_worker";
+            worker_listeners = [
+              {
+                type = "http";
+                path = "/run/matrix-synapse/pusher-${toString index}.sock";
+                resources = [
+                  {
+                    names = [ "replication" ];
+                    compress = false;
+                  }
+                ];
+              }
+            ];
+          };
+        }) pushers
+      );
     };
   };
-}
\ No newline at end of file
+}
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
+}