Files
nix-config/modules/nixos/services/postgresql.nix
Jordan Holt 65af220200
All checks were successful
Check flake / build-amd64-linux (push) Successful in 1m23s
treewide: impermanence configuration
2025-08-18 22:26:20 +01:00

51 lines
885 B
Nix

{
config,
lib,
...
}:
let
cfg = config.modules.services.postgresql;
in
{
options.modules.services.postgresql = {
enable = lib.mkOption {
default = false;
example = true;
};
};
config = lib.mkIf cfg.enable {
services.postgresql = {
enable = true;
initdbArgs = [
"--allow-group-access"
"--encoding=UTF8"
"--locale=C"
];
settings = {
log_connections = true;
log_disconnections = true;
log_destination = lib.mkForce "syslog";
};
};
environment.persistence."/persist".directories = [
{
directory = "/var/lib/postgresql";
user = "postgres";
group = "postgres";
mode = "0700";
}
];
services.borgmatic.settings = {
postgresql_databases = [
{
name = "all";
}
];
};
};
}