Skip to content

Commit

Permalink
nix(refactor): Add withPath to checkedShellScript
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangwalther authored and monacoremo committed Aug 15, 2021
1 parent 4e4548d commit 0511e99
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions nix/overlays/checked-shell-script/checked-shell-script.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
, inRootDir ? false
, redirectTixFiles ? true
, withEnv ? null
, withPath ? [ ]
, withTmpDir ? false
}: text:
let
Expand Down Expand Up @@ -114,6 +115,10 @@ let
export PATH="$env/bin:$PATH"
''

+ lib.optionalString (lib.length withPath > 0) ''
export PATH="${lib.concatMapStrings (p: p + "/bin:") withPath}$PATH"
''

+ "(${text})"

+ lib.optionalString withTmpDir ''
Expand Down
3 changes: 1 addition & 2 deletions nix/tools/memory.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ let
name = "postgrest-test-memory";
docs = "Run the memory tests.";
inRootDir = true;
withPath = [ postgrestProfiled curl ];
}
''
export PATH="${postgrestProfiled}/bin:${curl}/bin:$PATH"
${withTools.latest} test/memory-tests.sh
'';

Expand Down
3 changes: 1 addition & 2 deletions nix/tools/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ let
docs = "Dump the loaded schema's DbStructure as a yaml file.";
inRootDir = true;
withEnv = postgrest.env;
withPath = [ jq ];
}
''
export PATH="${jq}/bin:$PATH"
${withTools.latest} \
${cabal-install}/bin/cabal v2-run ${devCabalOptions} --verbose=0 -- \
postgrest --dump-schema \
Expand Down
4 changes: 2 additions & 2 deletions nix/tools/withTools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ let
addCommandCompletion = true;
inRootDir = true;
redirectTixFiles = false;
withPath = [ postgresql ];
withTmpDir = true;
}
''
# avoid starting multiple layers of withTmpDb
if test -v PGRST_DB_URI; then
exec "$@"
fi
export PATH=${postgresql}/bin:"$PATH"
setuplog="$tmpdir/setup.log"
log () {
Expand Down

0 comments on commit 0511e99

Please sign in to comment.