50 lines
905 B
Nix
50 lines
905 B
Nix
|
{
|
||
|
config,
|
||
|
lib,
|
||
|
...
|
||
|
}: let
|
||
|
inherit (lib.lists) flatten;
|
||
|
|
||
|
domain = config.services.nginx.domain;
|
||
|
server_name = "matrix.${domain}";
|
||
|
in {
|
||
|
services.matrix-conduit = {
|
||
|
enable = true;
|
||
|
settings.global = {
|
||
|
inherit server_name;
|
||
|
address = "127.0.0.1";
|
||
|
database_backend = "rocksdb";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
services.nginx = {
|
||
|
virtualHosts."${server_name}" = {
|
||
|
listen = flatten (map (port: [
|
||
|
{
|
||
|
inherit port;
|
||
|
addr = "0.0.0.0";
|
||
|
ssl = true;
|
||
|
}
|
||
|
{
|
||
|
inherit port;
|
||
|
addr = "[::0]";
|
||
|
ssl = true;
|
||
|
}
|
||
|
]) [443 8448]);
|
||
|
|
||
|
locations."/_matrix/" = {
|
||
|
proxyPass = "http://127.0.0.1:6167";
|
||
|
extraConfig = ''
|
||
|
proxy_buffering off;
|
||
|
'';
|
||
|
};
|
||
|
onlySSL = true;
|
||
|
enableACME = true;
|
||
|
|
||
|
extraConfig = ''
|
||
|
merge_slashes off;
|
||
|
'';
|
||
|
};
|
||
|
};
|
||
|
}
|