blob: 6627e5019658556b7f6682d4f351bdbbf8b09c09 (
plain)
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
41
42
43
44
45
46
47
48
49
50
|
{
pkgs,
lib,
config,
...
}:
let
newPostgres = pkgs.postgresql_18_jit;
cfg = config.services.postgresql;
# upgrade-pg-cluster = pkgs.writeScriptBin "upgrade-pg-cluster" ''
# set -eux
# systemctl stop postgresql
# export NEWDATA="/var/lib/postgresql/${newPostgres.psqlSchema}"
# export NEWBIN="${newPostgres}/bin"
# export OLDDATA="${cfg.dataDir}"
# export OLDBIN="${cfg.finalPackage}/bin"
# install -d -m 0700 -o postgres -g postgres "$NEWDATA"
# cd "$NEWDATA"
# sudo -u postgres "$NEWBIN/initdb" -D "$NEWDATA" ${lib.escapeShellArgs cfg.initdbArgs}
# sudo -u postgres "$NEWBIN/pg_upgrade" \
# --old-datadir "$OLDDATA" --new-datadir "$NEWDATA" \
# --old-bindir "$OLDBIN" --new-bindir "$NEWBIN" \
# "$@"
# '';
in
{
services.postgresql = {
enable = false;
package = pkgs.postgresql_18_jit;
enableTCPIP = true;
enableJIT = true;
settings = {
password_encryption = "scram-sha-256";
};
authentication = ''
# TYPE DATABASE USER ADDRESS METHOD
local all all peer
host all postgres all reject
host all all all scram-sha-256
'';
}; # end of services.postgreslq
# environment.systemPackages = [ upgrade-pg-cluster ];
}
|