-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathpostgres.nix
More file actions
40 lines (40 loc) · 1.04 KB
/
Copy pathpostgres.nix
File metadata and controls
40 lines (40 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
pkgs,
config,
makeEnable,
realUsers,
...
}:
makeEnable config "myModules.postgres" true {
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;
# '';
};
services.pgadmin = {
enable = false;
initialEmail = "IvanMalison@gmail.com";
initialPasswordFile = builtins.toFile "password" "This is the content of the file.";
};
}