Unverified Commit 62b175ed authored by Wolfgang Walther's avatar Wolfgang Walther
Browse files

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.
parent 8d355854
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -85,15 +85,21 @@ let

  pgrxPostgresMajor = lib.versions.major postgresql.version;
  preBuildAndTest = ''
    export PGRX_HOME=$(mktemp -d)
    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)"
    pg_ctl start
    createuser -h localhost --superuser --createdb "$USER" || true
    createuser --superuser --createdb "$USER" || true
    pg_ctl stop
  '';

+2 −3
Original line number Diff line number Diff line
@@ -92,10 +92,9 @@ in
    };

    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 =
        stdenv.hostPlatform.isDarwin
        || (versionOlder postgresql.version "14")
        (versionOlder postgresql.version "14")
        ||
          # PostgreSQL 17 support issue upstream: https://github.com/tensorchord/pgvecto.rs/issues/607
          # Check after next package update.