nix: add "cd $rootdir" to all shell scripts via checked-shell-script

This commit is contained in:
Wolfgang Walther
2020-12-24 14:44:01 +01:00
committed by Wolfgang Walther
parent 56557c9c40
commit b5185de706
6 changed files with 39 additions and 39 deletions
@@ -1,11 +1,12 @@
# Create a bash script that is checked with shellcheck. You can either use it
# directly, or use the .bin attribute to get the script in a bin/ directory,
# to be used in a path for example.
{ writeTextFile
, runtimeShell
{ git
, runCommand
, stdenv
, runtimeShell
, shellcheck
, stdenv
, writeTextFile
}:
name: text:
let
@@ -20,6 +21,14 @@ let
#!${runtimeShell}
set -euo pipefail
cd "$(${git}/bin/git rev-parse --show-toplevel)"
if test ! -f postgrest.cabal; then
>&2 echo "Couldn't find postgrest.cabal. Please make sure to" \
"run this command somewhere in the PostgREST repo."
exit 1
fi
${text}
'';