ctucx.git: nixfiles

ctucx' nixfiles

commit 1e8bca78d09cc293ec2c7ae2c965784b3da85be2
parent f155b29458443f0a1eb2c5c2352d4b36be29e59b
Author: Leah (ctucx) <git@ctu.cx>
Date: Tue, 29 Oct 2024 21:28:26 +0100

machines/trabbi/matrix/synapse: serve well-known files on `ctu.cx` and `matrix.ctu.cx`
1 file changed, 16 insertions(+), 6 deletions(-)
M
machines/trabbi/matrix/synapse.nix
|
22
++++++++++++++++------
diff --git a/machines/trabbi/matrix/synapse.nix b/machines/trabbi/matrix/synapse.nix
@@ -77,12 +77,11 @@
 
     nginx = {
       enable       = true;
-      virtualHosts = {
-
-        "ctu.cx" = let
-          matrixServerConfig = { "m.server" = "matrix.ctu.cx:443"; };
-          matrixClientConfig = { "m.homeserver" = { "base_url" = "https://matrix.ctu.cx"; }; "org.matrix.msc3575.proxy" = { "url" = "https://matrix.ctu.cx"; }; };
-        in {
+      virtualHosts = let
+        matrixServerConfig = { "m.server" = "matrix.ctu.cx:443"; };
+        matrixClientConfig = { "m.homeserver" = { "base_url" = "https://matrix.ctu.cx"; }; "org.matrix.msc3575.proxy" = { "url" = "https://matrix.ctu.cx"; }; };
+      in {
+        "ctu.cx" = {
           enableACME = true;
           forceSSL   = true;
           kTLS       = true;

@@ -105,6 +104,17 @@
             "/_matrix/client/unstable/org.matrix.msc3575/".proxyPass = "http://[::1]:8009/_matrix/client/unstable/org.matrix.msc3575/";
 #            "/_synapse".proxyPass = "http://[::1]:8008";
 #            "/admin/".alias = "${pkgs.synapse-admin}/";
+
+            "/.well-known/matrix/server".extraConfig = ''
+              add_header Content-Type application/json;
+              return 200 '${builtins.toJSON matrixServerConfig}';
+            '';
+
+            "/.well-known/matrix/client".extraConfig = ''
+              add_header Content-Type application/json;
+              return 200 '${builtins.toJSON matrixClientConfig}';
+            '';
+
             "/"                  = {
               extraConfig        = ''
                 rewrite ^/config.json$ /config.json break;