nixos-config/modules/services/server/postgresql.nix

44 lines
1.4 KiB
Nix
Raw Normal View History

2022-12-10 11:16:50 +01:00
#
# System notifications
#
{ config, lib, pkgs, ... }:
{
services.postgresql = {
enable = true;
2024-02-18 09:34:50 +01:00
package = pkgs.postgresql_15;
2022-12-10 11:16:50 +01:00
settings = {
max_connections = 200;
listen_addresses = "localhost";
password_encryption = "scram-sha-256";
2024-02-18 11:26:33 +01:00
shared_buffers = "4GB";
work_mem = "2GB";
2024-02-12 12:40:32 +01:00
maintenance_work_mem = "500MB";
2022-12-10 11:16:50 +01:00
autovacuum_work_mem = -1;
log_timezone = "Europe/Berlin";
timezone = "Europe/Berlin";
2022-12-10 11:16:50 +01:00
};
authentication = pkgs.lib.mkOverride 14 ''
local all postgres peer
host giteadb gitea localhost scram-sha-256
host nextclouddb nextcloud localhost scram-sha-256
host synapsedb synapse localhost scram-sha-256
host whatsappdb mautrixwa localhost scram-sha-256
host telegramdb mautrixtele localhost scram-sha-256
host signaldb mautrixsignal localhost scram-sha-256
host onlyoffice onlyoffice localhost scram-sha-256
local onlyoffice onlyoffice peer
'';
2022-12-27 20:52:04 +01:00
initialScript = config.age.secrets."services/postgresql/initScript.sql".path;
2022-12-10 11:16:50 +01:00
};
services.postgresqlBackup.enable = true;
2022-12-10 11:16:50 +01:00
2022-12-27 20:52:04 +01:00
age.secrets."services/postgresql/initScript.sql" = {
file = ../../../secrets/services/postgresql/initScript.age;
owner = "postgres";
};
2022-12-10 11:16:50 +01:00
}