script: stop on error by default

This commit is contained in:
Rodrigo Arias 2021-01-14 12:23:37 +01:00
parent 60248ab06b
commit 422d359b48

View File

@ -5,8 +5,12 @@
{ {
script script
, shell ? "/bin/sh" , shell ? "/bin/sh"
, exitOnError ? true
}: }:
let
setcmd = if exitOnError then "set -e" else "";
in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "script"; name = "script";
preferLocalBuild = true; preferLocalBuild = true;
@ -14,6 +18,7 @@ stdenv.mkDerivation {
installPhase = '' installPhase = ''
cat > $out <<'EOF' cat > $out <<'EOF'
#!${shell} #!${shell}
${setcmd}
${script} ${script}