athens/modules/matrix/nginx.nix

37 lines
1.0 KiB
Nix
Raw Normal View History

2021-06-07 21:15:08 -04:00
{ config, lib, pkgs, ... }:
{
services.nginx = {
enable = true;
virtualHosts = {
"matrix.walkah.chat" = {
forceSSL = true;
enableACME = true;
locations."/" = { proxyPass = "http://plato:8008"; };
};
"walkah.chat" = {
forceSSL = true;
enableACME = true;
locations."= /.well-known/matrix/server".extraConfig =
let server = { "m.server" = "matrix.walkah.chat:443"; };
in ''
2021-10-09 21:04:39 -04:00
default_type application/json;
add_header Access-Control-Allow-Origin *;
2021-06-07 21:15:08 -04:00
return 200 '${builtins.toJSON server}';
'';
2021-10-09 21:04:39 -04:00
locations."= /.well-known/matrix/client".extraConfig = let
client = {
"m.homeserver" = { "base_url" = "https://matrix.walkah.chat"; };
};
in ''
default_type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}';
'';
2021-06-07 21:15:08 -04:00
locations."/" = { root = pkgs.element-web; };
};
};
};
}