updated synapse

This commit is contained in:
2026-03-27 20:49:11 -05:00
parent 6e96b2b968
commit 2e3605ca64
3 changed files with 27 additions and 28 deletions

View File

@@ -1,27 +0,0 @@
{ config, pkgs, lib, ... }:
{
# ── Generate Matrix registration secret at runtime ──────────
systemd.services.matrix-synapse-secret-init = {
description = "Generate Matrix Synapse registration secret if missing";
wantedBy = [ "multi-user.target" ];
before = [ "matrix-synapse.service" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
path = [ pkgs.pwgen pkgs.coreutils ];
script = ''
SECRET_FILE="/var/lib/matrix-synapse/registration-secret"
if [ ! -f "$SECRET_FILE" ]; then
mkdir -p /var/lib/matrix-synapse
pwgen -s 64 1 > "$SECRET_FILE"
chown matrix-synapse:matrix-synapse "$SECRET_FILE"
chmod 600 "$SECRET_FILE"
echo "Generated Matrix registration secret"
else
echo "Matrix registration secret already exists, skipping"
fi
'';
};
}

View File

@@ -7,7 +7,6 @@
./core/role-logic.nix ./core/role-logic.nix
./core/caddy.nix ./core/caddy.nix
./core/njalla.nix ./core/njalla.nix
./core/matrix-secret.nix
./core/sovran-manage-domains.nix ./core/sovran-manage-domains.nix
# ── Always on (no flag) ─────────────────────────────────── # ── Always on (no flag) ───────────────────────────────────

View File

@@ -12,6 +12,31 @@ lib.mkIf config.sovran_systemsOS.services.synapse {
]; ];
}; };
# ── Generate registration secret if missing ─────────────────
systemd.services.matrix-synapse-secret-init = {
description = "Generate Matrix Synapse registration secret if missing";
wantedBy = [ "multi-user.target" ];
before = [ "matrix-synapse.service" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
path = [ pkgs.pwgen pkgs.coreutils ];
script = ''
SECRET_FILE="/var/lib/matrix-synapse/registration-secret"
if [ ! -f "$SECRET_FILE" ]; then
mkdir -p /var/lib/matrix-synapse
pwgen -s 64 1 > "$SECRET_FILE"
chown matrix-synapse:matrix-synapse "$SECRET_FILE"
chmod 600 "$SECRET_FILE"
echo "Generated Matrix registration secret"
else
echo "Matrix registration secret already exists, skipping"
fi
'';
};
# ── Generate DB password if missing ─────────────────────────
systemd.services.matrix-synapse-db-init = { systemd.services.matrix-synapse-db-init = {
description = "Generate Matrix Synapse DB password if missing"; description = "Generate Matrix Synapse DB password if missing";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
@@ -35,6 +60,7 @@ lib.mkIf config.sovran_systemsOS.services.synapse {
''; '';
}; };
# ── Generate runtime config from domain files ───────────────
systemd.services.matrix-synapse-runtime-config = { systemd.services.matrix-synapse-runtime-config = {
description = "Generate Synapse runtime config from domain files"; description = "Generate Synapse runtime config from domain files";
before = [ "matrix-synapse.service" ]; before = [ "matrix-synapse.service" ];
@@ -65,6 +91,7 @@ EOF
''; '';
}; };
# ── Synapse service ─────────────────────────────────────────
services.matrix-synapse = { services.matrix-synapse = {
enable = true; enable = true;
extraConfigFiles = [ extraConfigFiles = [