💬 matrix-synapse server

This commit is contained in:
2021-06-07 21:15:08 -04:00
parent 74ea9cd3ce
commit 9fa26478eb
4 changed files with 75 additions and 6 deletions

View File

@ -0,0 +1,37 @@
{ config, lib, pkgs, ... }:
{
services = {
postgresql = {
enable = true;
initialScript = pkgs.writeText "synapse-init.sql" ''
CREATE ROLE "matrix-synapse";
CREATE DATABASE "matrix" WITH OWNER "matrix-synapse"
TEMPLATE template0
ENCODING 'UTF8'
LC_COLLATE = "C"
LC_CTYPE = "C";
'';
};
matrix-synapse = {
enable = true;
server_name = "walkah.chat";
enable_metrics = true;
enable_registration = false;
database_type = "psycopg2";
database_args = { database = "matrix"; };
listeners = [{
port = 8008;
type = "http";
tls = false;
x_forwarded = true;
resources = [{
compress = false;
names = [ "client" "federation" ];
}];
}];
};
};
}

26
modules/matrix/nginx.nix Normal file
View File

@ -0,0 +1,26 @@
{ 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 ''
add_header Content-Type application/json;
return 200 '${builtins.toJSON server}';
'';
locations."/" = { root = pkgs.element-web; };
};
};
};
}