treewide: use runtimeShell instead of stdenv.shell whenever possible

Whenever we create scripts that are installed to $out, we must use runtimeShell
in order to get the shell that can be executed on the machine we create the
package for. This is relevant for cross-compiling. The only use case for
stdenv.shell are scripts that are executed as part of the build system.
Usages in checkPhase are borderline however to decrease the likelyhood
of people copying the wrong examples, I decided to use runtimeShell as well.
This commit is contained in:
Jörg Thalheim
2019-02-26 11:45:54 +00:00
parent 1233c8d9e9
commit dadc7eb329
131 changed files with 326 additions and 294 deletions

View File

@@ -1,4 +1,4 @@
{ stdenv, fetchurl, bootstrap_cmds, coreutils, glibc, m4 }:
{ stdenv, fetchurl, bootstrap_cmds, coreutils, glibc, m4, runtimeShell }:
let
options = rec {
@@ -76,7 +76,7 @@ stdenv.mkDerivation rec {
cp -r . "$out/share/ccl-installation"
mkdir -p "$out/bin"
echo -e '#!${stdenv.shell}\n'"$out/share/ccl-installation/${CCL_RUNTIME}"' "$@"\n' > "$out"/bin/"${CCL_RUNTIME}"
echo -e '#!${runtimeShell}\n'"$out/share/ccl-installation/${CCL_RUNTIME}"' "$@"\n' > "$out"/bin/"${CCL_RUNTIME}"
chmod a+x "$out"/bin/"${CCL_RUNTIME}"
ln -s "$out"/bin/"${CCL_RUNTIME}" "$out"/bin/ccl
'';

View File

@@ -1,4 +1,4 @@
{ stdenv, fetchurl, python }:
{ stdenv, fetchurl, python, runtimeShell }:
stdenv.mkDerivation rec {
name = "cmdstan-2.17.1";
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
ln -s $out/opt/cmdstan/bin/stanc $out/bin/stanc
ln -s $out/opt/cmdstan/bin/stansummary $out/bin/stansummary
cat > $out/bin/stan <<EOF
#!${stdenv.shell}
#!${runtimeShell}
make -C $out/opt/cmdstan "\$(realpath "\$1")"
EOF
chmod a+x $out/bin/stan

View File

@@ -1,6 +1,6 @@
{ stdenv, fetchFromGitHub, tzdata, iana-etc, go_bootstrap, runCommand, writeScriptBin
, perl, which, pkgconfig, patch, procps, pcre, cacert, llvm, Security, Foundation
, mailcap
, mailcap, runtimeShell
, buildPackages, targetPackages }:
let
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
# This source produces shell script at run time,
# and thus it is not corrected by patchShebangs.
substituteInPlace misc/cgo/testcarchive/carchive_test.go \
--replace '#!/usr/bin/env bash' '#!${stdenv.shell}'
--replace '#!/usr/bin/env bash' '#!${runtimeShell}'
# Patch the mimetype database location which is missing on NixOS.
substituteInPlace src/mime/type_unix.go \
@@ -100,7 +100,7 @@ stdenv.mkDerivation rec {
'' + optionalString stdenv.isLinux ''
sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go
'' + optionalString stdenv.isAarch32 ''
echo '#!${stdenv.shell}' > misc/cgo/testplugin/test.bash
echo '#!${runtimeShell}' > misc/cgo/testplugin/test.bash
'' + optionalString stdenv.isDarwin ''
substituteInPlace src/race.bash --replace \
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true