ADD : databases : create load and configure postgresql

This commit is contained in:
Alexandre LUCAZEAU 2022-07-08 08:33:52 +00:00
parent 9724af4bde
commit f2f069251c
2 changed files with 20 additions and 0 deletions

View File

@ -3,6 +3,7 @@
./hardware-configuration.nix
./nextcloud.nix
./backup.nix
./databases.nix
../modules/users.nix
../modules/common.nix
../modules/prometheus-node.nix

19
hosts/next/databases.nix Normal file
View File

@ -0,0 +1,19 @@
{config, pkgs, ...}:
{
networking.firewall.allowedTCPPorts = [ 5432 ];
# Enable PostgreSQL
services.postgresql = {
enable = true;
authentication = "host all all 192.168.0.0/16 trust";
# Ensure the database, user, and permissions always exist
ensureDatabases = [ "pizzajoffredb" ];
ensureUsers = [
{ name = "pizzajoffre";
ensurePermissions."DATABASE pizzajoffredb" = "ALL PRIVILEGES";
}
];
};
}