writeShellApplication: Add bashOptions argument

This commit is contained in:
Rebecca Turner
2024-02-01 16:02:32 -08:00
parent 185474c3ec
commit ac20bcf449
@@ -272,6 +272,7 @@ rec {
, meta ? { }
, checkPhase ? null
, excludeShellChecks ? [ ]
, bashOptions ? [ "errexit" "nounset" "pipefail" ]
}:
writeTextFile {
inherit name meta;
@@ -281,9 +282,7 @@ rec {
preferLocalBuild = false;
text = ''
#!${runtimeShell}
set -o errexit
set -o nounset
set -o pipefail
${lib.concatMapStringsSep "\n" (option: "set -o ${option}") bashOptions}
'' + lib.optionalString (runtimeInputs != [ ]) ''
export PATH="${lib.makeBinPath runtimeInputs}:$PATH"