summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2024-08-13 03:23:15 -0600
committerAlejandro Soto <alejandro@34project.org>2024-08-13 03:28:19 -0600
commitc110570f008472958bd700d04f02fa3d1f9209fe (patch)
tree6c8c64fedc6e8fc71d62b0cebfd13387caab02e9
parent81ab829ddcde926f6f4c5edd1cd19eca009a597b (diff)
sys/web/sites/matrix: enable sliding sync
-rw-r--r--sys/conduit/default.nix6
-rw-r--r--sys/web/sites/matrix.nix46
2 files changed, 22 insertions, 30 deletions
diff --git a/sys/conduit/default.nix b/sys/conduit/default.nix
index 1d59469..597960b 100644
--- a/sys/conduit/default.nix
+++ b/sys/conduit/default.nix
@@ -2,6 +2,7 @@
with lib; let
cfg = config.local.conduit;
+ fqdn = config.local.domains.matrix.main;
inherit (config.local.domains.matrix.passthru) serverName;
in
{
@@ -38,6 +39,11 @@ in
enable_lightning_bolt = false;
allow_check_for_updates = true;
new_user_displayname_suffix = "";
+
+ well_known = {
+ client = "https://${fqdn}";
+ server = "${fqdn}:443";
+ };
};
};
};
diff --git a/sys/web/sites/matrix.nix b/sys/web/sites/matrix.nix
index ee2f773..5583b47 100644
--- a/sys/web/sites/matrix.nix
+++ b/sys/web/sites/matrix.nix
@@ -20,35 +20,21 @@ in
sites.portal.enable = true;
};
- services.nginx.virtualHosts = {
- ${domains.exdev.main}.locations =
- let
- serverConfig."m.server" = "${domains.matrix.main}:443";
- clientConfig."m.homeserver".base_url = "https://${domains.matrix.main}";
-
- mkWellKnown = data: ''
- default_type application/json;
- add_header Access-Control-Allow-Origin *;
- return 200 '${builtins.toJSON data}';
- '';
- in
- {
- "= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig;
- "= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig;
- };
-
- ${domains.matrix.main} = {
- forceSSL = true;
- useACMEHost = domains.matrix.main;
-
- locations =
- let
- proxyLocation =
- throwIf (hasSuffix "/" cfg.proxyUrl)
- "matrix site: a trailing slash *must not* be used here"
- cfg.proxyUrl;
- in
- {
+ services.nginx.virtualHosts =
+ let
+ proxyLocation =
+ throwIf (hasSuffix "/" cfg.proxyUrl)
+ "matrix site: a trailing slash *must not* be used here"
+ cfg.proxyUrl;
+ in
+ {
+ ${domains.exdev.main}.locations."/.well-known/matrix".proxyPass = proxyLocation;
+
+ ${domains.matrix.main} = {
+ forceSSL = true;
+ useACMEHost = domains.matrix.main;
+
+ locations = {
"/".extraConfig = ''
return 403;
'';
@@ -60,7 +46,7 @@ in
# Forward requests for e.g. SSO and password-resets.
"/_synapse/client".proxyPass = proxyLocation;
};
+ };
};
- };
};
}