nixos-config/new-infra/containers/postgresql.nix

41 lines
930 B
Nix
Raw Normal View History

2024-04-13 11:31:08 +00:00
{pkgs, ...}: {
containers.postgresql = {
autoStart = true;
privateNetwork = true;
hostAddress6 = "fc00::1";
localAddress6 = "fc00::2";
ephemeral = true;
bindMounts = {
persist = {
mountPoint = "/persist";
hostPath = "/persist/postgresql";
isReadOnly = false;
2024-04-13 11:31:08 +00:00
};
backup = {
mountPoint = "/backup";
hostPath = "/persist/backup/postgresql";
isReadOnly = false;
2024-04-13 11:31:08 +00:00
};
};
config = {pkgs, ...}: {
services.postgresql = {
enable = true;
package = pkgs.postgresql_16;
dataDir = "/persist/16";
};
services.postgresqlBackup = {
enable = true;
pgdumpOptions = "-C";
location = "/backup";
compression = "zstd";
compressionLevel = 19;
};
networking.firewall = {
enable = true;
};
system.stateVersion = "24.05";
2024-04-13 11:31:08 +00:00
};
};
}