2024-07-30 15:06:34 +01:00
|
|
|
{ ... }:
|
|
|
|
let
|
2024-06-10 07:42:56 +01:00
|
|
|
baseUrl = "xenia.me.uk";
|
|
|
|
port = 8008;
|
2024-07-30 15:06:34 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
imports = [ ./caddy.nix ];
|
2024-06-10 07:42:56 +01:00
|
|
|
services = {
|
|
|
|
matrix-synapse = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
server_name = baseUrl;
|
|
|
|
public_baseurl = baseUrl;
|
|
|
|
listeners = [
|
|
|
|
{
|
|
|
|
inherit port;
|
2024-07-30 15:06:34 +01:00
|
|
|
bind_addresses = [
|
|
|
|
"127.0.0.1"
|
|
|
|
"::1"
|
|
|
|
];
|
2024-06-10 07:42:56 +01:00
|
|
|
type = "http";
|
|
|
|
tls = false;
|
|
|
|
x_forwarded = true;
|
|
|
|
resources = [
|
|
|
|
{
|
2024-07-30 15:06:34 +01:00
|
|
|
names = [
|
|
|
|
"client"
|
|
|
|
"federation"
|
|
|
|
];
|
2024-06-10 07:42:56 +01:00
|
|
|
compress = true;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-07-30 15:06:34 +01:00
|
|
|
extraConfigFiles = [ "/run/secrets/matrix-shared-secret" ];
|
2024-06-10 07:42:56 +01:00
|
|
|
};
|
|
|
|
caddy.virtualHosts."xenia.me.uk".extraConfig = ''
|
|
|
|
header /.well-known/matrix/* Content-Type application/json
|
|
|
|
header /.well-known/matrix/* Access-Control-Allow-Origin *
|
|
|
|
respond /.well-known/matrix/server `{"m.server": "matrix.${baseUrl}:443"}`
|
|
|
|
respond /.well-known/matrix/client `{"m.homeserver":{"base_url":"https://matrix.${baseUrl}"}}`
|
|
|
|
'';
|
|
|
|
caddy.virtualHosts."matrix.xenia.me.uk".extraConfig = ''
|
|
|
|
reverse_proxy /_matrix/* localhost:${port}
|
|
|
|
reverse_proxy /_synapse/client/* localhost:${port}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|