feat: matrix-conduit: expose /_matrix/ on both ports

main
LeRoyce Pearson 2024-02-04 14:02:23 -07:00
parent 7700905647
commit 96d7fb67ae
1 changed files with 8 additions and 12 deletions

View File

@ -5,27 +5,23 @@
{ config, lib, pkgs, ... }:
let
homeserver-url = "samsehu.perli.casa";
in
{
# Headscale for access to the network while away from home
services.headscale.settings.dns_config.extra_records = [
{ name = "matrix.samsehu.perli.casa"; type = "A"; value = "100.64.0.3"; }
];
# configure matrix-conduit as a server to host chat communications with end-to-end encryption
services.matrix-conduit = {
enable = true;
settings.global = {
server_name = "matrix.samsehu.perli.casa";
server_name = "${homeserver-url}";
};
};
# Reverse proxy with Caddy
services.caddy.virtualHosts."matrix.samsehu.perli.casa".extraConfig = ''
respond /.well-known/matrix/server `{ "m.server": "matrix.samsehu.perli.casa" }` 200
respond /.well-known/matrix/client `{ "m.homeserver": { "base_url": "https://matrix.samsehu.perli.casa" } }` 200
'';
services.caddy.virtualHosts."matrix.samsehu.perli.casa:8448".extraConfig = ''
reverse_proxy localhost:${toString config.services.matrix-conduit.settings.global.port}
services.caddy.virtualHosts."${homeserver-url}, ${homeserver-url}:8448".extraConfig = ''
respond /.well-known/matrix/server `{ "m.server": "${homeserver-url}" }` 200
respond /.well-known/matrix/client `{ "m.homeserver": { "base_url": "https://${homeserver-url}" } }` 200
reverse_proxy /_matrix/* localhost:${toString config.services.matrix-conduit.settings.global.port}
'';
# Open ports in the firewall.