matrix: setup delegation and misc configs

This commit is contained in:
2024-12-03 23:00:38 -05:00
parent 9752ec40d9
commit c466f9c89f
2 changed files with 17 additions and 3 deletions

View File

@@ -5,6 +5,9 @@
pkgs, pkgs,
... ...
}: }:
let
matrix_hostname = "matrix.${service_configs.https.domain}";
in
{ {
services.caddy = { services.caddy = {
enable = true; enable = true;
@@ -12,6 +15,12 @@
virtualHosts = { virtualHosts = {
${service_configs.https.domain} = { ${service_configs.https.domain} = {
extraConfig = '' 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_hostname}:443"}`
respond /.well-known/matrix/client `{"m.server":{"base_url":"https://${matrix_hostname}"},"m.homeserver":{"base_url":"https://${matrix_hostname}"},"org.matrix.msc3575.proxy":{"base_url":"https://${config.services.matrix-conduit.settings.global.server_name}"}}`
root * ${service_configs.https.data_dir} root * ${service_configs.https.data_dir}
file_server browse file_server browse
''; '';
@@ -52,12 +61,12 @@
file_server browse file_server browse
''; '';
"${config.services.matrix-conduit.settings.global.server_name}".extraConfig = '' "${matrix_hostname}".extraConfig = ''
reverse_proxy :${builtins.toString config.services.matrix-conduit.settings.global.port} reverse_proxy :${builtins.toString config.services.matrix-conduit.settings.global.port}
''; '';
# Exact duplicate of matrix.gardling.com # Exact duplicate of matrix.gardling.com
"${config.services.matrix-conduit.settings.global.server_name}:8448".extraConfig = "${matrix_hostname}:8448".extraConfig =
config.services.caddy.virtualHosts."${config.services.matrix-conduit.settings.global.server_name config.services.caddy.virtualHosts."${config.services.matrix-conduit.settings.global.server_name
}".extraConfig; }".extraConfig;
}; };

View File

@@ -18,12 +18,17 @@
settings.global = { settings.global = {
port = 6167; port = 6167;
server_name = "matrix.${service_configs.https.domain}"; # server_name = "matrix.${service_configs.https.domain}";
server_name = service_configs.https.domain;
database_backend = "rocksdb"; database_backend = "rocksdb";
allow_registration = true; allow_registration = true;
new_user_displayname_suffix = "";
trusted_servers = [ trusted_servers = [
"matrix.org" "matrix.org"
"constellatory.net"
"tchncs.de"
"envs.net" "envs.net"
]; ];