2026-04-24 21:38:57 +02:00
|
|
|
{config, ...}: let
|
|
|
|
|
# Tuwunel uses a list for ports
|
|
|
|
|
tuwunel-port = config.m3ta.ports.get "tuwunel";
|
|
|
|
|
in {
|
|
|
|
|
services.matrix-tuwunel = {
|
2026-04-06 18:44:07 +02:00
|
|
|
enable = true;
|
|
|
|
|
settings.global = {
|
|
|
|
|
server_name = "m3ta.dev";
|
2026-04-24 21:38:57 +02:00
|
|
|
address = ["127.0.0.1"];
|
|
|
|
|
port = [tuwunel-port];
|
2026-04-06 18:44:07 +02:00
|
|
|
max_request_size = 20000000;
|
2026-04-24 21:38:57 +02:00
|
|
|
allow_registration = true;
|
|
|
|
|
registration_token_file = config.age.secrets."tuwunel-registration-token".path;
|
2026-04-06 18:44:07 +02:00
|
|
|
allow_encryption = true;
|
|
|
|
|
allow_federation = true;
|
|
|
|
|
trusted_servers = ["matrix.org"];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2026-04-24 21:38:57 +02:00
|
|
|
# Traefik configuration for Tuwunel
|
2026-04-06 18:44:07 +02:00
|
|
|
services.traefik.dynamicConfigOptions.http = {
|
2026-04-24 21:38:57 +02:00
|
|
|
services.tuwunel.loadBalancer.servers = [
|
2026-04-06 18:44:07 +02:00
|
|
|
{
|
2026-04-24 21:38:57 +02:00
|
|
|
url = "http://localhost:${toString tuwunel-port}/";
|
2026-04-06 18:44:07 +02:00
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
2026-04-24 21:38:57 +02:00
|
|
|
routers.tuwunel = {
|
2026-04-06 18:44:07 +02:00
|
|
|
rule = "Host(`matrix.m3ta.dev`)";
|
|
|
|
|
tls = {
|
|
|
|
|
certResolver = "godaddy";
|
|
|
|
|
};
|
2026-04-24 21:38:57 +02:00
|
|
|
service = "tuwunel";
|
2026-04-06 18:44:07 +02:00
|
|
|
entrypoints = "websecure";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Federation endpoint on base domain
|
2026-04-24 21:38:57 +02:00
|
|
|
routers.tuwunel-federation = {
|
2026-04-06 18:44:07 +02:00
|
|
|
rule = "Host(`m3ta.dev`) && PathPrefix(`/_matrix`)";
|
|
|
|
|
tls = {
|
|
|
|
|
certResolver = "godaddy";
|
|
|
|
|
};
|
2026-04-24 21:38:57 +02:00
|
|
|
service = "tuwunel";
|
2026-04-06 18:44:07 +02:00
|
|
|
entrypoints = "websecure";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Open federation port
|
|
|
|
|
networking.firewall.allowedTCPPorts = [8448];
|
|
|
|
|
}
|