Skip to content

feat: multiple versions for the wrappers extension #1663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jul 8, 2025
Merged
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
28 changes: 26 additions & 2 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
run: |
cat << 'EOF' | sudo tee /etc/nix/upload-to-cache.sh > /dev/null
#!/usr/bin/env bash
set -eouf
set -euf
export IFS=' '
/nix/var/nix/profiles/default/bin/nix copy --to 's3://nix-postgres-artifacts?secret-key=/etc/nix/nix-secret-key' $OUT_PATHS
EOF
Expand All @@ -77,10 +77,34 @@ jobs:
extra-conf: |
substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com
trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
- name: Aggressive disk cleanup for DuckDB build
if: matrix.runner == 'macos-latest-xlarge'
run: |
echo "=== BEFORE CLEANUP ==="
df -h
# Remove major space consumers
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform || true
sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/watchOS.platform || true
sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/tvOS.platform || true
# Clean everything possible
sudo rm -rf /opt/ghc || true
sudo rm -rf /usr/local/share/boost || true
sudo rm -rf /opt/homebrew || true
sudo xcrun simctl delete all 2>/dev/null || true
# Aggressive cache cleanup
sudo rm -rf /System/Library/Caches/* 2>/dev/null || true
sudo rm -rf /Library/Caches/* 2>/dev/null || true
sudo rm -rf ~/Library/Caches/* 2>/dev/null || true
sudo rm -rf /private/var/log/* 2>/dev/null || true
sudo rm -rf /tmp/* 2>/dev/null || true
echo "=== AFTER CLEANUP ==="
df -h
- name: Build psql bundle
run: >
nix run "github:Mic92/nix-fast-build?rev=b1dae483ab7d4139a6297e02b6de9e5d30e43d48"
-- --skip-cached --no-nom
-- --skip-cached --no-nom ${{ matrix.runner == 'macos-latest-xlarge' && '--max-jobs 1' || '' }}
--flake ".#checks.$(nix eval --raw --impure --expr 'builtins.currentSystem')"
env:
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
Expand Down
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.0.1.100-orioledb"
postgres17: "17.4.1.050"
postgres15: "15.8.1.107"
postgresorioledb-17: "17.0.1.101-orioledb"
postgres17: "17.4.1.051"
postgres15: "15.8.1.108"

# Non Postgres Extensions
pgbouncer_release: "1.19.0"
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions nix/cargo-pgrx/buildPgrxExtension.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

{
lib,
cargo-pgrx,
pkg-config,
rustPlatform,
stdenv,
Security,
darwin,
writeShellScriptBin,
}:

Expand Down Expand Up @@ -94,7 +93,13 @@ let
export PGRX_HOME=$(mktemp -d)
export PGDATA="$PGRX_HOME/data-${pgrxPostgresMajor}/"
cargo-pgrx pgrx init "--pg${pgrxPostgresMajor}" ${lib.getDev postgresql}/bin/pg_config
echo "unix_socket_directories = '$(mktemp -d)'" > "$PGDATA/postgresql.conf"

# unix sockets work in sandbox, too.
export PGHOST="$(mktemp -d)"
cat > "$PGDATA/postgresql.conf" <<EOF
listen_addresses = '''
unix_socket_directories = '$PGHOST'
EOF

# This is primarily for Mac or other Nix systems that don't use the nixbld user.
export USER="$(whoami)"
Expand All @@ -112,7 +117,9 @@ let
# so we don't accidentally `(rustPlatform.buildRustPackage argsForBuildRustPackage) // { ... }` because
# we forgot parentheses
finalArgs = argsForBuildRustPackage // {
buildInputs = (args.buildInputs or [ ]) ++ lib.optionals stdenv.hostPlatform.isDarwin [ Security ];
buildInputs =
(args.buildInputs or [ ])
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ];

nativeBuildInputs =
(args.nativeBuildInputs or [ ])
Expand Down Expand Up @@ -156,6 +163,7 @@ let
cargo-pgrx pgrx stop all

mv $out/${postgresql}/* $out
mv $out/${postgresql.lib}/* $out
rm -rf $out/nix

${maybeLeaveBuildAndTestSubdir}
Expand Down
14 changes: 7 additions & 7 deletions nix/cargo-pgrx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
makeRustPlatform,
stdenv,
rust-bin,
rustVersion ? "1.85.1",
}:
let
rustVersion = "1.85.1";
rustPlatform = makeRustPlatform {
cargo = rust-bin.stable.${rustVersion}.default;
rustc = rust-bin.stable.${rustVersion}.default;
};
generic =
mkCargoPgrx =
{
version,
hash,
Expand Down Expand Up @@ -57,25 +57,25 @@ let
};
in
{
cargo-pgrx_0_11_3 = generic {
cargo-pgrx_0_11_3 = mkCargoPgrx {
version = "0.11.3";
hash = "sha256-UHIfwOdXoJvR4Svha6ud0FxahP1wPwUtviUwUnTmLXU=";
cargoHash = "sha256-j4HnD8Zt9uhlV5N7ldIy9564o9qFEqs5KfXHmnQ1WEw=";
};
cargo-pgrx_0_12_6 = generic {
cargo-pgrx_0_12_6 = mkCargoPgrx {
version = "0.12.6";
hash = "sha256-7aQkrApALZe6EoQGVShGBj0UIATnfOy2DytFj9IWdEA=";
cargoHash = "sha256-Di4UldQwAt3xVyvgQT1gUhdvYUVp7n/a72pnX45kP0w=";
};
cargo-pgrx_0_12_9 = generic {
cargo-pgrx_0_12_9 = mkCargoPgrx {
version = "0.12.9";
hash = "sha256-aR3DZAjeEEAjLQfZ0ZxkjLqTVMIEbU0UiZ62T4BkQq8=";
cargoHash = "sha256-KTKcol9qSNLQZGW32e6fBb6cPkUGItknyVpLdBYqrBY=";
};
cargo-pgrx_0_14_3 = generic {
cargo-pgrx_0_14_3 = mkCargoPgrx {
version = "0.14.3";
hash = "sha256-3TsNpEqNm3Uol5XPW1i0XEbP2fF2+RKB2d7lO6BDnvQ=";
cargoHash = "sha256-Ny7j56pwB+2eEK62X0nWfFKQy5fBz+Q1oyvecivxLkk=";
};
inherit rustPlatform;
inherit mkCargoPgrx;
}
38 changes: 38 additions & 0 deletions nix/cargo-pgrx/mkPgrxExtension.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
callPackage,
rustVersion,
pgrxVersion,
makeRustPlatform,
rust-bin,
}:
let
inherit ((callPackage ./default.nix { inherit rustVersion; })) mkCargoPgrx;

rustPlatform = makeRustPlatform {
cargo = rust-bin.stable.${rustVersion}.default;
rustc = rust-bin.stable.${rustVersion}.default;
};

versions = builtins.fromJSON (builtins.readFile ./versions.json);

cargo-pgrx =
let
pgrx =
versions.${pgrxVersion}
or (throw "Unsupported pgrx version ${pgrxVersion}. Available versions: ${builtins.toString (builtins.attrNames versions)}. Change 'nix/cargo-pgrx/versions.json' to add support for new versions.");
mapping = {
inherit (pgrx) hash;
cargoHash =
pgrx.rust."${rustVersion}".cargoHash
or (throw "Unsupported rust version ${rustVersion} for pgrx version ${pgrxVersion}. Available Rust versions: ${builtins.toString (builtins.attrNames pgrx.rust)}. Change 'nix/cargo-pgrx/versions.json' to add support for new versions.");
};
in
mkCargoPgrx {
inherit (mapping) hash cargoHash;
version = pgrxVersion;
};
in
callPackage ./buildPgrxExtension.nix {
inherit rustPlatform;
inherit cargo-pgrx;
}
61 changes: 61 additions & 0 deletions nix/cargo-pgrx/versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"0.11.2": {
"hash": "sha256-8NlpMDFaltTIA8G4JioYm8LaPJ2RGKH5o6sd6lBHmmM=",
"rust": {
"1.70.0": {
"cargoHash": "sha256-qTb3JV3u42EilaK2jP9oa5D09mkuHyRbGGRs9Rg4TzI="
},
"1.76.0": {
"cargoHash": "sha256-qTb3JV3u42EilaK2jP9oa5D09mkuHyRbGGRs9Rg4TzI="
},
"1.85.1": {
"cargoHash": "sha256-CbU5B0pvB9ApTZOdYP/ZwuIG8bqGzk/ING2PCM0q2bQ="
}
}
},
"0.11.3": {
"hash": "sha256-UHIfwOdXoJvR4Svha6ud0FxahP1wPwUtviUwUnTmLXU=",
"rust": {
"1.76.0": {
"cargoHash": "sha256-j4HnD8Zt9uhlV5N7ldIy9564o9qFEqs5KfXHmnQ1WEw="
},
"1.85.1": {
"cargoHash": "sha256-KBlT3FARjGcbtHIGDoC6ir3aNXXfDRmIoy990SOqoFg="
}
}
},
"0.12.6": {
"hash": "sha256-7aQkrApALZe6EoQGVShGBj0UIATnfOy2DytFj9IWdEA=",
"rust": {
"1.80.0": {
"cargoHash": "sha256-Di4UldQwAt3xVyvgQT1gUhdvYUVp7n/a72pnX45kP0w="
},
"1.81.0": {
"cargoHash": "sha256-Di4UldQwAt3xVyvgQT1gUhdvYUVp7n/a72pnX45kP0w="
}
}
},
"0.12.9": {
"hash": "sha256-aR3DZAjeEEAjLQfZ0ZxkjLqTVMIEbU0UiZ62T4BkQq8=",
"rust": {
"1.81.0": {
"cargoHash": "sha256-53HKhvsKLTa2JCByLEcK3UzWXoM+LTatd98zvS1C9no="
},
"1.84.0": {
"cargoHash": "sha256-KTKcol9qSNLQZGW32e6fBb6cPkUGItknyVpLdBYqrBY="
},
"1.87.0": {
"cargoHash": "sha256-KTKcol9qSNLQZGW32e6fBb6cPkUGItknyVpLdBYqrBY="
}
}
},
"0.14.3": {
"hash": "sha256-3TsNpEqNm3Uol5XPW1i0XEbP2fF2+RKB2d7lO6BDnvQ=",
"rust": {
"1.87.0": {
"cargoHash": "sha256-Ny7j56pwB+2eEK62X0nWfFKQy5fBz+Q1oyvecivxLkk="
}
}
}

}
15 changes: 11 additions & 4 deletions nix/checks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
let
# Create a testing harness for a PostgreSQL package. This is used for
# 'nix flake check', and works with any PostgreSQL package you hand it.
# deadnix: skip
makeCheckHarness =
pgpkg:
let
Expand Down Expand Up @@ -286,16 +287,15 @@
'';
in
{
psql_15 = makeCheckHarness self'.packages."psql_15/bin";
psql_17 = makeCheckHarness self'.packages."psql_17/bin";
psql_orioledb-17 = makeCheckHarness self'.packages."psql_orioledb-17/bin";
psql_15 = self'.packages."psql_15/bin";
psql_17 = self'.packages."psql_17/bin";
psql_orioledb-17 = self'.packages."psql_orioledb-17/bin";
inherit (self'.packages)
wal-g-2
wal-g-3
dbmate-tool
pg_regress
;
devShell = self'.devShells.default;
}
// pkgs.lib.optionalAttrs (system == "aarch64-linux") {
inherit (self'.packages)
Expand All @@ -306,6 +306,13 @@
postgresql_17_debug
postgresql_17_src
;
}
// pkgs.lib.optionalAttrs (system == "x86_64-linux") {
wrappers = import ./ext/tests/wrappers.nix {
inherit self;
inherit pkgs;
};
devShell = self'.devShells.default;
};
};
}
Loading