postgresqlPackages.{pgvecto-rs,timescaledb_toolkit}: fix build on darwin

cargo-pgrx runs a temporary PostgreSQL cluster when building. This needs
to run with unix sockets only, otherwise it breaks in the darwin
sandbox.
This commit is contained in:
Wolfgang Walther 2024-11-23 12:24:33 +01:00
parent 8d35585477
commit 62b175ed21
No known key found for this signature in database
GPG Key ID: B39893FA5F65CAE1
2 changed files with 11 additions and 6 deletions

View File

@ -85,15 +85,21 @@ let
pgrxPostgresMajor = lib.versions.major postgresql.version; pgrxPostgresMajor = lib.versions.major postgresql.version;
preBuildAndTest = '' preBuildAndTest = ''
export PGRX_HOME=$(mktemp -d) export PGRX_HOME="$(mktemp -d)"
export PGDATA="$PGRX_HOME/data-${pgrxPostgresMajor}/" export PGDATA="$PGRX_HOME/data-${pgrxPostgresMajor}/"
cargo-pgrx pgrx init "--pg${pgrxPostgresMajor}" ${lib.getDev postgresql}/bin/pg_config 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. # This is primarily for Mac or other Nix systems that don't use the nixbld user.
export USER="$(whoami)" export USER="$(whoami)"
pg_ctl start pg_ctl start
createuser -h localhost --superuser --createdb "$USER" || true createuser --superuser --createdb "$USER" || true
pg_ctl stop pg_ctl stop
''; '';

View File

@ -92,10 +92,9 @@ in
}; };
meta = with lib; { meta = with lib; {
# Upstream removed support for PostgreSQL 12 and 13 on 0.3.0: https://github.com/tensorchord/pgvecto.rs/issues/343 # Upstream removed support for PostgreSQL 13 on 0.3.0: https://github.com/tensorchord/pgvecto.rs/issues/343
broken = broken =
stdenv.hostPlatform.isDarwin (versionOlder postgresql.version "14")
|| (versionOlder postgresql.version "14")
|| ||
# PostgreSQL 17 support issue upstream: https://github.com/tensorchord/pgvecto.rs/issues/607 # PostgreSQL 17 support issue upstream: https://github.com/tensorchord/pgvecto.rs/issues/607
# Check after next package update. # Check after next package update.