Skip to content

Commit d58f7e6

Browse files
committed
fix: restore flake check for now
1 parent c1962cb commit d58f7e6

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

flake.nix

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -528,46 +528,40 @@
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-
"$(pwd)/postgres-tmp"
533-
else
534-
"mktemp -d";
535531
in
536532
pkgs.runCommand "postgres-${pgpkg.version}-check-harness"
537533
{
538534
nativeBuildInputs = with pkgs; [ coreutils bash pgpkg pg_prove pg_regress procps supabase-groonga ];
539535
} ''
540-
$WORKDIR=$(${tmpDirCmd})
536+
TMPDIR=$(mktemp -d)
541537
if [ $? -ne 0 ]; then
542538
echo "Failed to create temp directory" >&2
543539
exit 1
544540
fi
545541
546-
chmod 700 "$WORKDIR"
547-
548542
# Ensure the temporary directory is removed on exit
549-
#trap 'rm -rf "$WORKDIR"' EXIT
543+
trap 'rm -rf "$TMPDIR"' EXIT
550544
551-
export PGDATA="$WORKDIR/pgdata"
552-
export PGSODIUM_DIR="$WORKDIR/pgsodium"
545+
export PGDATA="$TMPDIR/pgdata"
546+
export PGSODIUM_DIR="$TMPDIR/pgsodium"
553547
554548
mkdir -p $PGDATA
555-
mkdir -p $WORKDIR/logfile
549+
mkdir -p $TMPDIR/logfile
556550
# Generate a random key and store it in an environment variable
557551
export PGSODIUM_KEY=$(head -c 32 /dev/urandom | od -A n -t x1 | tr -d ' \n')
558552
export GRN_PLUGINS_DIR=${supabase-groonga}/lib/groonga/plugins
559553
# Create a simple script to echo the key
560-
echo '#!/bin/sh' > $WORKDIR/getkey.sh
561-
echo 'echo $PGSODIUM_KEY' >> $WORKDIR/getkey.sh
562-
chmod +x $WORKDIR/getkey.sh
554+
echo '#!/bin/sh' > $TMPDIR/getkey.sh
555+
echo 'echo $PGSODIUM_KEY' >> $TMPDIR/getkey.sh
556+
chmod +x $TMPDIR/getkey.sh
563557
initdb --locale=C --username=supabase_admin
564558
substitute ${./nix/tests/postgresql.conf.in} $PGDATA/postgresql.conf \
565-
--subst-var-by PGSODIUM_GETKEY_SCRIPT "$WORKDIR/getkey.sh"
559+
--subst-var-by PGSODIUM_GETKEY_SCRIPT "$TMPDIR/getkey.sh"
566560
echo "listen_addresses = '*'" >> $PGDATA/postgresql.conf
567561
echo "port = 5432" >> $PGDATA/postgresql.conf
568562
echo "host all all 127.0.0.1/32 trust" >> $PGDATA/pg_hba.conf
569-
#postgres -D "$PGDATA" -k "$WORKDIR" -h localhost -p 5432 >$WORKDIR/logfile/postgresql.log 2>&1 &
570-
pg_ctl -D "$PGDATA" -l $WORKDIR/logfile/postgresql.log -o "-k $WORKDIR -p 5432" start
563+
#postgres -D "$PGDATA" -k "$TMPDIR" -h localhost -p 5432 >$TMPDIR/logfile/postgresql.log 2>&1 &
564+
pg_ctl -D "$PGDATA" -l $TMPDIR/logfile/postgresql.log -o "-k $TMPDIR -p 5432" start
571565
for i in {1..60}; do
572566
if pg_isready -h localhost -p 5432; then
573567
echo "PostgreSQL is ready"
@@ -579,14 +573,14 @@
579573
echo "PostgreSQL status:"
580574
pg_ctl -D "$PGDATA" status
581575
echo "PostgreSQL log content:"
582-
cat $WORKDIR/logfile/postgresql.log
576+
cat $TMPDIR/logfile/postgresql.log
583577
exit 1
584578
fi
585579
done
586580
createdb -p 5432 -h localhost --username=supabase_admin testing
587581
if ! psql -p 5432 -h localhost --username=supabase_admin -d testing -v ON_ERROR_STOP=1 -Xaf ${./nix/tests/prime.sql}; then
588582
echo "Error executing SQL file. PostgreSQL log content:"
589-
cat $WORKDIR/logfile/postgresql.log
583+
cat $TMPDIR/logfile/postgresql.log
590584
pg_ctl -D "$PGDATA" stop
591585
exit 1
592586
fi
@@ -604,9 +598,9 @@
604598
$(ls ${./nix/tests/sql} | sed -e 's/\..*$//' | sort )
605599
606600
pg_ctl -D "$PGDATA" stop
607-
mv $WORKDIR/logfile/postgresql.log $out
601+
mv $TMPDIR/logfile/postgresql.log $out
608602
echo ${pgpkg}
609-
'';
603+
'';
610604
in
611605
rec {
612606
# The list of all packages that can be built with 'nix build'. The list

0 commit comments

Comments
 (0)