This commit is contained in:
2026-02-12 23:28:57 -07:00
parent 52128d71f5
commit 8d32571c6e
3 changed files with 55 additions and 113 deletions

View File

@@ -2,27 +2,18 @@
let
serverName = "atri.dad";
matrixDomain = "chat.atri.dad";
matrixDomain = "matrix.atri.dad";
# .well-known/matrix/client JSON
# .well-known/matrix/server JSON (served from atri.dad for delegation)
wellKnownServer = builtins.toJSON {
"m.server" = "${matrixDomain}:443";
};
# .well-known/matrix/client JSON (served from atri.dad for delegation)
wellKnownClient = builtins.toJSON {
"m.homeserver" = {
base_url = "https://${matrixDomain}";
};
"org.matrix.msc3575.proxy" = {
url = "https://${matrixDomain}";
};
"org.matrix.msc4143.rtc_foci" = [
{
type = "livekit";
livekit_service_url = "https://${matrixDomain}/livekit/jwt";
}
];
};
# .well-known/matrix/server JSON
wellKnownServer = builtins.toJSON {
"m.server" = "${matrixDomain}:443";
};
in
{
@@ -383,54 +374,36 @@ in
};
# Matrix
"chat.atri.dad" = {
"matrix.atri.dad" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://[::1]:8008";
proxyPass = "http://[::1]:6167";
proxyWebsockets = true;
extraConfig = ''
client_max_body_size 100M;
'';
};
locations."^~ /livekit/jwt/" = {
priority = 400;
proxyPass = "http://[::1]:${toString config.services.lk-jwt-service.port}/";
};
locations."^~ /livekit/sfu/" = {
priority = 400;
proxyPass = "http://[::1]:${toString config.services.livekit.settings.port}/";
proxyWebsockets = true;
extraConfig = ''
proxy_send_timeout 120;
proxy_read_timeout 120;
proxy_buffering off;
proxy_set_header Accept-Encoding gzip;
'';
};
locations."= /.well-known/matrix/server" = {
extraConfig = ''
default_type application/json;
return 200 '${wellKnownServer}';
'';
};
locations."= /.well-known/matrix/client" = {
extraConfig = ''
default_type application/json;
add_header Access-Control-Allow-Origin "*";
return 200 '${wellKnownClient}';
'';
};
};
# LiveKit WebRTC signaling domain
# LiveKit WebRTC signaling domain (MatrixRTC)
"matrixrtc.atri.dad" = {
enableACME = true;
forceSSL = true;
# lk-jwt-service
locations."~ ^(/sfu/get|/healthz)" = {
priority = 400;
proxyPass = "http://[::1]:${toString config.services.lk-jwt-service.port}";
extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
'';
};
# livekit
locations."/" = {
proxyPass = "http://[::1]:${toString config.services.livekit.settings.port}";
proxyWebsockets = true;