server-configuration/samsehu/matrix-conduit.nix

36 lines
1.1 KiB
Nix
Raw Permalink Normal View History

2024-02-04 13:39:46 -07:00
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
let
homeserver-url = "samsehu.perli.casa";
in
2024-02-04 13:39:46 -07:00
{
# configure matrix-conduit as a server to host chat communications with end-to-end encryption
services.matrix-conduit = {
enable = true;
settings.global = {
server_name = "${homeserver-url}";
2024-05-29 16:01:52 -06:00
trusted_servers = [];
2024-02-04 13:39:46 -07:00
};
};
# Reverse proxy with Caddy
2024-02-04 14:20:09 -07:00
services.caddy.virtualHosts."${homeserver-url}" = {
serverAliases = [ "${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}
'';
};
2024-02-04 13:39:46 -07:00
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 80 443 8448 ];
networking.firewall.allowedUDPPorts = [ 80 443 8448 ];
}