snowflake/hosts/arashi/services/postgresql.nix
notohh 0845808f39
Some checks failed
flake check / check (push) Successful in 10m2s
fmt check / check (push) Has been cancelled
hosts: init restic
2023-12-31 12:51:49 -05:00

59 lines
1.2 KiB
Nix

{
pkgs,
lib,
...
}: {
networking.firewall.allowedTCPPorts = [5432];
services.postgresql = {
enable = true;
enableTCPIP = true;
package = pkgs.postgresql_14;
port = 5432;
settings = {
listen_addresses = lib.mkForce "*";
max_connections = "300";
shared_buffers = "80MB";
};
authentication = ''
local all all trust
host replication all 127.0.0.1/32 trust
host all all all trust
'';
ensureUsers = [
{
name = "hedgedoc";
ensureDBOwnership = true;
}
{
name = "forgejo";
ensureDBOwnership = true;
}
{
name = "grafana";
ensureDBOwnership = true;
}
{
name = "authelia";
ensureDBOwnership = true;
}
{
name = "vaultwarden";
ensureDBOwnership = true;
}
];
ensureDatabases = [
"forgejo"
"hedgedoc"
"grafana"
"authelia"
"vaultwarden"
];
};
services.postgresqlBackup = {
enable = true;
databases = ["forgejo" "hedgedoc" "grafana" "authelia" "vaultwarden"];
compression = "zstd";
compressionLevel = 4;
startAt = "daily";
};
}