diff --git a/host/Rory-nginx-old/configuration.nix b/host/Rory-nginx-old/configuration.nix
index 9096c4a..870c37f 100644
--- a/host/Rory-nginx-old/configuration.nix
+++ b/host/Rory-nginx-old/configuration.nix
@@ -25,14 +25,13 @@
./services/ollama.nix
./services/deluge.nix
./services/prometheus.nix
- ./services/redpanda/root.nix
./services/email/root.nix
];
users.groups.ocp = { };
networking = {
- hostName = "Rory-nginx";
+ hostName = "Rory-nginx-old";
interfaces.ens18.ipv4.addresses = [
{
address = "192.168.1.2";
diff --git a/host/Rory-nginx/configuration.nix b/host/Rory-nginx/configuration.nix
index 912e6fe..433b5db 100755
--- a/host/Rory-nginx/configuration.nix
+++ b/host/Rory-nginx/configuration.nix
@@ -22,9 +22,7 @@
./services/nginx/nginx.nix
#./services/jitsi.nix
./services/cgit.nix
- ./services/ollama.nix
./services/prometheus.nix
- ./services/redpanda/root.nix
./services/email/root.nix
];
@@ -91,12 +89,7 @@
# inherit pkgs lib;
# conduit = conduit;
#};
-
- services.pgadmin = {
- enable = false;
- initialEmail = "root@localhost.localdomain";
- initialPasswordFile = "/etc/matrix-user-pass";
- };
+
containers."draupnir-cme" = import ./services/containers/draupnir-cme/container.nix {
inherit pkgs lib nixpkgs-Draupnir;
};
diff --git a/host/Rory-nginx/services/containers/draupnir-linux-mint/container.nix b/host/Rory-nginx/services/containers/draupnir-linux-mint/container.nix
deleted file mode 100755
index 41d25c5..0000000
--- a/host/Rory-nginx/services/containers/draupnir-linux-mint/container.nix
+++ /dev/null
@@ -1,32 +0,0 @@
-{ nixpkgs-Draupnir, ... }:
-
-{
- privateNetwork = true;
- autoStart = true;
- specialArgs = {
- inherit nixpkgs-Draupnir;
- };
- config =
- { lib, pkgs, ... }:
- {
- imports = [
- ../shared.nix
- ./root.nix
- ./services/draupnir.nix
- "${nixpkgs-Draupnir}/nixos/modules/services/matrix/draupnir.nix"
- ];
- nixpkgs.overlays = [
- (final: prev: {
- draupnir = nixpkgs-Draupnir.legacyPackages.${pkgs.stdenv.hostPlatform.system}.draupnir;
- })
- ];
- };
- hostAddress = "192.168.100.1";
- localAddress = "192.168.100.19";
-
- bindMounts."draupnir-access-token" = {
- hostPath = "/etc/draupnir-linux-mint-access-token";
- mountPoint = "/etc/draupnir-access-token";
- isReadOnly = true;
- };
-}
diff --git a/host/Rory-nginx/services/containers/draupnir-linux-mint/root.nix b/host/Rory-nginx/services/containers/draupnir-linux-mint/root.nix
deleted file mode 100755
index 2adac62..0000000
--- a/host/Rory-nginx/services/containers/draupnir-linux-mint/root.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{ pkgs, ... }:
-
-{
- networking.useHostResolvConf = true;
-
- networking.hosts = {
- "192.168.100.18" = [
- "matrix.rory.gay"
- "rory.gay"
- ];
- };
-
- networking.firewall = {
- enable = true;
- };
-}
diff --git a/host/Rory-nginx/services/containers/draupnir-linux-mint/services/draupnir.nix b/host/Rory-nginx/services/containers/draupnir-linux-mint/services/draupnir.nix
deleted file mode 100755
index 042651a..0000000
--- a/host/Rory-nginx/services/containers/draupnir-linux-mint/services/draupnir.nix
+++ /dev/null
@@ -1,26 +0,0 @@
-{ ... }:
-
-{
- services.draupnir = {
- enable = true;
- accessTokenFile = "/etc/draupnir-access-token";
- homeserverUrl = "https://matrix.rory.gay";
-
- settings = {
- managementRoom = "#draupnir-linux-mint:rory.gay";
- recordIgnoredInvites = true; # We want to be aware of invites
- autojoinOnlyIfManager = true; # ... but we don't want the bot to be invited to eg. Matrix HQ...
- automaticallyRedactForReasons = [ "*" ]; # Always autoredact
- fasterMembershipChecks = true;
-
- backgroundDelayMS = 10; # delay isn't needed, I don't mind the performance hit
- pollReports = false;
-
- admin.enableMakeRoomAdminCommand = false;
- commands.ban.defaultReasons = [
- "spam"
- "code of conduct violation"
- ];
- };
- };
-}
diff --git a/host/Rory-nginx/services/containers/matrixunittests-conduit/container.nix b/host/Rory-nginx/services/containers/matrixunittests-conduit/container.nix
deleted file mode 100755
index daefba1..0000000
--- a/host/Rory-nginx/services/containers/matrixunittests-conduit/container.nix
+++ /dev/null
@@ -1,30 +0,0 @@
-{ conduit, ... }:
-
-{
- privateNetwork = true;
- autoStart = true;
- specialArgs = {
- inherit conduit;
- };
- config =
- {
- lib,
- pkgs,
- conduit,
- ...
- }:
- {
- imports = [
- ../shared.nix
- ./services/nginx.nix
- ./services/conduit.nix
- ];
- networking.useHostResolvConf = true;
- networking.firewall = {
- enable = true;
- allowedTCPPorts = [ 80 ];
- };
- };
- hostAddress = "192.168.100.1";
- localAddress = "192.168.100.15";
-}
diff --git a/host/Rory-nginx/services/containers/matrixunittests-conduit/services/conduit.nix b/host/Rory-nginx/services/containers/matrixunittests-conduit/services/conduit.nix
deleted file mode 100755
index 3df71be..0000000
--- a/host/Rory-nginx/services/containers/matrixunittests-conduit/services/conduit.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{ pkgs, conduit, ... }:
-
-{
- services.matrix-conduit = {
- package = conduit.packages.${pkgs.system}.default;
- enable = true;
- settings.global = {
- address = "127.0.0.1";
- server_name = "conduit.matrixunittests.rory.gay";
- database_backend = "rocksdb";
- enable_lightning_bolt = true;
- max_concurrent_requests = 1000;
- allow_check_for_updates = false;
- allow_registration = true;
- yes_i_am_very_very_sure_i_want_an_open_registration_server_prone_to_abuse = true;
- allow_guest_registration = true;
- disable_federation = true;
- };
- };
-}
diff --git a/host/Rory-nginx/services/containers/matrixunittests-conduit/services/nginx.nix b/host/Rory-nginx/services/containers/matrixunittests-conduit/services/nginx.nix
deleted file mode 100755
index 0d7874e..0000000
--- a/host/Rory-nginx/services/containers/matrixunittests-conduit/services/nginx.nix
+++ /dev/null
@@ -1,94 +0,0 @@
-{ pkgs, ... }:
-
-{
- services = {
- nginx = {
- enable = true;
- package = pkgs.nginxQuic;
- recommendedProxySettings = true;
- recommendedTlsSettings = true;
- recommendedZstdSettings = true;
- recommendedGzipSettings = true;
- recommendedBrotliSettings = true;
- recommendedOptimisation = true;
- appendConfig = ''
- worker_processes 16;
- '';
- eventsConfig = ''
- #use kqueue;
- worker_connections 512;
- '';
- appendHttpConfig = ''
- #sendfile on;
- disable_symlinks off;
- '';
- additionalModules = with pkgs.nginxModules; [ moreheaders ];
- virtualHosts = {
- "conduit.matrixunittests.rory.gay" = {
- locations."/" = {
- proxyPass = "http://127.0.0.1:6167";
- extraConfig = ''
- if ($request_method = 'OPTIONS') {
- more_set_headers 'Access-Control-Allow-Origin: *';
- more_set_headers 'Access-Control-Allow-Methods: *';
- #
- # Custom headers and headers various browsers *should* be OK with but aren't
- #
- more_set_headers 'Access-Control-Allow-Headers: *';
- #
- # Tell client that this pre-flight info is valid for 20 days
- #
- more_set_headers 'Access-Control-Max-Age: 1728000';
- more_set_headers 'Content-Type: text/plain; charset=utf-8';
- more_set_headers 'Content-Length: 0';
- return 204;
- }
- '';
- };
- locations."= /.well-known/matrix/server".extraConfig = ''
- more_set_headers 'Content-Type application/json';
- more_set_headers 'Access-Control-Allow-Origin *';
- return 200 '${builtins.toJSON { "m.server" = "conduit.matrixunittests.rory.gay:443"; }}';
- '';
- locations."= /.well-known/matrix/client".extraConfig = ''
- more_set_headers 'Content-Type application/json';
- more_set_headers 'Access-Control-Allow-Origin *';
- return 200 '${builtins.toJSON { "m.homeserver".base_url = "https://conduit.matrixunittests.rory.gay"; }}';
- '';
- locations."= /.well-known/matrix/support".extraConfig = ''
- more_set_headers 'Content-Type application/json';
- more_set_headers 'Access-Control-Allow-Origin *';
- return 200 '${
- builtins.toJSON {
- admins = [
- {
- matrix_id = "@emma:rory.gay";
- role = "admin";
- }
- {
- matrix_id = "@alicia:rory.gay";
- role = "admin";
- }
- {
- matrix_id = "@root:rory.gay";
- role = "admin";
- }
- {
- matrix_id = "@rory:rory.gay";
- role = "admin";
- }
- ];
- }
- }';
- '';
- };
- };
- };
- };
- systemd.services.nginx.serviceConfig = {
- LimitNOFILE = 5000000;
- };
- security.acme.acceptTerms = true;
- security.acme.defaults.email = "root@rory.gay";
-
-}
diff --git a/host/Rory-nginx/services/containers/matrixunittests/container.nix b/host/Rory-nginx/services/containers/matrixunittests/container.nix
deleted file mode 100755
index cbd90f8..0000000
--- a/host/Rory-nginx/services/containers/matrixunittests/container.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{ grapevine, ... }:
-
-{
- privateNetwork = true;
- autoStart = true;
- config =
- {
- lib,
- pkgs,
- ...
- }:
- {
- imports = [
- ../shared.nix
- ./services/nginx.nix
- ./services/conduit.nix
- grapevine.nixosModules.default
-
- ];
- networking.useHostResolvConf = true;
- networking.firewall = {
- enable = true;
- allowedTCPPorts = [
- 80
- 5432
- ];
- };
- };
- hostAddress = "192.168.100.1";
- localAddress = "192.168.100.13";
-}
diff --git a/host/Rory-nginx/services/containers/matrixunittests/services/conduit.nix b/host/Rory-nginx/services/containers/matrixunittests/services/conduit.nix
deleted file mode 100755
index cd5776f..0000000
--- a/host/Rory-nginx/services/containers/matrixunittests/services/conduit.nix
+++ /dev/null
@@ -1,43 +0,0 @@
-{ ... }:
-
-{
- services.grapevine = {
- # package = conduit.packages.${pkgs.system}.default;
- enable = true;
- settings = {
- server_name = "matrixunittests.rory.gay";
- allow_registration = true;
-
- listen = [
- {
- type = "tcp";
- address = "127.0.0.1";
- port = 6167;
- }
- ];
- federation.enable = false;
- server_discovery.client.base_url = "https://matrixunittests.rory.gay"; # This is required for some reason
-
- database = {
- backend = "rocksdb";
- };
- };
- };
-
- systemd.services.matrix-conduit-reg-token = {
- enable = true;
- description = "Random registration token for Conduit.";
- wantedBy = [ "grapevine.service" ]; # So the registration can be used by Conduit.
-
- script = ''
- rm -rfv /var/lib/grapevine/*
- systemctl daemon-reload
- systemctl try-restart grapevine.service'';
- serviceConfig = {
- User = "root";
- Group = "root";
- IgnoreSIGPIPE = true;
- Restart = "on-failure";
- };
- };
-}
diff --git a/host/Rory-nginx/services/containers/matrixunittests/services/nginx.nix b/host/Rory-nginx/services/containers/matrixunittests/services/nginx.nix
deleted file mode 100755
index 0236182..0000000
--- a/host/Rory-nginx/services/containers/matrixunittests/services/nginx.nix
+++ /dev/null
@@ -1,94 +0,0 @@
-{ pkgs, ... }:
-
-{
- services = {
- nginx = {
- enable = true;
- package = pkgs.nginxQuic;
- recommendedProxySettings = true;
- recommendedTlsSettings = true;
- recommendedZstdSettings = true;
- recommendedGzipSettings = true;
- recommendedBrotliSettings = true;
- recommendedOptimisation = true;
- appendConfig = ''
- worker_processes 16;
- '';
- eventsConfig = ''
- #use kqueue;
- worker_connections 512;
- '';
- appendHttpConfig = ''
- #sendfile on;
- disable_symlinks off;
- '';
- additionalModules = with pkgs.nginxModules; [ moreheaders ];
- virtualHosts = {
- "matrixunittests.rory.gay" = {
- locations."/" = {
- proxyPass = "http://127.0.0.1:6167";
- extraConfig = ''
- if ($request_method = 'OPTIONS') {
- more_set_headers 'Access-Control-Allow-Origin: *';
- more_set_headers 'Access-Control-Allow-Methods: *';
- #
- # Custom headers and headers various browsers *should* be OK with but aren't
- #
- more_set_headers 'Access-Control-Allow-Headers: *';
- #
- # Tell client that this pre-flight info is valid for 20 days
- #
- more_set_headers 'Access-Control-Max-Age: 1728000';
- more_set_headers 'Content-Type: text/plain; charset=utf-8';
- more_set_headers 'Content-Length: 0';
- return 204;
- }
- '';
- };
- locations."= /.well-known/matrix/server".extraConfig = ''
- more_set_headers 'Content-Type application/json';
- more_set_headers 'Access-Control-Allow-Origin *';
- return 200 '${builtins.toJSON { "m.server" = "matrixunittests.rory.gay:443"; }}';
- '';
- locations."= /.well-known/matrix/client".extraConfig = ''
- more_set_headers 'Content-Type application/json';
- more_set_headers 'Access-Control-Allow-Origin *';
- return 200 '${builtins.toJSON { "m.homeserver".base_url = "https://matrixunittests.rory.gay"; }}';
- '';
- locations."= /.well-known/matrix/support".extraConfig = ''
- more_set_headers 'Content-Type application/json';
- more_set_headers 'Access-Control-Allow-Origin *';
- return 200 '${
- builtins.toJSON {
- admins = [
- {
- matrix_id = "@emma:rory.gay";
- role = "admin";
- }
- {
- matrix_id = "@alicia:rory.gay";
- role = "admin";
- }
- {
- matrix_id = "@root:rory.gay";
- role = "admin";
- }
- {
- matrix_id = "@rory:rory.gay";
- role = "admin";
- }
- ];
- }
- }';
- '';
- };
- };
- };
- };
- systemd.services.nginx.serviceConfig = {
- LimitNOFILE = 5000000;
- };
- security.acme.acceptTerms = true;
- security.acme.defaults.email = "root@rory.gay";
-
-}
diff --git a/host/Rory-nginx/services/containers/pluralcontactbotpoc/container.nix b/host/Rory-nginx/services/containers/pluralcontactbotpoc/container.nix
deleted file mode 100755
index 6be7c83..0000000
--- a/host/Rory-nginx/services/containers/pluralcontactbotpoc/container.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{ conduit, ... }:
-
-{
- privateNetwork = true;
- autoStart = true;
- specialArgs = {
- inherit conduit;
- };
- config =
- {
- lib,
- pkgs,
- conduit,
- ...
- }:
- {
- imports = [
- ./root.nix
- ../shared.nix
- ];
- networking.useHostResolvConf = true;
- networking.firewall = {
- enable = true;
- allowedTCPPorts = [ 80 ];
- };
- };
- hostAddress = "192.168.100.1";
- localAddress = "192.168.100.11";
-}
diff --git a/host/Rory-nginx/services/containers/pluralcontactbotpoc/root.nix b/host/Rory-nginx/services/containers/pluralcontactbotpoc/root.nix
deleted file mode 100755
index 11d0be3..0000000
--- a/host/Rory-nginx/services/containers/pluralcontactbotpoc/root.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ ... }:
-
-{
- imports = [
- ./services/nginx.nix
- ./services/conduit.nix
- ./services/pantalaimon.nix
- ];
-
-}
diff --git a/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/conduit.nix b/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/conduit.nix
deleted file mode 100755
index db9df9a..0000000
--- a/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/conduit.nix
+++ /dev/null
@@ -1,39 +0,0 @@
-{ pkgs, conduit, ... }:
-
-{
- services.matrix-conduit = {
- package = conduit.packages.${pkgs.system}.default;
- enable = true;
- settings.global = {
- address = "127.0.0.1";
- server_name = "pcpoc.rory.gay";
- database_backend = "rocksdb";
- enable_lightning_bolt = true;
- max_concurrent_requests = 1000;
- allow_check_for_updates = false;
- allow_registration = false;
- };
- };
-
- systemd.services.matrix-conduit-reg-token = {
- enable = true;
- description = "Random registration token for Conduit.";
- wantedBy = [ "conduit.service" ]; # So the registration can be used by Conduit.
-
- script = ''
- reg_token=`cat /dev/urandom | tr -dc a-zA-Z0-9 | head -c 256`
- mkdir -p /run/systemd/system/conduit.service.d
- echo $reg_token > /run/conduit-registration-token
- echo "[Service]" > /run/systemd/system/conduit.service.d/override.conf
- echo Environment=\"CONDUIT_REGISTRATION_TOKEN=$reg_token\" >> /run/systemd/system/conduit.service.d/override.conf
- systemctl daemon-reload
- systemctl try-restart conduit.service'';
- serviceConfig = {
- User = "root";
- Group = "root";
- IgnoreSIGPIPE = true;
- Restart = "on-failure";
- };
- };
-
-}
diff --git a/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/nginx.nix b/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/nginx.nix
deleted file mode 100755
index 9d8041a..0000000
--- a/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/nginx.nix
+++ /dev/null
@@ -1,94 +0,0 @@
-{ pkgs, ... }:
-
-{
- services = {
- nginx = {
- enable = true;
- package = pkgs.nginxQuic;
- recommendedProxySettings = true;
- recommendedTlsSettings = true;
- recommendedZstdSettings = true;
- recommendedGzipSettings = true;
- recommendedBrotliSettings = true;
- recommendedOptimisation = true;
- appendConfig = ''
- worker_processes 16;
- '';
- eventsConfig = ''
- #use kqueue;
- worker_connections 512;
- '';
- appendHttpConfig = ''
- #sendfile on;
- disable_symlinks off;
- '';
- additionalModules = with pkgs.nginxModules; [ moreheaders ];
- virtualHosts = {
- "pcpoc.rory.gay" = {
- locations."/" = {
- proxyPass = "http://127.0.0.1:6167";
- extraConfig = ''
- if ($request_method = 'OPTIONS') {
- more_set_headers 'Access-Control-Allow-Origin: *';
- more_set_headers 'Access-Control-Allow-Methods: *';
- #
- # Custom headers and headers various browsers *should* be OK with but aren't
- #
- more_set_headers 'Access-Control-Allow-Headers: *';
- #
- # Tell client that this pre-flight info is valid for 20 days
- #
- more_set_headers 'Access-Control-Max-Age: 1728000';
- more_set_headers 'Content-Type: text/plain; charset=utf-8';
- more_set_headers 'Content-Length: 0';
- return 204;
- }
- '';
- };
- locations."= /.well-known/matrix/server".extraConfig = ''
- more_set_headers 'Content-Type application/json';
- more_set_headers 'Access-Control-Allow-Origin *';
- return 200 '${builtins.toJSON { "m.server" = "pcpoc.rory.gay:443"; }}';
- '';
- locations."= /.well-known/matrix/client".extraConfig = ''
- more_set_headers 'Content-Type application/json';
- more_set_headers 'Access-Control-Allow-Origin *';
- return 200 '${builtins.toJSON { "m.homeserver".base_url = "https://pcpoc.rory.gay"; }}';
- '';
- locations."= /.well-known/matrix/support".extraConfig = ''
- more_set_headers 'Content-Type application/json';
- more_set_headers 'Access-Control-Allow-Origin *';
- return 200 '${
- builtins.toJSON {
- admins = [
- {
- matrix_id = "@emma:rory.gay";
- role = "admin";
- }
- {
- matrix_id = "@alicia:rory.gay";
- role = "admin";
- }
- {
- matrix_id = "@root:rory.gay";
- role = "admin";
- }
- {
- matrix_id = "@rory:rory.gay";
- role = "admin";
- }
- ];
- }
- }';
- '';
- };
- };
- };
- };
- systemd.services.nginx.serviceConfig = {
- LimitNOFILE = 5000000;
- };
- security.acme.acceptTerms = true;
- security.acme.defaults.email = "root@rory.gay";
-
-}
diff --git a/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/pantalaimon.nix b/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/pantalaimon.nix
deleted file mode 100755
index 335176f..0000000
--- a/host/Rory-nginx/services/containers/pluralcontactbotpoc/services/pantalaimon.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{ ... }:
-
-{
- services.pantalaimon-headless = {
- instances."localhost" = {
- homeserver = "http://localhost:6167";
- ssl = false;
- extraSettings = {
- "DropOldKeys" = true;
- "UseKeyring" = false;
- };
- };
- };
-
-}
diff --git a/host/Rory-nginx/services/matrix/grapevine.nix b/host/Rory-nginx/services/matrix/grapevine.nix
index c73b48c..7368c2a 100755
--- a/host/Rory-nginx/services/matrix/grapevine.nix
+++ b/host/Rory-nginx/services/matrix/grapevine.nix
@@ -7,6 +7,7 @@
conduit_compat = true;
server_name = "conduit.rory.gay";
#trusted_servers = [ "rory.gay" ];
+ federation.self_test = false;
listen = [
{
diff --git a/host/Rory-nginx/services/matrix/synapse/caches.nix b/host/Rory-nginx/services/matrix/synapse/caches.nix
index 9fa735e..f00c78c 100644
--- a/host/Rory-nginx/services/matrix/synapse/caches.nix
+++ b/host/Rory-nginx/services/matrix/synapse/caches.nix
@@ -6,6 +6,7 @@
];
gc_thresholds = [
10000
+
5000
2500
];
diff --git a/host/Rory-nginx/services/matrix/synapse/synapse-main.nix b/host/Rory-nginx/services/matrix/synapse/synapse-main.nix
index c823846..02456df 100755
--- a/host/Rory-nginx/services/matrix/synapse/synapse-main.nix
+++ b/host/Rory-nginx/services/matrix/synapse/synapse-main.nix
@@ -75,7 +75,7 @@
max_long_retry_delay = "30s";
# rapid retry, small increments
- destination_min_retry_interval = "5m"; # default=10m
+ destination_min_retry_interval = "1m"; # default=10m
destination_max_retry_interval = "12h"; # default=7d
destination_retry_multiplier = 1.2; # default=2
};
@@ -195,17 +195,23 @@
after = [ "network.target" ];
script = ''
-
+ set -e -x -o pipefail
+ echo "Starting key generation"
if [ ! -f "registration_shared_secret.txt" ]
then
- cat /dev/urandom | tr -dc a-zA-Z0-9 | fold -w 256 | head -n 1 > registration_shared_secret.txt
+ echo "Generating new key"
+ strace cat /dev/urandom | tr -dc a-zA-Z0-9 | fold -w 256 | head -n 1 > registration_shared_secret.txt
+ echo "Key generation complete"
else
- echo Not generating key, key exists;
- fi'';
+ echo "Not generating key, key exists"
+ fi
+ echo "Script complete"
+ '';
serviceConfig = {
User = "matrix-synapse";
Group = "matrix-synapse";
WorkingDirectory = "/var/lib/matrix-synapse";
+ RemainAfterExit = true;
};
};
diff --git a/host/Rory-nginx/services/ollama.nix b/host/Rory-nginx/services/ollama.nix
deleted file mode 100755
index 16f4e1c..0000000
--- a/host/Rory-nginx/services/ollama.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{ ... }:
-
-{
- # systemd.tmpfiles.rules = [ "d /data/ollama 0750 ostgres postgres" ];
-
- services.ollama = {
- enable = true;
- home = "/data/ollama/home";
- models = "/data/ollama/home/models";
- environmentVariables = {
- OLLAMA_LLM_LIBRARY = "cpu_avx2";
- };
- #listenAddress = "0.0.0.0:11434";
- host = "0.0.0.0";
- port = 11434;
- user = "ollama";
- group = "ollama";
- };
-}
diff --git a/host/Rory-nginx/services/redpanda/root.nix b/host/Rory-nginx/services/redpanda/root.nix
deleted file mode 100644
index ef169a6..0000000
--- a/host/Rory-nginx/services/redpanda/root.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ ... }:
-{
- imports = [
- ./systemd-services.nix
- ];
-
- services.redpanda-connect = {
- enable = true;
- };
-}
diff --git a/host/Rory-nginx/services/redpanda/systemd-services.nix b/host/Rory-nginx/services/redpanda/systemd-services.nix
deleted file mode 100644
index c75a5be..0000000
--- a/host/Rory-nginx/services/redpanda/systemd-services.nix
+++ /dev/null
@@ -1,109 +0,0 @@
-{ pkgs, lib, ... }:
-{
- services.redpanda-connect.pipelines.systemd-services = {
- enable = true;
- allowSudo = true;
- config = {
- http = {
- enabled = true;
- address = "127.0.0.1:5100";
- };
- input = {
- label = "";
- subprocess = {
- name = "${pkgs.systemd}/bin/systemctl";
- args = [
- "-ojson"
- "--recursive"
- ];
- restart_on_exit = true;
- max_buffer = 1024 * 512;
- };
- };
- pipeline = {
- processors = [
- { unarchive.format = "json_array"; }
- {
- mapping = ''
- root = this
- if this.load == "loaded" {
- root.loaded_value = 1.0
- } else {
- root.loaded_value = 0.0
- }
- if this.active == "active" {
- root.active_value = 1.0
- } else if this.active == "activating" {
- root.active_value = 0.5
- } else {
- root.active_value = 0.0
- }
- if this.sub == "active" {
- root.sub_value = 1.0
- } else if this.sub == "auto-restart" {
- root.sub_value = 0.5
- } else {
- root.sub_value = 0.0
- }
- '';
- }
- {
- metric = {
- name = "systemd_service_status";
- type = "gauge";
- value = "\${!json(\"loaded_value\")}";
- labels = {
- field = "load";
- service = "\${!json(\"unit\")}";
- description = "\${!json(\"description\")}";
- };
- };
- }
- {
- metric = {
- name = "systemd_service_status";
- type = "gauge";
- value = "\${!json(\"active_value\")}";
- labels = {
- field = "active";
- service = "\${!json(\"unit\")}";
- description = "\${!json(\"description\")}";
- };
- };
- }
- {
- metric = {
- name = "systemd_service_status";
- type = "gauge";
- value = "\${!json(\"sub_value\")}";
- labels = {
- field = "sub";
- service = "\${!json(\"unit\")}";
- description = "\${!json(\"description\")}";
- };
- };
- }
- {
- sleep.duration = "5s";
- }
- ];
- };
- metrics.prometheus = { };
- output.drop = { };
- };
- };
-
- services.prometheus.scrapeConfigs = [
- {
- job_name = "redpanda-connect";
- scrape_interval = "5s";
- static_configs = [
- {
- targets = [ "localhost:5100" ];
- labels.instance = "redpanda-connect";
- }
- ];
- metrics_path = "/metrics";
- }
- ];
-}
diff --git a/modules/base.nix b/modules/base.nix
index d6f9aae..f2f8f57 100755
--- a/modules/base.nix
+++ b/modules/base.nix
@@ -170,5 +170,16 @@
polkit.enable = true;
sudo.wheelNeedsPassword = false;
};
-
+ virtualisation.vmVariant = {
+ services.getty.autologinUser = "root";
+ virtualisation = {
+ memorySize = 4096;
+ cores = 6;
+ msize = 1*1024*1024;
+ bios = pkgs.qboot;
+ };
+
+ monitoring.monitorAll = lib.mkForce false;
+ services.promtail.enable = lib.mkForce false;
+ };
}
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/shared-stream-writer.nix b/modules/software-templates/synapse-workers/generic.nix
index 72ba834..5e540b3 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/shared-stream-writer.nix
+++ b/modules/software-templates/synapse-workers/generic.nix
@@ -2,19 +2,27 @@
let
cfg = config.services.matrix-synapse;
+ workerLib = import ../lib.nix;
dbGroup = "medium";
- streamWriterType = "shared"; # unused, from template
- workers = lib.range 0 (cfg.presenceStreamWriters - 1);
- workerName = "shared_stream_writer";
- workerRoutes = {
- client = [ ];
- federation = [ ];
- media = [ ];
- };
+# streamWriterType = "account_data";
+ workers = lib.range 0 (cfg.accountDataStreamWriters - 1);
+ workerName = "account_data_stream_writer";
+ tasks = [ "stream_account_data" ];
+ workerRoutes = workerLib.workerRoutes.accountData;
+in
+let
enabledResources = lib.attrNames workerRoutes;
+ streamTypes = []
+ ++ lib.optional (lib.elem "stream_account_data" tasks) "account_data"
+ ++ lib.optional (lib.elem "stream_presence" tasks) "presence"
+ ++ lib.optional (lib.elem "stream_push_rules" tasks) "push_rules"
+ ++ lib.optional (lib.elem "stream_to_device" tasks) "to_device"
+ ++ lib.optional (lib.elem "stream_typing" tasks) "typing"
+ ++ lib.optional (lib.elem "stream_receipts" tasks) "receipts"
+ ++ lib.optional (lib.elem "stream_events" tasks) "events";
in
{
- config = lib.mkIf (cfg.sharedStreamWriters > 0) {
+ config = lib.mkIf (cfg.accountDataStreamWriters > 0) {
monitoring.synapse.workerNames = lib.map (index: "${workerName}-${toString index}") workers;
services.matrix-synapse = {
settings = {
@@ -27,13 +35,15 @@ in
}) workers
);
- stream_writers.account_data = lib.map (index: "${workerName}-${toString index}") workers;
- stream_writers.events = lib.map (index: "${workerName}-${toString index}") workers;
- stream_writers.presence = lib.map (index: "${workerName}-${toString index}") workers;
- stream_writers.push_rules = lib.map (index: "${workerName}-${toString index}") workers;
- stream_writers.receipts = lib.map (index: "${workerName}-${toString index}") workers;
- stream_writers.to_device = lib.map (index: "${workerName}-${toString index}") workers;
- stream_writers.typing = lib.map (index: "${workerName}-${toString index}") workers;
+ #stream_writers.${streamWriterType} = lib.map (index: "${workerName}-${toString index}") workers;
+# stream_writers = lib.listToA
+ # map `streams` to `workers`
+ stream_writers = lib.listToAttrs (
+ lib.map (stream: {
+ name = stream;
+ value = lib.map (index: "${workerName}-${toString index}") workers;
+ }) streamTypes
+ );
};
workers = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/auth.nix b/modules/software-templates/synapse-workers/generic/auth.nix
index 3a4a697..e4bde12 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/auth.nix
+++ b/modules/software-templates/synapse-workers/generic/auth.nix
@@ -6,6 +6,7 @@ let
dbGroup = "solo";
workers = lib.range 0 (cfg.authWorkers - 1);
workerName = "auth";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.auth;
enabledResources = lib.attrNames workerRoutes;
in
@@ -22,6 +23,9 @@ in
};
}) workers
);
+
+ media_instance_running_background_jobs = lib.mkIf (lib.elem "media_repo_background" tasks) "${workerName}";
+ enable_media_repo = lib.mkIf (lib.elem "media_repo" tasks) false;
};
workers = lib.listToAttrs (
@@ -94,6 +98,7 @@ in
value = {
proxyPass = "http://${workerName}-${type}";
extraConfig = ''
+ client_max_body_size 512M;
proxy_http_version 1.1;
proxy_set_header Connection "";
'';
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix b/modules/software-templates/synapse-workers/generic/client-reader.nix
index 758d6de..48de092 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/client-reader.nix
+++ b/modules/software-templates/synapse-workers/generic/client-reader.nix
@@ -6,6 +6,7 @@ let
dbGroup = "medium";
workers = lib.range 0 (cfg.clientReaders - 1);
workerName = "client_reader";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.clientReader;
enabledResources = lib.attrNames workerRoutes;
in
@@ -22,6 +23,9 @@ in
};
}) workers
);
+
+ media_instance_running_background_jobs = lib.mkIf (lib.elem "media_repo_background" tasks) "${workerName}";
+ enable_media_repo = lib.mkIf (lib.elem "media_repo" tasks) false;
};
workers = lib.listToAttrs (
@@ -94,6 +98,7 @@ in
value = {
proxyPass = "http://${workerName}-${type}";
extraConfig = ''
+ client_max_body_size 512M;
proxy_http_version 1.1;
proxy_set_header Connection "";
'';
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/event-creator.nix b/modules/software-templates/synapse-workers/generic/event-creator.nix
index c9c084d..c29d5e0 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/event-creator.nix
+++ b/modules/software-templates/synapse-workers/generic/event-creator.nix
@@ -6,6 +6,7 @@ let
dbGroup = "medium";
workers = lib.range 0 (cfg.eventCreators - 1);
workerName = "event_creator";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.eventCreator;
enabledResources = lib.attrNames workerRoutes;
in
@@ -22,6 +23,9 @@ in
};
}) workers
);
+
+ media_instance_running_background_jobs = lib.mkIf (lib.elem "media_repo_background" tasks) "${workerName}";
+ enable_media_repo = lib.mkIf (lib.elem "media_repo" tasks) false;
};
workers = lib.listToAttrs (
@@ -94,6 +98,7 @@ in
value = {
proxyPass = "http://${workerName}-${type}";
extraConfig = ''
+ client_max_body_size 512M;
proxy_http_version 1.1;
proxy_set_header Connection "";
'';
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix b/modules/software-templates/synapse-workers/generic/federation-inbound.nix
index 6997764..0e118ef 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/federation-inbound.nix
+++ b/modules/software-templates/synapse-workers/generic/federation-inbound.nix
@@ -6,6 +6,7 @@ let
dbGroup = "medium";
workers = lib.range 0 (cfg.federationReaders - 1);
workerName = "federation_inbound";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.federationInbound;
enabledResources = lib.attrNames workerRoutes;
in
@@ -22,6 +23,9 @@ in
};
}) workers
);
+
+ media_instance_running_background_jobs = lib.mkIf (lib.elem "media_repo_background" tasks) "${workerName}";
+ enable_media_repo = lib.mkIf (lib.elem "media_repo" tasks) false;
};
workers = lib.listToAttrs (
@@ -94,6 +98,7 @@ in
value = {
proxyPass = "http://${workerName}-${type}";
extraConfig = ''
+ client_max_body_size 512M;
proxy_http_version 1.1;
proxy_set_header Connection "";
'';
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix b/modules/software-templates/synapse-workers/generic/federation-reader.nix
index f231822..fb2fb20 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/federation-reader.nix
+++ b/modules/software-templates/synapse-workers/generic/federation-reader.nix
@@ -6,6 +6,7 @@ let
dbGroup = "medium";
workers = lib.range 0 (cfg.federationReaders - 1);
workerName = "federation_reader";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.federationReader;
enabledResources = lib.attrNames workerRoutes;
in
@@ -22,6 +23,9 @@ in
};
}) workers
);
+
+ media_instance_running_background_jobs = lib.mkIf (lib.elem "media_repo_background" tasks) "${workerName}";
+ enable_media_repo = lib.mkIf (lib.elem "media_repo" tasks) false;
};
workers = lib.listToAttrs (
@@ -94,6 +98,7 @@ in
value = {
proxyPass = "http://${workerName}-${type}";
extraConfig = ''
+ client_max_body_size 512M;
proxy_http_version 1.1;
proxy_set_header Connection "";
'';
@@ -102,14 +107,6 @@ in
)
)
);
-
- #virtualHosts."${cfg.nginxVirtualHostName}".locations."~ ^/_matrix/federation/(v1|v2)/invite/" = {
- # proxyPass = "http://${workerName}-federation";
- # extraConfig = ''
- # proxy_http_version 1.1;
- # proxy_set_header Connection "";
- # '';
- #};
};
};
}
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix b/modules/software-templates/synapse-workers/generic/federation-sender.nix
index 1cedcbb..6d29ae5 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/federation-sender.nix
+++ b/modules/software-templates/synapse-workers/generic/federation-sender.nix
@@ -4,6 +4,7 @@ let
dbGroup = "medium";
workers = lib.range 0 (cfg.federationSenders - 1);
workerName = "federation_sender";
+ tasks = [ ];
workerRoutes = {};
enabledResources = lib.attrNames workerRoutes;
in
@@ -20,10 +21,19 @@ in
};
}) workers
);
- send_federation = false;
- federation_sender_instances = lib.map (index: "${workerName}-${toString index}") workers;
- outbound_federation_restricted_to = lib.map (index: "${workerName}-${toString index}") workers;
+
+ # Federation sender
+ send_federation = lib.mkIf (lib.elem "federation_sender" tasks) false;
+ federation_sender_instances = lib.mkIf (lib.elem "federation_sender" tasks) [ workerName ];
+ outbound_federation_restricted_to = lib.mkIf (lib.elem "federation_sender" tasks) [ workerName ];
worker_replication_secret = "${workerName}_secret";
+
+ # Pusher
+ pusher_instances = lib.optional (lib.elem "pusher" tasks) "${workerName}";
+
+ # Media repo
+ media_instance_running_background_jobs = lib.mkIf (lib.elem "media_repo_background" tasks) "${workerName}";
+ enable_media_repo = lib.mkIf (lib.elem "media_repo" tasks) false;
};
workers = lib.listToAttrs (
@@ -61,10 +71,21 @@ in
workerName = "${workerName}-${toString index}";
}
);
+
+ # Media repo
+ enable_media_repo = lib.elem "media_repo" tasks;
+ rc_federation = {
+ window_size = 1;
+ sleep_limit = 1000;
+ sleep_delay = 1;
+ reject_limit = 1000;
+ concurrent = 100;
+ };
};
}) workers
);
};
+
services.nginx = {
upstreams = lib.listToAttrs (
lib.map (type: {
@@ -95,6 +116,7 @@ in
value = {
proxyPass = "http://${workerName}-${type}";
extraConfig = ''
+ client_max_body_size 512M;
proxy_http_version 1.1;
proxy_set_header Connection "";
'';
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/media-repo.nix b/modules/software-templates/synapse-workers/generic/media-repo.nix
index 46fd353..af0d7b5 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/media-repo.nix
+++ b/modules/software-templates/synapse-workers/generic/media-repo.nix
@@ -6,6 +6,7 @@ let
dbGroup = "solo";
workers = lib.range 0 (cfg.mediaRepoWorkers - 1);
workerName = "media_repo";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.mediaRepo;
enabledResources = lib.attrNames workerRoutes;
in
@@ -23,8 +24,8 @@ in
}) workers
);
- media_instance_running_background_jobs = "${workerName}-0";
- enable_media_repo = false;
+ media_instance_running_background_jobs = lib.mkIf (lib.elem "media_repo_background" tasks) "${workerName}";
+ enable_media_repo = lib.mkIf (lib.elem "media_repo" tasks) false;
};
workers = lib.listToAttrs (
@@ -62,14 +63,6 @@ in
workerName = "${workerName}-${toString index}";
}
);
- enable_media_repo = true;
- rc_federation = {
- window_size = 1;
- sleep_limit = 1000;
- sleep_delay = 1;
- reject_limit = 1000;
- concurrent = 100;
- };
};
}) workers
);
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/pusher.nix b/modules/software-templates/synapse-workers/generic/pusher.nix
index 5267838..b496edb 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/pusher.nix
+++ b/modules/software-templates/synapse-workers/generic/pusher.nix
@@ -4,6 +4,7 @@ let
dbGroup = "small";
workers = lib.range 0 (cfg.pushers - 1);
workerName = "pusher";
+ tasks = [ ];
workerRoutes = {};
enabledResources = lib.attrNames workerRoutes;
in
@@ -14,14 +15,16 @@ in
settings = {
instance_map = lib.listToAttrs (
lib.map (index: {
- name = "pusher-${toString index}";
+ name = "${workerName}-${toString index}";
value = {
path = "/run/matrix-synapse/${workerName}-${toString index}.sock";
};
}) workers
);
- pusher_instances = lib.map (index: "${workerName}-${toString index}") workers;
+ pusher_instances = lib.mkIf (lib.elem "pusher" tasks) "${workerName}";
+ media_instance_running_background_jobs = lib.mkIf (lib.elem "media_repo_background" tasks) "${workerName}";
+ enable_media_repo = lib.mkIf (lib.elem "media_repo" tasks) false;
};
workers = lib.listToAttrs (
@@ -94,6 +97,7 @@ in
value = {
proxyPass = "http://${workerName}-${type}";
extraConfig = ''
+ client_max_body_size 512M;
proxy_http_version 1.1;
proxy_set_header Connection "";
'';
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/sync.nix b/modules/software-templates/synapse-workers/generic/sync.nix
index 6a64a7e..6ababee 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/sync.nix
+++ b/modules/software-templates/synapse-workers/generic/sync.nix
@@ -6,6 +6,7 @@ let
dbGroup = "medium";
workers = lib.range 0 (cfg.syncWorkers - 1);
workerName = "sync";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.sync;
enabledResources = lib.attrNames workerRoutes;
in
@@ -22,6 +23,9 @@ in
};
}) workers
);
+
+ media_instance_running_background_jobs = lib.mkIf (lib.elem "media_repo_background" tasks) "${workerName}";
+ enable_media_repo = lib.mkIf (lib.elem "media_repo" tasks) false;
};
workers = lib.listToAttrs (
@@ -94,6 +98,7 @@ in
value = {
proxyPass = "http://${workerName}-${type}";
extraConfig = ''
+ client_max_body_size 512M;
proxy_http_version 1.1;
proxy_set_header Connection "";
'';
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/lib.nix b/modules/software-templates/synapse-workers/lib.nix
index c99e2ef..c99e2ef 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/lib.nix
+++ b/modules/software-templates/synapse-workers/lib.nix
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/module.nix b/modules/software-templates/synapse-workers/module.nix
index 3b6456b..5a40045 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/module.nix
+++ b/modules/software-templates/synapse-workers/module.nix
@@ -85,15 +85,15 @@ in
# Stream types and count limitations: https://github.com/element-hq/synapse/blob/develop/synapse/config/workers.py#L344
{
- assertion = cfg.typingStreamWriters <= 1;
+ assertion = lib.length cfg.settings.stream_writers.typing <= 1;
message = "Only one typing stream writer is supported";
}
{
- assertion = cfg.toDeviceStreamWriters <= 1;
+ assertion = lib.length cfg.settings.stream_writers.to_device <= 1;
message = "Only one to_device stream writer is supported";
}
{
- assertion = cfg.accountDataStreamWriters <= 1;
+ assertion = lib.length cfg.settings.stream_writers.account_data <= 1;
message = "Only one account data stream writer is supported";
}
# This may be outdated in the documentation...?
@@ -102,18 +102,13 @@ in
# message = "Only one receipt stream writer is supported";
#}
{
- assertion = cfg.presenceStreamWriters <= 1;
+ assertion = lib.length cfg.settings.stream_writers.presence <= 1;
message = "Only one presence stream writer is supported";
}
{
- assertion = cfg.pushRuleStreamWriters <= 1;
+ assertion = lib.length cfg.settings.stream_writers.push_rules <= 1;
message = "Only one push rule stream writer is supported";
}
-
- {
- assertion = cfg.sharedStreamWriters <= 1;
- message = "Only one shared stream writer is supported";
- }
];
# Matrix utility maps
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/single/appservice.nix b/modules/software-templates/synapse-workers/single/appservice.nix
index 03a080b..03a080b 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/single/appservice.nix
+++ b/modules/software-templates/synapse-workers/single/appservice.nix
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix b/modules/software-templates/synapse-workers/single/background.nix
index 741b88c..741b88c 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/single/background.nix
+++ b/modules/software-templates/synapse-workers/single/background.nix
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/single/user-dir.nix b/modules/software-templates/synapse-workers/single/user-dir.nix
index 97ddf26..97ddf26 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/single/user-dir.nix
+++ b/modules/software-templates/synapse-workers/single/user-dir.nix
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/account_data-stream-writer.nix b/modules/software-templates/synapse-workers/stream-writers/account_data-stream-writer.nix
index b1cc986..5e540b3 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/account_data-stream-writer.nix
+++ b/modules/software-templates/synapse-workers/stream-writers/account_data-stream-writer.nix
@@ -4,11 +4,22 @@ let
cfg = config.services.matrix-synapse;
workerLib = import ../lib.nix;
dbGroup = "medium";
- streamWriterType = "account_data";
+# streamWriterType = "account_data";
workers = lib.range 0 (cfg.accountDataStreamWriters - 1);
workerName = "account_data_stream_writer";
+ tasks = [ "stream_account_data" ];
workerRoutes = workerLib.workerRoutes.accountData;
+in
+let
enabledResources = lib.attrNames workerRoutes;
+ streamTypes = []
+ ++ lib.optional (lib.elem "stream_account_data" tasks) "account_data"
+ ++ lib.optional (lib.elem "stream_presence" tasks) "presence"
+ ++ lib.optional (lib.elem "stream_push_rules" tasks) "push_rules"
+ ++ lib.optional (lib.elem "stream_to_device" tasks) "to_device"
+ ++ lib.optional (lib.elem "stream_typing" tasks) "typing"
+ ++ lib.optional (lib.elem "stream_receipts" tasks) "receipts"
+ ++ lib.optional (lib.elem "stream_events" tasks) "events";
in
{
config = lib.mkIf (cfg.accountDataStreamWriters > 0) {
@@ -24,7 +35,15 @@ in
}) workers
);
- stream_writers.${streamWriterType} = lib.map (index: "${workerName}-${toString index}") workers;
+ #stream_writers.${streamWriterType} = lib.map (index: "${workerName}-${toString index}") workers;
+# stream_writers = lib.listToA
+ # map `streams` to `workers`
+ stream_writers = lib.listToAttrs (
+ lib.map (stream: {
+ name = stream;
+ value = lib.map (index: "${workerName}-${toString index}") workers;
+ }) streamTypes
+ );
};
workers = lib.listToAttrs (
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix b/modules/software-templates/synapse-workers/stream-writers/event-stream-writer.nix
index 1459d6b..7160902 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/event-stream-writer.nix
+++ b/modules/software-templates/synapse-workers/stream-writers/event-stream-writer.nix
@@ -6,6 +6,7 @@ let
streamWriterType = "events";
workers = lib.range 0 (cfg.eventStreamWriters - 1);
workerName = "event_stream_writer";
+ tasks = [ ];
workerRoutes = {};
enabledResources = [];
in
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/presence-stream-writer.nix b/modules/software-templates/synapse-workers/stream-writers/presence-stream-writer.nix
index a417ce5..7121e30 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/presence-stream-writer.nix
+++ b/modules/software-templates/synapse-workers/stream-writers/presence-stream-writer.nix
@@ -7,6 +7,7 @@ let
streamWriterType = "presence";
workers = lib.range 0 (cfg.presenceStreamWriters - 1);
workerName = "presence_stream_writer";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.presence;
enabledResources = lib.attrNames workerRoutes;
in
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/push_rule-stream-writer.nix b/modules/software-templates/synapse-workers/stream-writers/push_rule-stream-writer.nix
index f5210b2..420c3b5 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/push_rule-stream-writer.nix
+++ b/modules/software-templates/synapse-workers/stream-writers/push_rule-stream-writer.nix
@@ -7,6 +7,7 @@ let
streamWriterType = "push_rules";
workers = lib.range 0 (cfg.pushRuleStreamWriters - 1);
workerName = "push_rule_stream_writer";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.pushRules;
enabledResources = lib.attrNames workerRoutes;
in
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/receipt-stream-writer.nix b/modules/software-templates/synapse-workers/stream-writers/receipt-stream-writer.nix
index 3ef84dc..53df3f6 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/receipt-stream-writer.nix
+++ b/modules/software-templates/synapse-workers/stream-writers/receipt-stream-writer.nix
@@ -7,6 +7,7 @@ let
streamWriterType = "receipts";
workers = lib.range 0 (cfg.receiptStreamWriters - 1);
workerName = "receipts_stream_writer";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.receipts;
enabledResources = lib.attrNames workerRoutes;
in
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/to_device-stream-writer.nix b/modules/software-templates/synapse-workers/stream-writers/to_device-stream-writer.nix
index bc32e0a..8e1e613 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/to_device-stream-writer.nix
+++ b/modules/software-templates/synapse-workers/stream-writers/to_device-stream-writer.nix
@@ -7,6 +7,7 @@ let
streamWriterType = "to_device";
workers = lib.range 0 (cfg.toDeviceStreamWriters - 1);
workerName = "to_device_stream_writer";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.toDevice;
enabledResources = lib.attrNames workerRoutes;
in
diff --git a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/typing-stream-writer.nix b/modules/software-templates/synapse-workers/stream-writers/typing-stream-writer.nix
index a57d0d8..9f57a3b 100644
--- a/host/Rory-nginx/services/matrix/synapse/workers/stream-writers/typing-stream-writer.nix
+++ b/modules/software-templates/synapse-workers/stream-writers/typing-stream-writer.nix
@@ -7,6 +7,7 @@ let
streamWriterType = "typing";
workers = lib.range 0 (cfg.typingStreamWriters - 1);
workerName = "typing_stream_writer";
+ tasks = [ ];
workerRoutes = workerLib.workerRoutes.typing;
enabledResources = lib.attrNames workerRoutes;
in
|