nixos-config/config/services/postgres.nix

37 lines
740 B
Nix
Raw Normal View History

2022-06-12 15:39:15 +00:00
{
config,
lib,
...
}: {
2022-01-15 20:42:50 +00:00
services.postgresql = {
2022-01-15 20:12:12 +00:00
enable = true;
enableTCPIP = true;
2023-02-04 12:26:05 +00:00
authentication = "host all all fd7a:115c:a1e0:ab12::/64 md5";
2022-05-02 09:47:56 +00:00
settings = {
shared_preload_libraries = "pg_stat_statements";
"pg_stat_statements.track" = "all";
};
2022-01-15 20:12:12 +00:00
};
2022-01-15 20:58:11 +00:00
services.postgresqlBackup = {
enable = true;
compression = "none"; # the file system and restic both do compression
};
2022-01-15 20:50:42 +00:00
services.prometheus.exporters.postgres = {
enable = true;
2022-01-15 20:53:08 +00:00
user = "postgres";
2023-12-10 10:41:34 +00:00
port = 1589;
2022-01-15 20:50:42 +00:00
};
2023-12-10 09:36:28 +00:00
services.prometheus.scrapeConfigs = [
{
job_name = "postgresql";
static_configs = [
{
targets = [
"127.0.0.1:1589"
];
}
];
}
];
2022-01-15 20:12:12 +00:00
}