Skip to content

Commit df1509e

Browse files
committed
Build pg_graphql 1.2.0 using pgx 0.7.1
1 parent a9217e9 commit df1509e

File tree

9 files changed

+4342
-145
lines changed

9 files changed

+4342
-145
lines changed

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
./nix/ext/pg_net.nix
150150
./nix/ext/pg_hashids.nix
151151
./nix/ext/pgsodium.nix
152-
./nix/ext/pg_graphql.nix
152+
./nix/ext/pg_graphql
153153
./nix/ext/pg_stat_monitor.nix
154154
./nix/ext/pg_jsonschema.nix
155155
./nix/ext/pgvector.nix

nix/cargo-pgrx/buildPgrxExtension.nix

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ let
8888
pushd "${buildAndTestSubdir}"
8989
'';
9090
maybeLeaveBuildAndTestSubdir = lib.optionalString (buildAndTestSubdir != null) "popd";
91+
pgrxBinaryName = if builtins.compareVersions "0.7.4" cargo-pgrx.version >= 0 then "pgx" else "pgrx";
9192

9293
pgrxPostgresMajor = lib.versions.major postgresql.version;
9394
preBuildAndTest = ''
9495
export PGRX_HOME=$(mktemp -d)
96+
export PGX_HOME=$PGRX_HOME
9597
export PGDATA="$PGRX_HOME/data-${pgrxPostgresMajor}/"
96-
cargo-pgrx pgrx init "--pg${pgrxPostgresMajor}" ${lib.getDev postgresql}/bin/pg_config
98+
cargo-${pgrxBinaryName} ${pgrxBinaryName} init "--pg${pgrxPostgresMajor}" ${lib.getDev postgresql}/bin/pg_config
9799
98100
# unix sockets work in sandbox, too.
99101
export PGHOST="$(mktemp -d)"
@@ -128,7 +130,6 @@ let
128130
cargo-pgrx
129131
postgresql
130132
pkg-config
131-
rustPlatform.bindgenHook
132133
]
133134
++ lib.optionals useFakeRustfmt [ fakeRustfmt ];
134135

@@ -139,9 +140,10 @@ let
139140
${preBuildAndTest}
140141
${maybeEnterBuildAndTestSubdir}
141142
142-
PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}" \
143-
${lib.optionalString stdenv.hostPlatform.isDarwin ''RUSTFLAGS="''${RUSTFLAGS:+''${RUSTFLAGS} }-Clink-args=-Wl,-undefined,dynamic_lookup"''} \
144-
cargo pgrx package \
143+
export PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}"
144+
export PGX_BUILD_FLAGS="$PGRX_BUILD_FLAGS"
145+
${lib.optionalString true ''RUSTFLAGS="''${RUSTFLAGS:+''${RUSTFLAGS} }-Clink-args=-Wl,-undefined,dynamic_lookup"''} \
146+
cargo ${pgrxBinaryName} package \
145147
--pg-config ${lib.getDev postgresql}/bin/pg_config \
146148
${maybeDebugFlag} \
147149
--features "${builtins.concatStringsSep " " buildFeatures}" \
@@ -161,7 +163,7 @@ let
161163
162164
${maybeEnterBuildAndTestSubdir}
163165
164-
cargo-pgrx pgrx stop all
166+
cargo-${pgrxBinaryName} ${pgrxBinaryName} stop all
165167
166168
mv $out/${postgresql}/* $out
167169
mv $out/${postgresql.lib}/* $out

nix/cargo-pgrx/default.nix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ let
2020
hash,
2121
cargoHash,
2222
}:
23+
let
24+
pname = if builtins.compareVersions "0.7.4" version >= 0 then
25+
"cargo-pgx"
26+
else
27+
"cargo-pgrx";
28+
in
2329
rustPlatform.buildRustPackage rec {
2430
# rust-overlay uses 'cargo-auditable' wrapper for 'cargo' command, but it
2531
# is using older version 0.18.1 of 'cargo_metadata' which doesn't support
2632
# rust edition 2024, so we disable the 'cargo-auditable' just for now.
2733
# ref: https://github.com/oxalica/rust-overlay/issues/153
2834
auditable = false;
29-
pname = "cargo-pgrx";
35+
inherit pname;
3036
inherit version;
3137
src = fetchCrate {
3238
inherit version pname hash;

nix/cargo-pgrx/versions.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
{
2+
"0.7.1": {
3+
"hash": "sha256-t/gdlrBeP6KFkBFJiZUa8KKVJVYMf6753vQGKJdytss=",
4+
"rust": {
5+
"1.65.0": {
6+
"cargoHash": "sha256-muce9wT4LAJmfNLWWEShARnpZgglXe/KrfxlitmGgXk="
7+
},
8+
"1.82.0": {
9+
"cargoHash": "sha256-muce9wT4LAJmfNLWWEShARnpZgglXe/KrfxlitmGgXk="
10+
}
11+
}
12+
},
213
"0.9.5": {
314
"hash": "sha256-GpXQUOBuojAqPXyRR+k8AVW2XzBbn6V0+2dhP4w4Vs8=",
415
"rust": {

nix/ext/pg_graphql.nix

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)