2023-09-13 14:04:04 +02:00
|
|
|
{ config, pkgs, ... }:
|
2023-07-29 18:00:49 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
server_name = "felschr.com";
|
|
|
|
domain = "matrix.${server_name}";
|
|
|
|
in {
|
|
|
|
services.matrix-conduit = {
|
|
|
|
enable = true;
|
2023-09-13 14:04:04 +02:00
|
|
|
package = pkgs.unstable.matrix-conduit;
|
2023-07-29 18:00:49 +02:00
|
|
|
settings.global = {
|
|
|
|
inherit server_name;
|
|
|
|
database_backend = "rocksdb";
|
|
|
|
trusted_servers = [ "matrix.org" "libera.chat" "nixos.org" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts.${domain} = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations."/_matrix/" = {
|
|
|
|
proxyPass = "http://[::1]:${
|
|
|
|
toString config.services.matrix-conduit.settings.global.port
|
|
|
|
}";
|
|
|
|
proxyWebsockets = true;
|
|
|
|
extraConfig = ''
|
|
|
|
proxy_buffering off;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts.${server_name} = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
|
|
|
locations = let
|
|
|
|
server = { "m.server" = "${domain}:443"; };
|
|
|
|
client = {
|
|
|
|
"m.homeserver"."base_url" = "https://${domain}";
|
2023-07-30 14:09:30 +02:00
|
|
|
"org.matrix.msc3575.proxy"."url" = "https://${domain}";
|
2023-07-29 18:00:49 +02:00
|
|
|
"m.identity_server"."base_url" = "https://vector.im";
|
|
|
|
};
|
|
|
|
in {
|
|
|
|
"= /.well-known/matrix/server".extraConfig = ''
|
|
|
|
add_header Content-Type application/json;
|
|
|
|
return 200 '${builtins.toJSON server}';
|
|
|
|
'';
|
|
|
|
"= /.well-known/matrix/client".extraConfig = ''
|
|
|
|
add_header Content-Type application/json;
|
|
|
|
add_header Access-Control-Allow-Origin *;
|
|
|
|
return 200 '${builtins.toJSON client}';
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|