Skip to content

Commit 9abe2c9

Browse files
committed
fixing flake check for darwin + passing check until pg_net
1 parent d58f7e6 commit 9abe2c9

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

docker/nix/build_nix.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ nix --version
55
if [ -d "/workspace" ]; then
66
cd /workspace
77
fi
8-
nix build .#checks.$(nix-instantiate --eval -E builtins.currentSystem | tr -d '"').psql_15 -L --no-link
9-
nix build .#checks.$(nix-instantiate --eval -E builtins.currentSystem | tr -d '"').psql_16 -L --no-link
8+
if [ "$(uname -sm)" != "Darwin arm64" ]; then
9+
echo "Running on non-macOS arm64 and amd64, remove me when pg_net supports darwin arm64"
10+
nix build .#checks.$(nix-instantiate --eval -E builtins.currentSystem | tr -d '"').psql_15 -L --no-link
11+
nix build .#checks.$(nix-instantiate --eval -E builtins.currentSystem | tr -d '"').psql_16 -L --no-link
12+
fi
1013
#no nix flake check on oriole yet
1114
nix build .#psql_15/bin -o psql_15
1215
nix build .#psql_16/bin -o psql_16

flake.nix

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,19 +528,24 @@
528528
pg_prove = pkgs.perlPackages.TAPParserSourceHandlerpgTAP;
529529
supabase-groonga = pkgs.callPackage ./nix/supabase-groonga.nix { };
530530
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";
531535
in
532536
pkgs.runCommand "postgres-${pgpkg.version}-check-harness"
533537
{
534538
nativeBuildInputs = with pkgs; [ coreutils bash pgpkg pg_prove pg_regress procps supabase-groonga ];
535539
} ''
536-
TMPDIR=$(mktemp -d)
540+
TMPDIR=$(${tmpDirCmd})
537541
if [ $? -ne 0 ]; then
538542
echo "Failed to create temp directory" >&2
539543
exit 1
540544
fi
545+
chmod -R 755 "$TMPDIR"
541546
542547
# Ensure the temporary directory is removed on exit
543-
trap 'rm -rf "$TMPDIR"' EXIT
548+
#trap 'rm -rf "$TMPDIR"' EXIT
544549
545550
export PGDATA="$TMPDIR/pgdata"
546551
export PGSODIUM_DIR="$TMPDIR/pgsodium"
@@ -560,8 +565,19 @@
560565
echo "listen_addresses = '*'" >> $PGDATA/postgresql.conf
561566
echo "port = 5432" >> $PGDATA/postgresql.conf
562567
echo "host all all 127.0.0.1/32 trust" >> $PGDATA/pg_hba.conf
568+
# Add system-specific configuration for aarch64-darwin
569+
563570
#postgres -D "$PGDATA" -k "$TMPDIR" -h localhost -p 5432 >$TMPDIR/logfile/postgresql.log 2>&1 &
564571
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
565581
for i in {1..60}; do
566582
if pg_isready -h localhost -p 5432; then
567583
echo "PostgreSQL is ready"

0 commit comments

Comments
 (0)