Skip to content

Commit a2f12f0

Browse files
committed
feat: support a pg 14 version of postgres bundle
1 parent c1b31ca commit a2f12f0

File tree

6 files changed

+44
-5
lines changed

6 files changed

+44
-5
lines changed

flake.nix

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@
166166
x != ./nix/ext/timescaledb-2.9.1.nix &&
167167
x != ./nix/ext/plv8.nix
168168
) ourExtensions;
169-
169+
pg14FilteredExtensions = builtins.filter
170+
(
171+
x:
172+
x != ./nix/ext/pg_stat_monitor.nix
173+
) ourExtensions;
170174
orioledbExtensions = orioleFilteredExtensions ++ [ ./nix/ext/orioledb.nix ];
171175
dbExtensions17 = orioleFilteredExtensions;
172176
getPostgresqlPackage = version:
@@ -213,6 +217,8 @@
213217
then orioledbExtensions
214218
else if (builtins.elem version [ "17" ])
215219
then dbExtensions17
220+
else if (builtins.elem version [ "14" ])
221+
then pg14FilteredExtensions
216222
else ourExtensions;
217223
in
218224
map (path: pkgs.callPackage path { inherit postgresql; }) extensionsToUse;
@@ -326,6 +332,7 @@
326332
SHELL_PATH = "${pkgs.bash}/bin/bash";
327333
PGSQL_DEFAULT_PORT = "${pgsqlDefaultPort}";
328334
PGSQL_SUPERUSER = "${pgsqlSuperuser}";
335+
PSQL14_BINDIR = "${basePackages.psql_14.bin}";
329336
PSQL15_BINDIR = "${basePackages.psql_15.bin}";
330337
PSQL17_BINDIR = "${basePackages.psql_17.bin}";
331338
PSQL_CONF_FILE = "${paths.pgconfigFile}";
@@ -392,6 +399,7 @@
392399

