dotfiles/nixos/boxes/vpsfree1/matrix-front.nix

40 lines
1,021 B
Nix
Raw Normal View History

2022-12-19 09:09:08 +00:00
{
config,
pkgs,
...
}: {
2021-06-02 20:42:32 +01:00
services.nginx = {
virtualHosts = {
"cyplo.dev" = {
forceSSL = true;
enableACME = true;
2022-12-19 09:09:08 +00:00
locations."= /.well-known/matrix/server".extraConfig = let
server = {"m.server" = "cyplo.dev:443";};
in ''
add_header Content-Type application/json;
return 200 '${builtins.toJSON server}';
'';
2021-06-02 20:42:32 +01:00
2022-03-10 12:25:23 +00:00
locations."= /.well-known/matrix/client".extraConfig = let
client = {
2022-12-19 09:09:08 +00:00
"m.homeserver" = {"base_url" = "https://cyplo.dev";};
"m.identity_server" = {"base_url" = "https://vector.im";};
2022-03-10 12:25:23 +00:00
};
in ''
add_header Content-Type application/json;
add_header Access-Control-Allow-Origin *;
return 200 '${builtins.toJSON client}';
'';
2021-06-02 20:42:32 +01:00
2021-11-22 19:32:26 +00:00
locations."/".extraConfig = ''
return 404;
'';
2021-06-02 20:42:32 +01:00
2021-11-22 19:32:26 +00:00
locations."/_matrix" = {
proxyPass = "http://bolty:8008"; # without a trailing /
2021-06-02 20:42:32 +01:00
};
};
2021-11-22 19:32:26 +00:00
};
};
}