diff options
| author | Alejandro Soto <alejandro@34project.org> | 2024-08-13 03:23:15 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2024-08-13 03:28:19 -0600 |
| commit | c110570f008472958bd700d04f02fa3d1f9209fe (patch) | |
| tree | 6c8c64fedc6e8fc71d62b0cebfd13387caab02e9 /sys/web/sites | |
| parent | 81ab829ddcde926f6f4c5edd1cd19eca009a597b (diff) | |
sys/web/sites/matrix: enable sliding sync
Diffstat (limited to '')
| -rw-r--r-- | sys/web/sites/matrix.nix | 46 |
1 files changed, 16 insertions, 30 deletions
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; }; + }; }; - }; }; } |
