nixos/modules/services/postgresql/default.nix

25 lines
569 B
Nix
Raw Normal View History

2024-02-02 13:45:05 +01:00
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.az-postgresql;
in
{
2023-06-06 21:51:44 +02:00
options = {
2024-02-02 13:45:05 +01:00
services.az-postgresql.enable = lib.mkEnableOption "Enable PostgreSQL with settings for container clients.";
2023-06-06 21:51:44 +02:00
};
config = lib.mkIf cfg.enable {
services.postgresql = {
enable = true;
enableTCPIP = true;
2024-04-16 19:22:53 +02:00
package = pkgs.postgresql_15;
2023-06-06 21:51:44 +02:00
settings.listen_addresses = pkgs.lib.mkForce "127.0.0.1,172.17.0.1";
};
2024-02-02 13:45:05 +01:00
networking.firewall.extraCommands = "iptables -A INPUT -p tcp --destination-port 5432 -s 172.16.0.0/12 -j ACCEPT";
};
}