server-configs/shared/applications/state/postgresql.nix

21 lines
702 B
Nix
Raw Permalink Normal View History

2024-08-24 13:01:59 +00:00
{ config, ... }:
let
stateDir= config.mine.zfsMounts."rpool/safe/svcs/postgresql";
backupDir = config.mine.zfsMounts."rpool/backup/postgresql";
postgresql_user = config.systemd.services.postgresql.serviceConfig.User;
postgresql_group = config.systemd.services.postgresql.serviceConfig.Group;
in {
services.postgresql.dataDir = stateDir;
# backup postgresql databases (everything in ensuredatabases)
services.postgresqlBackup.location = backupDir;
# ensure correct permissions for postgresql and postgresql backup
systemd.tmpfiles.rules = [
2024-08-24 19:36:56 +00:00
"Z ${stateDir} 0700 ${postgresql_user} ${postgresql_group} -"
"Z ${backupDir} 0700 ${postgresql_user} ${postgresql_group} -"
2024-08-24 13:01:59 +00:00
];
}