matrix-synapse?
This commit is contained in:
@@ -71,7 +71,10 @@
|
|||||||
|
|
||||||
# matrix homeserver
|
# matrix homeserver
|
||||||
# matrix.domain
|
# matrix.domain
|
||||||
./modules/nixos/matrix-conduit.nix
|
# ./modules/nixos/matrix-conduit.nix
|
||||||
|
|
||||||
|
# matrix homeserver
|
||||||
|
./modules/nixos/matrix-synapse.nix
|
||||||
|
|
||||||
# BROKEN
|
# BROKEN
|
||||||
# forgejo
|
# forgejo
|
||||||
|
|||||||
65
modules/nixos/matrix-synapse.nix
Normal file
65
modules/nixos/matrix-synapse.nix
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
fqdn = "${config.networking.hostName}.${config.networking.domain}";
|
||||||
|
baseUrl = "https://${fqdn}";
|
||||||
|
clientConfig."m.homeserver".base_url = baseUrl;
|
||||||
|
serverConfig."m.server" = "${fqdn}:443";
|
||||||
|
mkWellKnown = data: ''
|
||||||
|
default_type application/json;
|
||||||
|
add_header Access-Control-Allow-Origin *;
|
||||||
|
return 200 '${builtins.toJSON data}';
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
services.postgresql.enable = true;
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
virtualHosts = {
|
||||||
|
"${config.networking.domain}" = {
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
locations."= /.well-known/matrix/server".extraConfig = mkWellKnown serverConfig;
|
||||||
|
locations."= /.well-known/matrix/client".extraConfig = mkWellKnown clientConfig;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
"${fqdn}" = {
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
locations."/".extraConfig = ''
|
||||||
|
return 404;
|
||||||
|
'';
|
||||||
|
locations."/_matrix".proxyPass = "http://[::1]:8008";
|
||||||
|
locations."/_synapse/client".proxyPass = "http://[::1]:8008";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services.matrix-synapse = {
|
||||||
|
enable = true;
|
||||||
|
settings.server_name = config.networking.domain;
|
||||||
|
settings.public_baseurl = baseUrl;
|
||||||
|
settings.listeners = [
|
||||||
|
{
|
||||||
|
port = 8008;
|
||||||
|
bind_addresses = ["::1"];
|
||||||
|
type = "http";
|
||||||
|
tls = false;
|
||||||
|
x_forwarded = true;
|
||||||
|
resources = [
|
||||||
|
{
|
||||||
|
names = [
|
||||||
|
"client"
|
||||||
|
"federation"
|
||||||
|
];
|
||||||
|
compress = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user