dotfiles/nixos/postgres.nix

33 lines
1.0 KiB
Nix
Raw Normal View History

{ 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
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;
# 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 = {
2024-02-13 12:27:54 -07:00
enable = false;
2024-01-03 13:45:20 -07:00
initialEmail = "IvanMalison@gmail.com";
initialPasswordFile = (builtins.toFile "password" "This is the content of the file.");
};
}