summary refs log tree commit diff stats
path: root/system/services/matrix/default.nix
diff options
context:
space:
mode:
authorsils <sils@sils.li>2023-10-14 15:28:05 +0200
committersils <sils@sils.li>2023-10-14 15:28:05 +0200
commit04e4866a17853d583c943b52ec2b9c5e7518e4ae (patch)
treebd079002dbebd4fffc533596c3f4e5a99a6b3a56 /system/services/matrix/default.nix
parentFix(system/services/etebase): Add proxy parameters (diff)
parentfix(system/services/mastodon): Correctly avoid string casts (diff)
downloadnixos-server-04e4866a17853d583c943b52ec2b9c5e7518e4ae.tar.gz
nixos-server-04e4866a17853d583c943b52ec2b9c5e7518e4ae.zip
Merge branch 'main' into etebase
Diffstat (limited to 'system/services/matrix/default.nix')
-rw-r--r--system/services/matrix/default.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/system/services/matrix/default.nix b/system/services/matrix/default.nix
index 62345a7..ed3b567 100644
--- a/system/services/matrix/default.nix
+++ b/system/services/matrix/default.nix
@@ -12,15 +12,27 @@
     return 200 '${builtins.toJSON data}';
   '';
 in {
+  imports = [
+    ./bridges/mautrix-whatsapp.nix
+  ];
+
   networking.firewall.allowedTCPPorts = [80 443];
 
   services.postgresql.enable = true;
   services.postgresql.initialScript = pkgs.writeText "synapse-init.sql" ''
+    --Matrix:
     CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'synapse';
     CREATE DATABASE "matrix-synapse" WITH OWNER "matrix-synapse"
       TEMPLATE template0
       LC_COLLATE = "C"
       LC_CTYPE = "C";
+
+    --Whatsapp-bridge:
+    CREATE ROLE "mautrix-whatsapp" WITH LOGIN PASSWORD 'whatsapp';
+    CREATE DATABASE "mautrix-whatsapp" WITH OWNER "mautrix-whatsapp"
+      TEMPLATE template0
+      LC_COLLATE = "C"
+      LC_CTYPE = "C";
   '';
 
   services.nginx = {
@@ -52,6 +64,29 @@ in {
     };
   };
 
+  services.mautrix-whatsapp = {
+    enable = true;
+    settings = {
+      appservice = {
+        database = {
+          type = "postgres";
+          uri = "postgres:///mautrix-whatsapp?host=/run/postgresql";
+        };
+        whatsapp = {
+          # TODO: See https://github.com/tulir/whatsmeow/blob/efc632c008604016ddde63bfcfca8de4e5304da9/binary/proto/def.proto#L43-L64 for a list.
+          # This also determints the whatsapp icon
+          browser_name = "unknown";
+        };
+      };
+      homeserver.address = "https://matrix.vhack.eu";
+      bridge.permissions = {
+        "@soispha:vhack.eu" = "admin";
+        "@sils:vhack.eu" = "admin";
+        "@nightingale:vhack.eu" = "admin";
+      };
+    };
+  };
+
   services.matrix-synapse = {
     enable = true;
     dataDir = "/var/lib/matrix";