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

@@ -3,76 +3,50 @@
let
livekitKeyFile = "/run/livekit.key";
serverName = "atri.dad";
matrixDomain = "chat.atri.dad";
matrixDomain = "matrix.atri.dad";
matrixRtcDomain = "matrixrtc.atri.dad";
in
{
services.matrix-synapse = {
services.matrix-tuwunel = {
enable = true;
settings = {
server_name = serverName;
public_baseurl = "https://${matrixDomain}";
global = {
server_name = serverName;
address = [ "127.0.0.1" "::1" ];
port = [ 6167 ];
max_request_size = 104857600; # 100MB in bytes
allow_registration = false;
allow_encryption = true;
allow_federation = true;
trusted_servers = [ "matrix.org" ];
ip_range_denylist = [
"127.0.0.0/8"
"10.0.0.0/8"
"172.16.0.0/12"
"192.168.0.0/16"
"100.64.0.0/10"
"192.0.0.0/24"
"169.254.0.0/16"
"198.18.0.0/15"
"::1/128"
"fe80::/10"
"fc00::/7"
];
listeners = [
{
port = 8008;
bind_addresses = [ "::1" "127.0.0.1" ];
type = "http";
tls = false;
x_forwarded = true;
resources = [
well_known = {
server = "${matrixDomain}:443";
client = "https://${matrixDomain}";
rtc_transports = [
{
names = [ "client" "federation" ];
compress = true;
type = "livekit";
livekit_service_url = "https://${matrixRtcDomain}";
}
];
}
];
database = {
name = "psycopg2";
args = {
database = "matrix-synapse";
user = "matrix-synapse";
host = "/run/postgresql";
};
};
max_upload_size = "100M";
url_preview_enabled = true;
url_preview_ip_range_blacklist = [
"127.0.0.0/8"
"10.0.0.0/8"
"172.16.0.0/12"
"192.168.0.0/16"
"100.64.0.0/10"
"192.0.0.0/24"
"169.254.0.0/16"
"198.18.0.0/15"
"::1/128"
"fe80::/10"
"fc00::/7"
];
enable_registration = false;
registration_shared_secret_path = "/var/lib/matrix-synapse/registration_shared_secret";
};
};
services.postgresql = {
enable = true;
initialScript = pkgs.writeText "synapse-init.sql" ''
CREATE ROLE "matrix-synapse" WITH LOGIN;
CREATE DATABASE "matrix-synapse"
OWNER "matrix-synapse"
TEMPLATE template0
LC_COLLATE = 'C'
LC_CTYPE = 'C'
ENCODING = 'UTF8';
'';
};
services.livekit = {
enable = true;
openFirewall = true;
@@ -90,7 +64,7 @@ in
services.lk-jwt-service = {
enable = true;
livekitUrl = "wss://${matrixDomain}/livekit/sfu";
livekitUrl = "wss://${matrixRtcDomain}";
keyFile = livekitKeyFile;
};