36 lines
1.1 KiB
Nix
36 lines
1.1 KiB
Nix
|
|
# 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
|
|
{
|
|
# 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}";
|
|
trusted_servers = [];
|
|
};
|
|
};
|
|
|
|
# Reverse proxy with Caddy
|
|
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}
|
|
'';
|
|
};
|
|
|
|
# Open ports in the firewall.
|
|
networking.firewall.allowedTCPPorts = [ 80 443 8448 ];
|
|
networking.firewall.allowedUDPPorts = [ 80 443 8448 ];
|
|
}
|
|
|