nix(refactor): Add withEnv to checked-shell-script
This commit is contained in:
committed by
Wolfgang Walther
parent
40b1dccc54
commit
39d4646a4c
@@ -9,8 +9,14 @@
|
||||
, stdenv
|
||||
, writeTextFile
|
||||
}:
|
||||
{ name, docs, inRootDir ? false, redirectTixFiles ? true, withTmpDir ? false }: text:
|
||||
# TODO: do something sensible with docs, e.g. provide automated --help
|
||||
{ name
|
||||
, docs
|
||||
, inRootDir ? false
|
||||
, redirectTixFiles ? true
|
||||
, withEnv ? null
|
||||
, withTmpDir ? false
|
||||
}: text:
|
||||
let
|
||||
bin =
|
||||
writeTextFile {
|
||||
@@ -46,6 +52,10 @@ let
|
||||
# remove the tmpdir when cancelled (postgrest-watch)
|
||||
trap 'rm -rf "$tmpdir"' SIGINT SIGTERM
|
||||
''
|
||||
+ lib.optionalString (withEnv != null) ''
|
||||
env="$(cat ${withEnv})"
|
||||
export PATH="$env/bin:$PATH"
|
||||
''
|
||||
+ "(${text})"
|
||||
+ lib.optionalString withTmpDir ''
|
||||
|
||||
|
||||
Reference in New Issue
Block a user