summary refs log tree commit diff
path: root/host/Rory-synapse/configuration.nix
diff options
context:
space:
mode:
Diffstat (limited to 'host/Rory-synapse/configuration.nix')
-rwxr-xr-xhost/Rory-synapse/configuration.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/host/Rory-synapse/configuration.nix b/host/Rory-synapse/configuration.nix
index f65607f..a805e5f 100755
--- a/host/Rory-synapse/configuration.nix
+++ b/host/Rory-synapse/configuration.nix
@@ -97,12 +97,13 @@
       enable_registration = false;
       # Alicia - figure this out later...
       #registration_shared_secret = builtins.exec ["cat" "/dev/urandom" "|" "tr" "-dc" "a-zA-Z0-9" "|" "fold" "-w" "256" "|" "head" "-n" "1"];
+      registration_shared_secret_path = "/var/lib/matrix-synapse/registration_shared_secret.txt";
       
       # 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" ];
+          bind_addresses = [ "192.168.1.5" "127.0.0.1" ];
           type = "http";
           tls = false;
           x_forwarded = true;
@@ -172,6 +173,19 @@
   #  managementRoom = "#draupnir-mgmt:rory.gay";
   #};
 
+    systemd.services.matrix-synapse-reg-token = {
+      description = "Random registration token for Synapse.";
+      before = ["matrix-synapse.service"]; # So the registration can be used by Synapse
+      wantedBy = ["multi-user.target"];
+      after = ["network.target"];
+
+      script = ''cat /dev/urandom | tr -dc a-zA-Z0-9 | fold -w 256 | head -n 1 > registration_shared_secret.txt'';
+      serviceConfig = {
+        User = "matrix-synapse";
+        Group = "matrix-synapse";
+        WorkingDirectory = "/var/lib/matrix-synapse";
+      };
+    };
   system.stateVersion = "22.11"; # DO NOT EDIT!
 }