enable matrix-synapse

This commit is contained in:
Motiejus Jakštys 2023-03-21 13:43:34 +02:00
parent c09ce8f190
commit 42d615cdb3

View File

@ -374,7 +374,7 @@ in {
# app_service_config_files # app_service_config_files
matrix-synapse = { matrix-synapse = {
enable = false; enable = true;
settings = { settings = {
server_name = "jakstys.lt"; server_name = "jakstys.lt";
admin_contact = "motiejus@jakstys.lt"; admin_contact = "motiejus@jakstys.lt";
@ -531,6 +531,10 @@ in {
options = "--delete-older-than 14d"; options = "--delete-older-than 14d";
}; };
systemd.tmpfiles.rules = [
"d /run/matrix-synapse 0700 matrix-synapse matrix-synapse -"
];
systemd.services = { systemd.services = {
"make-snapshot-dirs" = let "make-snapshot-dirs" = let
vals = builtins.attrValues backup_paths; vals = builtins.attrValues backup_paths;
@ -562,8 +566,9 @@ in {
]; ];
}; };
matrix-synapse = { matrix-synapse = let
preStart = '' # TODO https://github.com/NixOS/nixpkgs/pull/222336 replace with `preStart`
secretsScript = pkgs.writeShellScript "write-secrets" ''
umask 077 umask 077
ln -sf ''${CREDENTIALS_DIRECTORY}/jakstys.lt.signing.key /run/matrix-synapse/jakstys.lt.signing.key ln -sf ''${CREDENTIALS_DIRECTORY}/jakstys.lt.signing.key /run/matrix-synapse/jakstys.lt.signing.key
cat > /run/matrix-synapse/secrets.yaml <<EOF cat > /run/matrix-synapse/secrets.yaml <<EOF
@ -571,14 +576,13 @@ in {
macaroon_secret_key: "$(cat ''${CREDENTIALS_DIRECTORY}/macaroon_secret_key)" macaroon_secret_key: "$(cat ''${CREDENTIALS_DIRECTORY}/macaroon_secret_key)"
EOF EOF
''; '';
in {
serviceConfig.ExecStartPre = [ "" secretsScript ];
serviceConfig.LoadCredential = [ serviceConfig.LoadCredential = [
"jakstys.lt.signing.key:/var/src/secrets/synapse/jakstys.lt.signing.key" "jakstys.lt.signing.key:/var/src/secrets/synapse/jakstys.lt.signing.key"
"registration_shared_secret:/var/src/secrets/synapse/registration_shared_secret" "registration_shared_secret:/var/src/secrets/synapse/registration_shared_secret"
"macaroon_secret_key:/var/src/secrets/synapse/macaroon_secret_key" "macaroon_secret_key:/var/src/secrets/synapse/macaroon_secret_key"
]; ];
tmpfiles.rules = [
"d /run/matrix-synapse 0700 matrix-synapse matrix-synapse -"
];
}; };
cert-watcher = { cert-watcher = {