dotfiles/nixos/boxes/vultr1/matrix-front.nix
Cyryl Płotnicki fe4d30f651 nixpkgs-fmt
2021-11-22 19:32:26 +00:00

43 lines
1.1 KiB
Nix

{ config, pkgs, ... }:
{
services.nginx = {
virtualHosts = {
"cyplo.dev" = {
forceSSL = true;
enableACME = true;
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}';
'';
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}';
'';
locations."/".extraConfig = ''
return 404;
'';
locations."/_matrix" = {
proxyPass = "http://bolty:8008"; # without a trailing /
};
};
};
};
}