summary refs log tree commit diff
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-03-16 16:54:09 +0100
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-03-16 16:54:09 +0100
commit2fd41f713fd79feaac5d760990f2585d15c3c0ad (patch)
tree79639bc24241c8cd9e1d16a071d346b3fdf718bc
parentfix syntax (diff)
downloadRory-Open-Architecture-2fd41f713fd79feaac5d760990f2585d15c3c0ad.tar.xz
add draupnir
-rwxr-xr-xhost/Rory-synapse/configuration.nix65
-rwxr-xr-xmodules/packages/draupnir-as-mjolnir.nix14
2 files changed, 78 insertions, 1 deletions
diff --git a/host/Rory-synapse/configuration.nix b/host/Rory-synapse/configuration.nix
index bee2233..3baf425 100755
--- a/host/Rory-synapse/configuration.nix
+++ b/host/Rory-synapse/configuration.nix
@@ -4,6 +4,7 @@
   imports =
     [
       ../../modules/base-server.nix
+      ../../modules/packages/draupnir-as-mjolnir.nix
     ];
 
   networking = {
@@ -90,10 +91,72 @@
 
   services.matrix-synapse = {
     enable = true;
+
+    settings = {
+      server_name = "rory.gay";
+
+      enable_registration = false;
+      registration_shared_secret = builtins.exec ["cat" "/dev/urandom" "|" "tr" "-dc" "a-zA-Z0-9" "|" "fold" "-w" "256" "|" "head" "-n" "1"];
+      
+      # Alicia - types: https://github.com/NixOS/nixpkgs/blob/release-22.11/nixos/modules/services/matrix/synapse.nix#L410
+
+      listeners = {
+        [
+          { port = 8008;
+            bind_addresses = [ "192.168.1.5" ];
+            type = "http";
+            tls = false;
+            x_forwarded = true;
+            resources = [ {
+              names = [ "client" "federation" ];
+              compress = true;
+            } ];
+          }
+        ];
+      };
+    };
+
+    plugins = with pkgs.matrix-synapse-plugins; [
+      matrix-synapse-mjolnir-antispam
+      matrix-synapse-pam
+    ];
+
+    dynamic_thumbnails = true;
+
+
+    presence = {
+      enable = true;
+      update_interval = 60;
+    };
+    url_preview_enabled = true;
+    
+
+    
+    database = {
+      name = "psycopg2";
+      args = {
+        user = "postgres";
+        passwordFile = "/run/secrets/matrix-synapse-password";
+        database = "matrix-synapse-rory-gay";
+        host = "192.168.1.3";
+      }
+    };
     app_service_config_files = [
       #"/etc/matrix-synapse/appservice-registration.yaml"
     ];
-    
+  };
+
+  services.mjolnir = {
+    enable = true;
+    pantalaimon = {
+      enable = true;
+      username = "mjolnir";
+      passwordFile = "/run/secrets/mjolnir-password";
+      homeserver = "http://localhost:8008";
+      
+    };
+
+    managementRoom = "#draupnir-mgmt:rory.gay";
   };
 
   system.stateVersion = "22.11"; # DO NOT EDIT!
diff --git a/modules/packages/draupnir-as-mjolnir.nix b/modules/packages/draupnir-as-mjolnir.nix
new file mode 100755
index 0000000..1dd31f4
--- /dev/null
+++ b/modules/packages/draupnir-as-mjolnir.nix
@@ -0,0 +1,14 @@
+{ pkgs, ... }:
+{
+  environment.systemPackages = with pkgs; [
+    (mjolnir.override {
+      version = "1.81.0";
+      src = fetchFromGithub {
+        owner = "Gnuxie";
+        repo = "Draupnir";
+        rev = "v1.81.0";
+        sha256 = lib.fakeSha256;
+      }
+    }
+  )];
+}