Skip to content

Commit b606105

Browse files
jfrochesamrose
authored andcommitted
Build pg_graphql 1.2.0 using pgx 0.7.1
1 parent 6c0a7c9 commit b606105

File tree

9 files changed

+4342
-142
lines changed

9 files changed

+4342
-142
lines changed

nix/cargo-pgrx/buildPgrxExtension.nix

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

9192
pgrxPostgresMajor = lib.versions.major postgresql.version;
9293
preBuildAndTest = ''
9394
export PGRX_HOME=$(mktemp -d)
95+
export PGX_HOME=$PGRX_HOME
9496
export PGDATA="$PGRX_HOME/data-${pgrxPostgresMajor}/"
95-
cargo-pgrx pgrx init "--pg${pgrxPostgresMajor}" ${lib.getDev postgresql}/bin/pg_config
97+
cargo-${pgrxBinaryName} ${pgrxBinaryName} init "--pg${pgrxPostgresMajor}" ${lib.getDev postgresql}/bin/pg_config
9698
9799
# unix sockets work in sandbox, too.
98100
export PGHOST="$(mktemp -d)"
@@ -127,7 +129,6 @@ let
127129
cargo-pgrx
128130
postgresql
129131
pkg-config
130-
rustPlatform.bindgenHook
131132
]
132133
++ lib.optionals useFakeRustfmt [ fakeRustfmt ];
133134

@@ -138,9 +139,10 @@ let
138139
${preBuildAndTest}
139140
${maybeEnterBuildAndTestSubdir}
140141
141-
PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}" \
142-
${lib.optionalString stdenv.hostPlatform.isDarwin ''RUSTFLAGS="''${RUSTFLAGS:+''${RUSTFLAGS} }-Clink-args=-Wl,-undefined,dynamic_lookup"''} \
143-
cargo pgrx package \
142+
export PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}"
143+
export PGX_BUILD_FLAGS="$PGRX_BUILD_FLAGS"
144+
${lib.optionalString true ''RUSTFLAGS="''${RUSTFLAGS:+''${RUSTFLAGS} }-Clink-args=-Wl,-undefined,dynamic_lookup"''} \
145+
cargo ${pgrxBinaryName} package \
144146
--pg-config ${lib.getDev postgresql}/bin/pg_config \
145147
${maybeDebugFlag} \
146148
--features "${builtins.concatStringsSep " " buildFeatures}" \
@@ -160,7 +162,7 @@ let
160162
161163
${maybeEnterBuildAndTestSubdir}
162164
163-
cargo-pgrx pgrx stop all
165+
cargo-${pgrxBinaryName} ${pgrxBinaryName} stop all
164166
165167
mv $out/${postgresql}/* $out
166168
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 { inherit version pname hash; };
3238
inherit cargoHash;

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 & 134 deletions
This file was deleted.

0 commit comments

Comments
 (0)