|
528 | 528 | pg_prove = pkgs.perlPackages.TAPParserSourceHandlerpgTAP;
|
529 | 529 | supabase-groonga = pkgs.callPackage ./nix/supabase-groonga.nix { };
|
530 | 530 | pg_regress = basePackages.pg_regress;
|
| 531 | + tmpDirCmd = if pkgs.stdenv.isDarwin then |
| 532 | + ''mkdir -p /tmp/postgres-check.$$ && echo "/tmp/postgres-check.$$"'' |
| 533 | + else |
| 534 | + "mktemp -d"; |
531 | 535 | in
|
532 | 536 | pkgs.runCommand "postgres-${pgpkg.version}-check-harness"
|
533 | 537 | {
|
534 | 538 | nativeBuildInputs = with pkgs; [ coreutils bash pgpkg pg_prove pg_regress procps supabase-groonga ];
|
535 | 539 | } ''
|
536 |
| - TMPDIR=$(mktemp -d) |
| 540 | + TMPDIR=$(${tmpDirCmd}) |
537 | 541 | if [ $? -ne 0 ]; then
|
538 | 542 | echo "Failed to create temp directory" >&2
|
539 | 543 | exit 1
|
540 | 544 | fi
|
| 545 | + chmod -R 755 "$TMPDIR" |
541 | 546 |
|
542 | 547 | # Ensure the temporary directory is removed on exit
|
543 |
| - trap 'rm -rf "$TMPDIR"' EXIT |
| 548 | + #trap 'rm -rf "$TMPDIR"' EXIT |
544 | 549 |
|
545 | 550 | export PGDATA="$TMPDIR/pgdata"
|
546 | 551 | export PGSODIUM_DIR="$TMPDIR/pgsodium"
|
|
560 | 565 | echo "listen_addresses = '*'" >> $PGDATA/postgresql.conf
|
561 | 566 | echo "port = 5432" >> $PGDATA/postgresql.conf
|
562 | 567 | echo "host all all 127.0.0.1/32 trust" >> $PGDATA/pg_hba.conf
|
| 568 | + # Add system-specific configuration for aarch64-darwin |
| 569 | +
|
563 | 570 | #postgres -D "$PGDATA" -k "$TMPDIR" -h localhost -p 5432 >$TMPDIR/logfile/postgresql.log 2>&1 &
|
564 | 571 | pg_ctl -D "$PGDATA" -l $TMPDIR/logfile/postgresql.log -o "-k $TMPDIR -p 5432" start
|
| 572 | + # If server fails to start, output diagnostic information |
| 573 | + if ! pg_ctl -D $TMPDIR/pgdata status > /dev/null 2>&1; then |
| 574 | + echo "=== PostgreSQL Log ===" |
| 575 | + cat $TMPDIR/logfile/postgresql.log |
| 576 | + echo "=== System Information ===" |
| 577 | + ls -la $TMPDIR/pgdata |
| 578 | + whoami |
| 579 | + groups |
| 580 | + fi |
565 | 581 | for i in {1..60}; do
|
566 | 582 | if pg_isready -h localhost -p 5432; then
|
567 | 583 | echo "PostgreSQL is ready"
|
|
0 commit comments