393400
# Define the available PostgreSQL versions
394401
postgresVersions = {
402+
psql_14 = makePostgres "14";
395403
psql_15 = makePostgres "15";
396404
psql_17 = makePostgres "17";
397405
psql_orioledb-17 = makePostgres "orioledb-17";
@@ -408,6 +416,7 @@
408416
pkgs.callPackage ./nix/ext/pg_regress.nix {
409417
postgresql = postgresqlPackage;
410418
};
419+
postgresql_14 = getPostgresqlPackage "14";
411420
postgresql_15 = getPostgresqlPackage "15";
412421
postgresql_17 = getPostgresqlPackage "17";
413422
postgresql_orioledb-17 = getPostgresqlPackage "orioledb-17";
@@ -418,6 +427,7 @@
418427
cargo-pgrx_0_12_6 = pkgs.cargo-pgrx.cargo-pgrx_0_12_6;
419428
cargo-pgrx_0_12_9 = pkgs.cargo-pgrx.cargo-pgrx_0_12_9;
420429
# PostgreSQL versions.
430+
psql_14 = postgresVersions.psql_14;
421431
psql_15 = postgresVersions.psql_15;
422432
psql_17 = postgresVersions.psql_17;
423433
psql_orioledb-17 = postgresVersions.psql_orioledb-17;
@@ -515,6 +525,7 @@
515525
substitute ${./nix/tools/run-client.sh.in} $out/bin/start-postgres-client \
516526
--subst-var-by 'PGSQL_DEFAULT_PORT' '${pgsqlDefaultPort}' \
517527
--subst-var-by 'PGSQL_SUPERUSER' '${pgsqlSuperuser}' \
528+
--subst-var-by 'PSQL14_BINDIR' '${basePackages.psql_14.bin}' \
518529
--subst-var-by 'PSQL15_BINDIR' '${basePackages.psql_15.bin}' \
519530
--subst-var-by 'PSQL17_BINDIR' '${basePackages.psql_17.bin}' \
520531
--subst-var-by 'PSQLORIOLEDB17_BINDIR' '${basePackages.psql_orioledb-17.bin}' \

nix/ext/pgaudit.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ let
1414
version = "1.7.0";
1515
hash = "sha256-8pShPr4HJaJQPjW1iPJIpj3CutTx8Tgr+rOqoXtgCcw=";
1616
};
17+
"14" = {
18+
version = "1.6.3";
19+
hash = "sha256-KgLidJHjUK9BTp6ffmGUj1chcwIe6IzlcadRpGCfNdM=";
20+
};
1721
}.${lib.versions.major postgresql.version} or (throw "Source for pgaudit is not available for ${postgresql.version}");
1822
in
1923
stdenv.mkDerivation {

nix/postgresql/14.nix

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import ./generic.nix {
2+
version = "14.18";
3+
hash = "sha256-g6sp1r/D3Fiy7TxmQRT9++tqBFDEuNf6aa7pHjyhT44=";
4+
# muslPatches = {
5+
# disable-test-collate-icu-utf8 = {
6+
# url = "https://git.alpinelinux.org/aports/plain/main/postgresql14/disable-test-collate.icu.utf8.patch?id=56999e6d0265ceff5c5239f85fdd33e146f06cb7";
7+
# hash = "sha256-jXe23AxnFjEl+TZQm4R7rStk2Leo08ctxMNmu1xr5zM=";
8+
# };
9+
# dont-use-locale-a = {
10+
# url = "https://git.alpinelinux.org/aports/plain/main/postgresql14/dont-use-locale-a-on-musl.patch?id=56999e6d0265ceff5c5239f85fdd33e146f06cb7";
11+
# hash = "sha256-fk+y/SvyA4Tt8OIvDl7rje5dLs3Zw+Ln1oddyYzerOo=";
12+
# };
13+
# };
14+
}

nix/postgresql/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
self:
22
let
33
versions = {
4+
postgresql_14 = ./14.nix;
45
postgresql_15 = ./15.nix;
56
postgresql_17 = ./17.nix;
67
postgresql_orioledb-17 = ./orioledb-17.nix;

nix/tools/run-client.sh.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ print_help() {
1313
echo "Usage: nix run .#start-client -- [options]"
1414
echo
1515
echo "Options:"
16-
echo " -v, --version [15|16|orioledb-16] Specify the PostgreSQL version to use (required)"
16+
echo " -v, --version [14|15|16|orioledb-16] Specify the PostgreSQL version to use (required)"
1717
echo " -u, --user USER Specify the user/role to use (default: postgres)"
1818
echo " -h, --help Show this help message"
1919
echo
@@ -81,7 +81,11 @@ if [[ -z "$PSQL_VERSION" ]]; then
8181
fi
8282

8383
# Determine PostgreSQL version
84-
if [ "$PSQL_VERSION" == "15" ]; then
84+
if [ "$PSQL_VERSION" == "14" ]; then
85+
echo "Starting client for PSQL 14"
86+
PSQL14=@PSQL14_BINDIR@
87+
BINDIR="$PSQL14"
88+
elif [ "$PSQL_VERSION" == "15" ]; then
8589
echo "Starting client for PSQL 15"
8690
PSQL15=@PSQL15_BINDIR@
8791
BINDIR="$PSQL15"

nix/tools/run-server.sh.in

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ else
141141
PGSODIUM_GETKEY_SCRIPT="${PGSODIUM_GETKEY_SCRIPT:-@PGSODIUM_GETKEY@}"
142142
fi
143143
# Verify version and set binary directory
144-
if [ "$VERSION" == "15" ]; then
144+
145+
if [ "$VERSION" == "14" ]; then
146+
echo "Starting server for PSQL 14"
147+
PSQL14=@PSQL14_BINDIR@
148+
BINDIR="$PSQL14"
149+
elif [ "$VERSION" == "15" ]; then
145150
echo "Starting server for PSQL 15"
146151
PSQL15=@PSQL15_BINDIR@
147152
BINDIR="$PSQL15"
@@ -154,7 +159,7 @@ elif [ "$VERSION" == "orioledb-17" ]; then
154159
PSQLORIOLEDB17=@PSQLORIOLEDB17_BINDIR@
155160
BINDIR="$PSQLORIOLEDB17"
156161
else
157-
echo "Please provide a valid Postgres version (15, 17, orioledb-17)"
162+
echo "Please provide a valid Postgres version (14, 15, 17, orioledb-17)"
158163
exit 1
159164
fi
160165

0 commit comments

Comments
 (0)