Add sliding sync proxy to Matrix
All checks were successful
Check flake / build-amd64-linux (push) Successful in 2m36s
All checks were successful
Check flake / build-amd64-linux (push) Successful in 2m36s
This commit is contained in:
parent
abfb24ca21
commit
9d57be94c6
@ -2,6 +2,7 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
inputs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -33,6 +34,9 @@ in {
|
|||||||
default = "vimium.com";
|
default = "vimium.com";
|
||||||
example = "vimium.com";
|
example = "vimium.com";
|
||||||
};
|
};
|
||||||
|
slidingSync = {
|
||||||
|
enable = lib.mkEnableOption "sliding-sync";
|
||||||
|
};
|
||||||
usePostgresql = lib.mkEnableOption "postgresql";
|
usePostgresql = lib.mkEnableOption "postgresql";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,6 +49,9 @@ in {
|
|||||||
server_name = cfg.serverName;
|
server_name = cfg.serverName;
|
||||||
};
|
};
|
||||||
"m.identity_server" = {};
|
"m.identity_server" = {};
|
||||||
|
"org.matrix.msc3575.proxy" = if cfg.slidingSync.enable then {
|
||||||
|
"url" = "https://${matrixSubdomain}";
|
||||||
|
} else { };
|
||||||
};
|
};
|
||||||
matrixServerConfig."m.server" = "${matrixSubdomain}:443";
|
matrixServerConfig."m.server" = "${matrixSubdomain}:443";
|
||||||
commonBridgeSettings = bridge: {
|
commonBridgeSettings = bridge: {
|
||||||
@ -133,6 +140,13 @@ in {
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
"/_synapse/client".proxyPass = "http://localhost:8008";
|
"/_synapse/client".proxyPass = "http://localhost:8008";
|
||||||
|
"~ ^/(client/|_matrix/client/unstable/org.matrix.msc3575/sync)" = lib.mkIf cfg.slidingSync.enable {
|
||||||
|
priority = 100;
|
||||||
|
proxyPass = "http://localhost:8009";
|
||||||
|
extraConfig = ''
|
||||||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||||||
|
'';
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
"${cfg.serverName}" = let
|
"${cfg.serverName}" = let
|
||||||
@ -181,6 +195,18 @@ in {
|
|||||||
(lib.optional cfg.bridges.whatsapp
|
(lib.optional cfg.bridges.whatsapp
|
||||||
config.systemd.services.mautrix-whatsapp.serviceConfig.Group);
|
config.systemd.services.mautrix-whatsapp.serviceConfig.Group);
|
||||||
|
|
||||||
|
age.secrets = if cfg.slidingSync.enable then {
|
||||||
|
"files/services/matrix/sliding-sync" = {
|
||||||
|
file = "${inputs.secrets}/files/services/matrix/sliding-sync.age";
|
||||||
|
};
|
||||||
|
} else {};
|
||||||
|
|
||||||
|
services.matrix-sliding-sync = lib.mkIf cfg.slidingSync.enable {
|
||||||
|
enable = true;
|
||||||
|
environmentFile = config.age.secrets."files/services/matrix/sliding-sync".path;
|
||||||
|
settings = { SYNCV3_SERVER = "https://${matrixSubdomain}"; };
|
||||||
|
};
|
||||||
|
|
||||||
services.postgresql = lib.mkIf cfg.usePostgresql {
|
services.postgresql = lib.mkIf cfg.usePostgresql {
|
||||||
ensureUsers = [
|
ensureUsers = [
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user