nix(refactor): Add withPath to checkedShellScript

This commit is contained in:
Wolfgang Walther
2021-08-15 12:35:52 +02:00
committed by Remo
parent 4e4548d702
commit 0511e99dd4
4 changed files with 9 additions and 6 deletions
@@ -18,6 +18,7 @@
, inRootDir ? false , inRootDir ? false
, redirectTixFiles ? true , redirectTixFiles ? true
, withEnv ? null , withEnv ? null
, withPath ? [ ]
, withTmpDir ? false , withTmpDir ? false
}: text: }: text:
let let
@@ -114,6 +115,10 @@ let
export PATH="$env/bin:$PATH" export PATH="$env/bin:$PATH"
'' ''
+ lib.optionalString (lib.length withPath > 0) ''
export PATH="${lib.concatMapStrings (p: p + "/bin:") withPath}$PATH"
''
+ "(${text})" + "(${text})"
+ lib.optionalString withTmpDir '' + lib.optionalString withTmpDir ''
+1 -2
View File
@@ -14,10 +14,9 @@ let
name = "postgrest-test-memory"; name = "postgrest-test-memory";
docs = "Run the memory tests."; docs = "Run the memory tests.";
inRootDir = true; inRootDir = true;
withPath = [ postgrestProfiled curl ];
} }
'' ''
export PATH="${postgrestProfiled}/bin:${curl}/bin:$PATH"
${withTools.latest} test/memory-tests.sh ${withTools.latest} test/memory-tests.sh
''; '';
+1 -2
View File
@@ -73,10 +73,9 @@ let
docs = "Dump the loaded schema's DbStructure as a yaml file."; docs = "Dump the loaded schema's DbStructure as a yaml file.";
inRootDir = true; inRootDir = true;
withEnv = postgrest.env; withEnv = postgrest.env;
withPath = [ jq ];
} }
'' ''
export PATH="${jq}/bin:$PATH"
${withTools.latest} \ ${withTools.latest} \
${cabal-install}/bin/cabal v2-run ${devCabalOptions} --verbose=0 -- \ ${cabal-install}/bin/cabal v2-run ${devCabalOptions} --verbose=0 -- \
postgrest --dump-schema \ postgrest --dump-schema \
+2 -2
View File
@@ -25,6 +25,7 @@ let
addCommandCompletion = true; addCommandCompletion = true;
inRootDir = true; inRootDir = true;
redirectTixFiles = false; redirectTixFiles = false;
withPath = [ postgresql ];
withTmpDir = true; withTmpDir = true;
} }
'' ''
@@ -32,8 +33,7 @@ let
if test -v PGRST_DB_URI; then if test -v PGRST_DB_URI; then
exec "$@" exec "$@"
fi fi
export PATH=${postgresql}/bin:"$PATH"
setuplog="$tmpdir/setup.log" setuplog="$tmpdir/setup.log"
log () { log () {