Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ postgres_major:

# Full version strings for each major version
postgres_release:
postgresorioledb-17: "17.5.1.017-orioledb"
postgres17: "17.4.1.074"
postgres15: "15.8.1.131"
postgresorioledb-17: "17.5.1.017-orioledb-pg-graphql-1"
postgres17: "17.4.1.074-pg-graphql-1"
postgres15: "15.8.1.131-pg-graphql-1"

# Non Postgres Extensions
pgbouncer_release: "1.19.0"
Expand Down
19 changes: 13 additions & 6 deletions nix/cargo-pgrx/buildPgrxExtension.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@
buildFeatures ? [ ],
cargoBuildFlags ? [ ],
postgresql,
# enable override to generate bindings using bindgenHook.
# Some older versions of cargo-pgrx use a bindgenHook that is not compatible with the
# current clang version present in stdenv
bindgenHook ? rustPlatform.bindgenHook,
# cargo-pgrx calls rustfmt on generated bindings, this is not strictly necessary, so we avoid the
# dependency here. Set to false and provide rustfmt in nativeBuildInputs, if you need it, e.g.
# if you include the generated code in the output via postInstall.
Expand Down Expand Up @@ -87,12 +91,14 @@ let
pushd "${buildAndTestSubdir}"
'';
maybeLeaveBuildAndTestSubdir = lib.optionalString (buildAndTestSubdir != null) "popd";
pgrxBinaryName = if builtins.compareVersions "0.7.4" cargo-pgrx.version >= 0 then "pgx" else "pgrx";

pgrxPostgresMajor = lib.versions.major postgresql.version;
preBuildAndTest = ''
export PGRX_HOME=$(mktemp -d)
export PGX_HOME=$PGRX_HOME
export PGDATA="$PGRX_HOME/data-${pgrxPostgresMajor}/"
cargo-pgrx pgrx init "--pg${pgrxPostgresMajor}" ${lib.getDev postgresql}/bin/pg_config
cargo-${pgrxBinaryName} ${pgrxBinaryName} init "--pg${pgrxPostgresMajor}" ${lib.getDev postgresql}/bin/pg_config

# unix sockets work in sandbox, too.
export PGHOST="$(mktemp -d)"
Expand Down Expand Up @@ -127,7 +133,7 @@ let
cargo-pgrx
postgresql
pkg-config
rustPlatform.bindgenHook
bindgenHook
]
++ lib.optionals useFakeRustfmt [ fakeRustfmt ];

Expand All @@ -138,9 +144,10 @@ let
${preBuildAndTest}
${maybeEnterBuildAndTestSubdir}

PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}" \
${lib.optionalString stdenv.hostPlatform.isDarwin ''RUSTFLAGS="''${RUSTFLAGS:+''${RUSTFLAGS} }-Clink-args=-Wl,-undefined,dynamic_lookup"''} \
cargo pgrx package \
export PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}"
export PGX_BUILD_FLAGS="$PGRX_BUILD_FLAGS"
${lib.optionalString true ''RUSTFLAGS="''${RUSTFLAGS:+''${RUSTFLAGS} }-Clink-args=-Wl,-undefined,dynamic_lookup"''} \
cargo ${pgrxBinaryName} package \
--pg-config ${lib.getDev postgresql}/bin/pg_config \
${maybeDebugFlag} \
--features "${builtins.concatStringsSep " " buildFeatures}" \
Expand All @@ -160,7 +167,7 @@ let

${maybeEnterBuildAndTestSubdir}

cargo-pgrx pgrx stop all
cargo-${pgrxBinaryName} ${pgrxBinaryName} stop all

mv $out/${postgresql}/* $out
mv $out/${postgresql.lib}/* $out
Expand Down
5 changes: 4 additions & 1 deletion nix/cargo-pgrx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ let
hash,
cargoHash,
}:
let
pname = if builtins.compareVersions "0.7.4" version >= 0 then "cargo-pgx" else "cargo-pgrx";
in
rustPlatform.buildRustPackage rec {
# rust-overlay uses 'cargo-auditable' wrapper for 'cargo' command, but it
# is using older version 0.18.1 of 'cargo_metadata' which doesn't support
# rust edition 2024, so we disable the 'cargo-auditable' just for now.
# ref: https://github.com/oxalica/rust-overlay/issues/153
auditable = false;
pname = "cargo-pgrx";
inherit pname;
inherit version;
src = fetchCrate { inherit version pname hash; };
inherit cargoHash;
Expand Down
41 changes: 40 additions & 1 deletion nix/cargo-pgrx/versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,44 @@
{
"0.6.1": {
"hash": "sha256-O4eHVbJBudybsPab+zr2eXnfheREMqLAHAKm2GDbfrs=",
"rust": {
"1.82.0": {
"cargoHash": "sha256-MucGrA3qXgJOcT2LMNmoNOhQi8QA3LuqgZEHKycLCCo="
}
}
},
"0.7.1": {
"hash": "sha256-t/gdlrBeP6KFkBFJiZUa8KKVJVYMf6753vQGKJdytss=",
"rust": {
"1.82.0": {
"cargoHash": "sha256-muce9wT4LAJmfNLWWEShARnpZgglXe/KrfxlitmGgXk="
}
}
},
"0.9.5": {
"hash": "sha256-GpXQUOBuojAqPXyRR+k8AVW2XzBbn6V0+2dhP4w4Vs8=",
"rust": {
"1.70.0": {
"cargoHash": "sha256-YbwGh3tbt8W9/VOu11fTWO9fRMUlrwJnG4wxUHuyX10="
}
}
},
"0.9.7": {
"hash": "sha256-uDBq7tUZ9f8h5nlRFR1mv4+Ty1OFtAk5P7OTNQPI1gI=",
"rust": {
"1.70.0": {
"cargoHash": "sha256-YTkjqMNF+cz5XtELh7+l8KwvRoVKQP7t98nkJwkW218="
}
}
},
"0.10.2": {
"hash": "sha256-FqjfbJmSy5UCpPPPk4bkEyvQCnaH9zYtkI7txgIn+ls=",
"rust": {
"1.70.0": {
"cargoHash": "sha256-syZ3cQq8qDHBLvqmNDGoxeK6zXHJ47Jwkw3uhaXNCzI="
}
}
},
"0.11.2": {
"hash": "sha256-8NlpMDFaltTIA8G4JioYm8LaPJ2RGKH5o6sd6lBHmmM=",
"rust": {
Expand Down Expand Up @@ -57,5 +97,4 @@
}
}
}

}
4 changes: 4 additions & 0 deletions nix/checks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@
;
}
// pkgs.lib.optionalAttrs (system == "x86_64-linux") {
pg_graphql = import ./ext/tests/pg_graphql.nix {
inherit self;
inherit pkgs;
};
wrappers = import ./ext/tests/wrappers.nix {
inherit self;
inherit pkgs;
Expand Down
57 changes: 0 additions & 57 deletions nix/ext/pg_graphql.nix

This file was deleted.

Loading
Loading