2022-02-19 21:55:47 +00:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
let extraLegoFlags = [ "--dns.resolvers=8.8.8.8:53" ];
|
|
|
|
in {
|
|
|
|
services.matrix-synapse = {
|
|
|
|
enable = true;
|
2022-03-16 18:20:45 +00:00
|
|
|
settings = {
|
|
|
|
server_name = "within.website";
|
2022-02-19 21:55:47 +00:00
|
|
|
|
2022-03-16 18:20:45 +00:00
|
|
|
enable_metrics = true;
|
|
|
|
url_preview_enabled = true;
|
2022-02-19 21:55:47 +00:00
|
|
|
|
2022-03-16 18:20:45 +00:00
|
|
|
max_upload_size = "100M";
|
2022-02-19 21:55:47 +00:00
|
|
|
|
2022-04-15 15:35:25 +00:00
|
|
|
enable_registration = false;
|
2022-02-19 21:55:47 +00:00
|
|
|
|
2022-03-16 18:20:45 +00:00
|
|
|
listeners = [
|
|
|
|
{
|
|
|
|
bind_addresses = [ "127.0.0.1" "::1" ];
|
|
|
|
port = 8448;
|
|
|
|
type = "http";
|
|
|
|
tls = false;
|
|
|
|
x_forwarded = true;
|
|
|
|
resources = [{
|
|
|
|
compress = false;
|
|
|
|
names = [ "client" "federation" ];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
bind_addresses = [ "100.77.196.9" ];
|
|
|
|
port = 8448;
|
|
|
|
type = "http";
|
|
|
|
tls = false;
|
|
|
|
resources = [{
|
|
|
|
compress = false;
|
|
|
|
names = [ "client" "federation" ];
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
bind_addresses = [ "100.77.196.9" ];
|
|
|
|
port = 9000;
|
|
|
|
type = "metrics";
|
|
|
|
tls = false;
|
|
|
|
resources = [ ];
|
|
|
|
}
|
|
|
|
];
|
2022-02-19 21:55:47 +00:00
|
|
|
|
2022-03-16 18:20:45 +00:00
|
|
|
extraConfig = ''
|
|
|
|
registration_requires_token: true
|
|
|
|
'';
|
|
|
|
};
|
2022-02-19 21:55:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx.virtualHosts = {
|
|
|
|
"matrix.within.website" = {
|
|
|
|
forceSSL = true;
|
2022-10-06 20:57:29 +00:00
|
|
|
enableACME = true;
|
2022-02-19 21:55:47 +00:00
|
|
|
|
|
|
|
locations = {
|
|
|
|
"/".extraConfig = ''
|
|
|
|
return 404;
|
|
|
|
'';
|
|
|
|
|
|
|
|
"/_matrix" = { proxyPass = "http://127.0.0.1:8448"; };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
"element.within.website" = {
|
|
|
|
forceSSL = true;
|
2022-10-06 20:57:29 +00:00
|
|
|
enableACME = true;
|
2022-02-19 21:55:47 +00:00
|
|
|
|
|
|
|
root = pkgs.element-web.override {
|
|
|
|
conf = {
|
|
|
|
default_server_config."m.homeserver" = {
|
|
|
|
"base_url" = "https://matrix.within.website";
|
|
|
|
"server_name" = "within.website";
|
|
|
|
};
|
|
|
|
showLabsSettings = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.postgresql.enable = true;
|
|
|
|
services.postgresql.initialScript = pkgs.writeText "synapse-init.sql" ''
|
|
|
|
CREATE ROLE "matrix-synapse" WITH LOGIN PASSWORD 'synapse';
|
|
|
|
CREATE DATABASE "matrix-synapse" WITH OWNER "matrix-synapse"
|
|
|
|
TEMPLATE template0
|
|
|
|
LC_COLLATE = "C"
|
|
|
|
LC_CTYPE = "C";
|
|
|
|
'';
|
|
|
|
}
|