Files
nixos-config/hosts/m3-atlas/services/tuwunel.nix

51 lines
1.3 KiB
Nix
Raw Normal View History

{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";
address = ["127.0.0.1"];
port = [tuwunel-port];
2026-04-06 18:44:07 +02:00
max_request_size = 20000000;
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"];
};
};
# Traefik configuration for Tuwunel
2026-04-06 18:44:07 +02:00
services.traefik.dynamicConfigOptions.http = {
services.tuwunel.loadBalancer.servers = [
2026-04-06 18:44:07 +02:00
{
url = "http://localhost:${toString tuwunel-port}/";
2026-04-06 18:44:07 +02:00
}
];
routers.tuwunel = {
2026-04-06 18:44:07 +02:00
rule = "Host(`matrix.m3ta.dev`)";
tls = {
certResolver = "godaddy";
};
service = "tuwunel";
2026-04-06 18:44:07 +02:00
entrypoints = "websecure";
};
# Federation endpoint on base domain
routers.tuwunel-federation = {
2026-04-06 18:44:07 +02:00
rule = "Host(`m3ta.dev`) && PathPrefix(`/_matrix`)";
tls = {
certResolver = "godaddy";
};
service = "tuwunel";
2026-04-06 18:44:07 +02:00
entrypoints = "websecure";
};
};
# Open federation port
networking.firewall.allowedTCPPorts = [8448];
}