aboutsummaryrefslogtreecommitdiff
path: root/modules/services/web
diff options
context:
space:
mode:
authortdback <tyler@tdback.net>2025-01-18 11:25:39 -0500
committertdback <tyler@tdback.net>2025-01-18 11:25:39 -0500
commitd24a1993ee0cb597452d56594cf5cddc20c9b610 (patch)
treea419b687fe1733c278072fcd4c2c7518cc93c27a /modules/services/web
parent36856800c78bb200f2194280a59fa18e849c873a (diff)
feat: add matrix service. have thor server handle delegation requests
Diffstat (limited to 'modules/services/web')
-rw-r--r--modules/services/web/default.nix39
1 files changed, 32 insertions, 7 deletions
diff --git a/modules/services/web/default.nix b/modules/services/web/default.nix
index b6a45af..fe97c0e 100644
--- a/modules/services/web/default.nix
+++ b/modules/services/web/default.nix
@@ -1,10 +1,35 @@
-{ ... }:
+{ config, ... }:
+let
+ fqdn = "synapse.${config.networking.domain}";
+ baseUrl = "https://${fqdn}";
+in
{
- services.caddy.virtualHosts = {
- "tdback.net".extraConfig = ''
- root * /var/www/tdback.net/
- encode zstd gzip
- file_server
- '';
+ networking.domain = "tdback.net";
+ networking.firewall.allowedTCPPorts = [
+ 80
+ 443
+ ];
+
+ services.caddy = {
+ enable = true;
+ virtualHosts = {
+ ${config.networking.domain}.extraConfig = ''
+ handle /.well-known/matrix/server {
+ Content-Type application/json
+ Access-Control-Allow-Origin *
+ respond `{"m.server": "${fqdn}:443"}`
+ }
+
+ handle /.well-known/matrix/client {
+ Content-Type application/json
+ Access-Control-Allow-Origin *
+ respond `{"m.homeserver": {"base_url": "${baseUrl}"}}`
+ }
+
+ root * /var/www/tdback.net/
+ encode zstd gzip
+ file_server
+ '';
+ };
};
}