2024-01-04 19:52:46 -07:00
|
|
|
{ pkgs, config, makeEnable, realUsers, ... }:
|
2024-01-05 01:34:26 -07:00
|
|
|
makeEnable config "modules.postgres" true {
|
2024-01-03 13:45:20 -07:00
|
|
|
services.postgresql = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.postgresql_15;
|
|
|
|
ensureDatabases = [ "railbird" "public" ];
|
|
|
|
authentication = pkgs.lib.mkOverride 10 ''
|
|
|
|
#type database DBuser CIDR-ADDRESS auth-method
|
|
|
|
local all all trust
|
2024-01-04 19:52:46 -07:00
|
|
|
host all all 0.0.0.0/0 trust
|
|
|
|
host all all ::1/128 trust
|
|
|
|
'';
|
|
|
|
ensureUsers = map (username: {
|
|
|
|
name = username;
|
|
|
|
ensureClauses = {
|
|
|
|
superuser = true;
|
|
|
|
createrole = true;
|
|
|
|
createdb = true;
|
|
|
|
};
|
|
|
|
}) realUsers;
|
2024-01-04 20:02:11 -07:00
|
|
|
# initialScript = pkgs.writeText "init-sql-script" ''
|
|
|
|
# CREATE DATABASE IF NOT EXISTS railbird;
|
|
|
|
# \c railbird
|
|
|
|
# CREATE SCHEMA IF NOT EXISTS railbird;
|
|
|
|
# '';
|
2024-01-03 13:45:20 -07:00
|
|
|
};
|
|
|
|
services.pgadmin = {
|
|
|
|
enable = true;
|
|
|
|
initialEmail = "IvanMalison@gmail.com";
|
|
|
|
initialPasswordFile = (builtins.toFile "password" "This is the content of the file.");
|
|
|
|
};
|
|
|
|
}
|