dots/hosts/luna/modules/services/postgresql.nix
Price Hiller 88d64a5f73
refactor(hosts/luna): update system.stateVersion 24.05 -> 24.11
This required a manual migration of postgresql from version 15 to 16
2024-11-11 23:13:24 -06:00

44 lines
917 B
Nix

{ config, pkgs, ... }:
let
pg_dataDir_base = "/var/lib/postgresql";
in
{
services.postgresqlBackup = {
enable = true;
location = "/var/backup/postgresql";
backupAll = true;
};
services.postgresql = {
enable = true;
dataDir = "${pg_dataDir_base}/${config.services.postgresql.package.psqlSchema}";
settings = {
log_connections = true;
log_disconnections = true;
logging_collector = true;
log_statement = "all";
};
ensureUsers = [
{
name = "root";
ensureClauses.superuser = true;
}
];
};
environment.systemPackages = [ pkgs.pgloader ];
environment.persistence.save.directories = [
{
directory = "${pg_dataDir_base}";
user = "postgres";
group = "postgres";
}
{
directory = config.services.postgresqlBackup.location;
user = "postgres";
group = "postgres";
}
];
}