nixos-config/hosts/next/databases.nix

27 lines
662 B
Nix

{config, pkgs, ...}:
{
networking.firewall.allowedTCPPorts = [ 5432 5050 ];
# Enable PostgreSQL
services.postgresql = {
enable = true;
enableTCPIP = true;
authentication = "host all all 192.168.0.0/16 trust \nhost all all 10.88.0.0/16 trust";
# Ensure the database, user, and permissions always exist
ensureDatabases = [ "pizzajoffredb" ];
ensureUsers = [
{ name = "pizzajoffre";
ensurePermissions."DATABASE pizzajoffredb" = "ALL PRIVILEGES";
}
];
};
services.pgadmin = {
openFirewall = true;
enable = true;
initialEmail = "pizzajoffre@gmail.com";
initialPasswordFile = /run/pgadmin;
};
}