2021-09-22 10:16:11 +02:00
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
|
|
|
services.postgresql = {
|
|
|
|
enable = true;
|
2023-12-08 14:58:35 +01:00
|
|
|
package = pkgs.postgresql_16;
|
2021-09-22 10:16:11 +02:00
|
|
|
initialScript = pkgs.writeText "synapse-init.sql" ''
|
|
|
|
CREATE ROLE synapse;
|
|
|
|
CREATE DATABASE synapse WITH OWNER synapse
|
|
|
|
TEMPLATE template0
|
|
|
|
LC_COLLATE = "C"
|
|
|
|
LC_CTYPE = "C"
|
|
|
|
ENCODING = "UTF8";
|
|
|
|
'';
|
|
|
|
authentication = pkgs.lib.mkOverride 10 ''
|
|
|
|
local all all trust
|
|
|
|
host all all ::1/128 trust
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.postgresqlBackup = {
|
|
|
|
enable = true;
|
|
|
|
location = "/var/lib/postgresql/backup";
|
2021-09-23 16:45:06 +02:00
|
|
|
databases = [ "synapse" ];
|
2021-09-22 10:16:11 +02:00
|
|
|
startAt = "02:30";
|
|
|
|
compression = "none";
|
|
|
|
};
|
|
|
|
}
|