339339 "ARG_POSITIONAL_SINGLE([command], [Command to run])"
340340 "ARG_LEFTOVERS([command arguments])"
341341 "ARG_OPTIONAL_SINGLE([monitor], [m], [Enable CPU and memory monitoring of the PostgREST process and output to the designated file as markdown])"
342+ "ARG_USE_ENV([PGRST_CMD], [], [PostgREST executable to run])"
342343 ] ;
343344 positionalCompletion = "_command" ;
344345 workingDir = "/" ;
@@ -348,20 +349,22 @@ let
348349 ''
349350 export PGRST_SERVER_UNIX_SOCKET="$tmpdir"/postgrest.socket
350351
351- rm -f result
352- if [ -z "'' ${PGRST_BUILD_CABAL:-}" ]; then
353- echo -n "Building postgrest (nix)... "
354- # Using lib.getBin to also make this work with older checkouts, where .bin was not a thing, yet.
355- nix-build -E 'with import ./. {}; pkgs.lib.getBin postgrestPackage' > "$tmpdir"/build.log 2>&1 || {
356- echo "failed, output:"
357- cat "$tmpdir"/build.log
358- exit 1
359- }
360- PGRST_CMD=$(echo ./result*/bin/postgrest)
361- else
362- echo -n "Building postgrest (cabal)... "
363- postgrest-build
364- PGRST_CMD=postgrest-run
352+ if [ -z "'' ${PGRST_CMD:-}" ]; then
353+ rm -f result
354+ if [ -z "'' ${PGRST_BUILD_CABAL:-}" ]; then
355+ echo -n "Building postgrest (nix)... "
356+ # Using lib.getBin to also make this work with older checkouts, where .bin was not a thing, yet.
357+ nix-build -E 'with import ./. {}; pkgs.lib.getBin postgrestPackage' > "$tmpdir"/build.log 2>&1 || {
358+ echo "failed, output:"
359+ cat "$tmpdir"/build.log
360+ exit 1
361+ }
362+ PGRST_CMD=$(echo ./result*/bin/postgrest)
363+ else
364+ echo -n "Building postgrest (cabal)... "
365+ postgrest-build
366+ PGRST_CMD=postgrest-run
367+ fi
365368 fi
366369 echo "done."
367370
0 commit comments