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

38 lines
1 KiB
Nix
Raw Normal View History

2022-03-10 12:25:23 +00:00
{ config, pkgs, ... }: {
2021-06-02 20:42:32 +01:00
services.nginx = {
virtualHosts = {
"cyplo.dev" = {
forceSSL = true;
enableACME = true;
locations."= /.well-known/matrix/server".extraConfig =
2022-03-10 12:25:23 +00:00
let server = { "m.server" = "cyplo.dev:443"; };
in ''
2021-06-02 20:42:32 +01:00
add_header Content-Type application/json;
return 200 '${builtins.toJSON server}';
'';
2022-03-10 12:25:23 +00:00
locations."= /.well-known/matrix/client".extraConfig = let
client = {
"m.homeserver" = { "base_url" = "https://cyplo.dev"; };
"m.identity_server" = { "base_url" = "https://vector.im"; };
};
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
};
};
2021-06-02 20:42:32 +01:00
2021-11-22 19:32:26 +00:00
}