CrOS/modules/services/matrix/default.nix
TheWanderingCrow b346790feb treewide format
2026-04-04 22:59:28 -04:00

48 lines
1.2 KiB
Nix

{
config,
inputs,
pkgs,
...
}:
let
sopsFolder = builtins.toString inputs.nix-secrets + "/sops";
in
{
sops.secrets."matrix/registration_token" = {
owner = "tuwunel";
sopsFile = "${sopsFolder}/services.yaml";
};
services.matrix-tuwunel = {
enable = true;
package = pkgs.matrix-tuwunel;
stateDirectory = "tuwunel";
settings = {
global = {
server_name = "psychal.link";
new_user_displayname_suffix = "";
unix_socket_path = "/run/tuwunel/tuwunel.sock";
unix_socket_perms = 660;
allow_registration = true;
registration_token_file = config.sops.secrets."matrix/registration_token".path;
allow_encryption = true;
allow_federation = true;
require_auth_for_profile_requests = true; # no user enumeration
trusted_servers = [ "matrix.org" ];
};
};
};
networking.firewall.allowedTCPPorts = [ 8448 ];
users.users.caddy.extraGroups = [ "tuwunel" ];
services.caddy = {
enable = true;
virtualHosts = {
"psychal.link, psychal.link:8448".extraConfig = ''
reverse_proxy unix//run/tuwunel/tuwunel.sock
'';
};
};
}