1{ stdenv, runCommand }:
2
3let
4 bad-shebang = stdenv.mkDerivation {
5 name = "bad-shebang";
6 unpackPhase = ":";
7 installPhase = ''
8 mkdir -p $out/bin
9 echo "#!/bin/sh" > $out/bin/test
10 echo "echo -n hello" >> $out/bin/test
11 chmod +x $out/bin/test
12 '';
13 };
14in runCommand "patch-shebangs-test" {
15 passthru = { inherit bad-shebang; };
16 meta.platforms = stdenv.lib.platforms.all;
17} ''
18 printf "checking whether patchShebangs works properly... ">&2
19 if ! grep -q '^#!/bin/sh' ${bad-shebang}/bin/test; then
20 echo "yes" >&2
21 touch $out
22 else
23 echo "no" >&2
24 exit 1
25 fi
26''