diff --git a/doc/stdenv/stdenv.chapter.md b/doc/stdenv/stdenv.chapter.md index 4678207d1879..2cbf1a2dbfd9 100644 --- a/doc/stdenv/stdenv.chapter.md +++ b/doc/stdenv/stdenv.chapter.md @@ -75,17 +75,9 @@ stdenv.mkDerivation { } ``` -where the builder can do anything it wants, but typically starts with +where `stdenv` sets up the environment automatically (e.g. by resetting `PATH` and populating it from build inputs). If you want, you can use `stdenv`’s generic builder: ```bash -source $stdenv/setup -``` - -to let `stdenv` set up the environment (e.g. by resetting `PATH` and populating it from build inputs). If you want, you can still use `stdenv`’s generic builder: - -```bash -source $stdenv/setup - buildPhase() { echo "... this is my custom build phase ..." gcc foo.c -o foo @@ -1276,7 +1268,7 @@ addEnvHooks "$hostOffset" myBashFunction The *existence* of setups hooks has long been documented and packages inside Nixpkgs are free to use this mechanism. Other packages, however, should not rely on these mechanisms not changing between Nixpkgs versions. Because of the existing issues with this system, there’s little benefit from mandating it be stable for any period of time. -First, let’s cover some setup hooks that are part of Nixpkgs default `stdenv`. This means that they are run for every package built using `stdenv.mkDerivation` or when using a custom builder that has `source $stdenv/setup`. Some of these are platform specific, so they may run on Linux but not Darwin or vice-versa. +First, let’s cover some setup hooks that are part of Nixpkgs default `stdenv`. This means that they are run for every package built using `stdenv.mkDerivation`, even with custom builders. Some of these are platform specific, so they may run on Linux but not Darwin or vice-versa. ### `move-docs.sh` {#move-docs.sh} diff --git a/nixos/lib/make-system-tarball.sh b/nixos/lib/make-system-tarball.sh index 1a0017a1799a..8fadc79a13dc 100644 --- a/nixos/lib/make-system-tarball.sh +++ b/nixos/lib/make-system-tarball.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - sources_=($sources) targets_=($targets) diff --git a/nixos/modules/services/computing/slurm/slurm.nix b/nixos/modules/services/computing/slurm/slurm.nix index dd739798963c..01c40663b2b5 100644 --- a/nixos/modules/services/computing/slurm/slurm.nix +++ b/nixos/modules/services/computing/slurm/slurm.nix @@ -331,7 +331,6 @@ in name = "wrappedSlurm"; builder = pkgs.writeText "builder.sh" '' - source $stdenv/setup mkdir -p $out/bin find ${lib.getBin cfg.package}/bin -type f -executable | while read EXE do diff --git a/nixos/modules/services/networking/ircd-hybrid/builder.sh b/nixos/modules/services/networking/ircd-hybrid/builder.sh index 07a3788abf7d..3a8bb5f28fdf 100644 --- a/nixos/modules/services/networking/ircd-hybrid/builder.sh +++ b/nixos/modules/services/networking/ircd-hybrid/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - doSub() { local src=$1 local dst=$2 diff --git a/nixos/modules/services/web-servers/jboss/builder.sh b/nixos/modules/services/web-servers/jboss/builder.sh index 8c49b87db060..348d3bbb80bf 100644 --- a/nixos/modules/services/web-servers/jboss/builder.sh +++ b/nixos/modules/services/web-servers/jboss/builder.sh @@ -1,8 +1,5 @@ set -e -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - mkdir -p $out/bin cat > $out/bin/control < ssh chmod +x ssh diff --git a/pkgs/build-support/fetchdarcs/builder.sh b/pkgs/build-support/fetchdarcs/builder.sh index 39838db255a6..f34e98fdcb0f 100644 --- a/pkgs/build-support/fetchdarcs/builder.sh +++ b/pkgs/build-support/fetchdarcs/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - tagtext="" tagflags="" # Darcs hashes are sha1 (120 bits, 40-character hex) diff --git a/pkgs/build-support/fetchdocker/fetchdocker-builder.sh b/pkgs/build-support/fetchdocker/fetchdocker-builder.sh index 489914a2a8b4..4bbff3d3f3cb 100644 --- a/pkgs/build-support/fetchdocker/fetchdocker-builder.sh +++ b/pkgs/build-support/fetchdocker/fetchdocker-builder.sh @@ -1,5 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source "${stdenv}/setup" echo "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}" mkdir -p "${out}" diff --git a/pkgs/build-support/fetchdocker/generic-fetcher.nix b/pkgs/build-support/fetchdocker/generic-fetcher.nix index 95b193490a82..90ed35fc17a9 100644 --- a/pkgs/build-support/fetchdocker/generic-fetcher.nix +++ b/pkgs/build-support/fetchdocker/generic-fetcher.nix @@ -35,7 +35,6 @@ in stdenv.mkDerivation { inherit name; builder = writeText "${fetcher}-builder.sh" '' - source "$stdenv/setup" echo "${fetcher} exporting to $out" declare -A creds diff --git a/pkgs/build-support/fetchfirefoxaddon/default.nix b/pkgs/build-support/fetchfirefoxaddon/default.nix index e07a6a1a79dd..bb03c865bedc 100644 --- a/pkgs/build-support/fetchfirefoxaddon/default.nix +++ b/pkgs/build-support/fetchfirefoxaddon/default.nix @@ -33,8 +33,6 @@ stdenv.mkDerivation { }; builder = writeScript "xpibuilder" '' - source $stdenv/setup - echo "firefox addon $name into $out" UUID="${extid}" diff --git a/pkgs/build-support/fetchfossil/builder.sh b/pkgs/build-support/fetchfossil/builder.sh index fe828d0ada9d..43462834b19e 100644 --- a/pkgs/build-support/fetchfossil/builder.sh +++ b/pkgs/build-support/fetchfossil/builder.sh @@ -1,5 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup echo "Cloning Fossil $url [$rev] into $out" # Fossil, bless its adorable little heart, wants to write global configuration diff --git a/pkgs/build-support/fetchgit/builder.sh b/pkgs/build-support/fetchgit/builder.sh index 95176beea8c1..e112703773cd 100644 --- a/pkgs/build-support/fetchgit/builder.sh +++ b/pkgs/build-support/fetchgit/builder.sh @@ -3,8 +3,6 @@ # - revision specified and remote has a HEAD # - revision specified and remote without HEAD # -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup echo "exporting $url (rev $rev) into $out" diff --git a/pkgs/build-support/fetchhg/builder.sh b/pkgs/build-support/fetchhg/builder.sh index 20dfde4b10d4..786b4c86ff50 100644 --- a/pkgs/build-support/fetchhg/builder.sh +++ b/pkgs/build-support/fetchhg/builder.sh @@ -1,5 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup echo "getting $url${rev:+ ($rev)} into $out" hg clone --insecure "$url" hg-clone diff --git a/pkgs/build-support/fetchipfs/builder.sh b/pkgs/build-support/fetchipfs/builder.sh index 1ddd111b1518..f41eab6b7e30 100644 --- a/pkgs/build-support/fetchipfs/builder.sh +++ b/pkgs/build-support/fetchipfs/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - # Curl flags to handle redirects, not use EPSV, handle cookies for # servers to need them during redirects, and work on SSL without a # certificate (this isn't a security problem because we check the diff --git a/pkgs/build-support/fetchmtn/builder.sh b/pkgs/build-support/fetchmtn/builder.sh index de929fad55a9..cace650df841 100644 --- a/pkgs/build-support/fetchmtn/builder.sh +++ b/pkgs/build-support/fetchmtn/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - set -x if ! [ -f "$cacheDB" ]; then diff --git a/pkgs/build-support/fetchsvn/builder.sh b/pkgs/build-support/fetchsvn/builder.sh index e187747f14e6..b8f18eeda32b 100644 --- a/pkgs/build-support/fetchsvn/builder.sh +++ b/pkgs/build-support/fetchsvn/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - echo "exporting $url (r$rev) into $out" if test -n "$http_proxy"; then diff --git a/pkgs/build-support/fetchsvnssh/builder.sh b/pkgs/build-support/fetchsvnssh/builder.sh index e553446346de..622ac81a4602 100644 --- a/pkgs/build-support/fetchsvnssh/builder.sh +++ b/pkgs/build-support/fetchsvnssh/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - echo "exporting $url (r$rev) into $out" if test "$sshSupport"; then diff --git a/pkgs/build-support/fetchurl/builder.sh b/pkgs/build-support/fetchurl/builder.sh index a82728ef1025..0f142cdd3fa0 100644 --- a/pkgs/build-support/fetchurl/builder.sh +++ b/pkgs/build-support/fetchurl/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - source $mirrorsFile curlVersion=$(curl -V | head -1 | cut -d' ' -f2) diff --git a/pkgs/build-support/fetchurl/write-mirror-list.sh b/pkgs/build-support/fetchurl/write-mirror-list.sh index 2dabd2e722be..8f5e710a435a 100644 --- a/pkgs/build-support/fetchurl/write-mirror-list.sh +++ b/pkgs/build-support/fetchurl/write-mirror-list.sh @@ -1,4 +1,2 @@ -source $stdenv/setup - # !!! this is kinda hacky. set | grep -E '^[a-zA-Z]+=.*://' > $out diff --git a/pkgs/build-support/kernel/make-initrd.sh b/pkgs/build-support/kernel/make-initrd.sh index 0149c5d487ac..defa8a7d9b8e 100644 --- a/pkgs/build-support/kernel/make-initrd.sh +++ b/pkgs/build-support/kernel/make-initrd.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - set -o pipefail objects=($objects) diff --git a/pkgs/build-support/kernel/modules-closure.sh b/pkgs/build-support/kernel/modules-closure.sh index b581b6e7d403..b53c64e30525 100644 --- a/pkgs/build-support/kernel/modules-closure.sh +++ b/pkgs/build-support/kernel/modules-closure.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - # When no modules are built, the $out/lib/modules directory will not # exist. Because the rest of the script assumes it does exist, we # handle this special case first. diff --git a/pkgs/build-support/substitute-files/substitute-all-files.nix b/pkgs/build-support/substitute-files/substitute-all-files.nix index 682e976dcfe5..6f09798813ae 100644 --- a/pkgs/build-support/substitute-files/substitute-all-files.nix +++ b/pkgs/build-support/substitute-files/substitute-all-files.nix @@ -5,7 +5,6 @@ args: stdenv.mkDerivation ({ name = if args ? name then args.name else baseNameOf (toString args.src); builder = builtins.toFile "builder.sh" '' - source $stdenv/setup set -o pipefail eval "$preInstall" diff --git a/pkgs/build-support/substitute/substitute-all.sh b/pkgs/build-support/substitute/substitute-all.sh index ec220481fcc0..cffba925ce82 100644 --- a/pkgs/build-support/substitute/substitute-all.sh +++ b/pkgs/build-support/substitute/substitute-all.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - eval "$preInstall" args= diff --git a/pkgs/build-support/substitute/substitute.sh b/pkgs/build-support/substitute/substitute.sh index d50a82446639..65a9613ff8f8 100644 --- a/pkgs/build-support/substitute/substitute.sh +++ b/pkgs/build-support/substitute/substitute.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - args= target=$out diff --git a/pkgs/by-name/bo/boot/builder.sh b/pkgs/by-name/bo/boot/builder.sh index 4506e3f0f861..cb4a7e82d08b 100644 --- a/pkgs/by-name/bo/boot/builder.sh +++ b/pkgs/by-name/bo/boot/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - boot_bin=$out/bin/boot mkdir -pv $(dirname $boot_bin) diff --git a/pkgs/by-name/in/invidious/videojs.sh b/pkgs/by-name/in/invidious/videojs.sh index 31609db14eb3..9272d0b0e285 100644 --- a/pkgs/by-name/in/invidious/videojs.sh +++ b/pkgs/by-name/in/invidious/videojs.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - unpackPhase cd source # this helper downloads the videojs files and checks their checksums diff --git a/pkgs/by-name/wt/wtk/builder.sh b/pkgs/by-name/wt/wtk/builder.sh index ca5157c6d71a..5e90f63c7cba 100644 --- a/pkgs/by-name/wt/wtk/builder.sh +++ b/pkgs/by-name/wt/wtk/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - mkdir unzipped pushd unzipped unzip $src || true diff --git a/pkgs/by-name/xo/xorg_sys_opengl/builder.sh b/pkgs/by-name/xo/xorg_sys_opengl/builder.sh index ed2c60da2612..d341e5be2a5f 100644 --- a/pkgs/by-name/xo/xorg_sys_opengl/builder.sh +++ b/pkgs/by-name/xo/xorg_sys_opengl/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - mkdir -p $out/lib ln -s /usr/lib/libGL.so.1 $out/lib/ diff --git a/pkgs/by-name/ya/yandex-disk/package.nix b/pkgs/by-name/ya/yandex-disk/package.nix index b0056602c387..aca6cf21cbe5 100644 --- a/pkgs/by-name/ya/yandex-disk/package.nix +++ b/pkgs/by-name/ya/yandex-disk/package.nix @@ -28,7 +28,6 @@ stdenv.mkDerivation rec { }; builder = writeText "builder.sh" '' - . $stdenv/setup mkdir -pv $out/bin mkdir -pv $out/share mkdir -pv $out/etc diff --git a/pkgs/development/bower-modules/generic/default.nix b/pkgs/development/bower-modules/generic/default.nix index ba15b5881602..ff02d6156ea2 100644 --- a/pkgs/development/bower-modules/generic/default.nix +++ b/pkgs/development/bower-modules/generic/default.nix @@ -18,8 +18,6 @@ in pkgs.stdenv.mkDerivation ( inherit bowerPackages; builder = builtins.toFile "builder.sh" '' - source $stdenv/setup - # The project's bower.json is required cp $src/bower.json . diff --git a/pkgs/development/compilers/chicken/4/fetchegg/builder.sh b/pkgs/development/compilers/chicken/4/fetchegg/builder.sh index 78535382a7ca..a443d2d7b495 100644 --- a/pkgs/development/compilers/chicken/4/fetchegg/builder.sh +++ b/pkgs/development/compilers/chicken/4/fetchegg/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - echo "exporting egg ${eggName} (version $version) into $out" mkdir -p $out diff --git a/pkgs/development/compilers/fpc/binary-builder-darwin.sh b/pkgs/development/compilers/fpc/binary-builder-darwin.sh index 8a8600f1f639..041c471d79c0 100755 --- a/pkgs/development/compilers/fpc/binary-builder-darwin.sh +++ b/pkgs/development/compilers/fpc/binary-builder-darwin.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - pkgdir=$(pwd)/pkg deploydir=$(pwd)/deploy diff --git a/pkgs/development/compilers/fpc/binary-builder.sh b/pkgs/development/compilers/fpc/binary-builder.sh index 568c3094107a..21e5c0ffafe8 100755 --- a/pkgs/development/compilers/fpc/binary-builder.sh +++ b/pkgs/development/compilers/fpc/binary-builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - tar xf $src cd */ tarballdir=$(pwd) diff --git a/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh b/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh index 4eef8acb0693..551db285a98f 100644 --- a/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh +++ b/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh @@ -1,6 +1,4 @@ # -*- shell-script -*- -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup function extract { diff --git a/pkgs/development/libraries/glibc/locales-builder.sh b/pkgs/development/libraries/glibc/locales-builder.sh index 27894b09b91c..6f10476f1089 100644 --- a/pkgs/development/libraries/glibc/locales-builder.sh +++ b/pkgs/development/libraries/glibc/locales-builder.sh @@ -1,9 +1,6 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi # Glibc cannot have itself in its RPATH. export NIX_NO_SELF_RPATH=1 -source $stdenv/setup - postConfigure() { # Hack: get rid of the `-static' flag set by the bootstrap stdenv. # This has to be done *after* `configure' because it builds some diff --git a/pkgs/development/libraries/gtk-sharp/builder.sh b/pkgs/development/libraries/gtk-sharp/builder.sh index 45e640e2a708..946b65d98a58 100644 --- a/pkgs/development/libraries/gtk-sharp/builder.sh +++ b/pkgs/development/libraries/gtk-sharp/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - genericBuild # !!! hack diff --git a/pkgs/development/perl-modules/generic/builder.sh b/pkgs/development/perl-modules/generic/builder.sh index f87bb2b9e177..3c45dc3b4c5a 100644 --- a/pkgs/development/perl-modules/generic/builder.sh +++ b/pkgs/development/perl-modules/generic/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - PERL5LIB="$PERL5LIB${PERL5LIB:+:}$out/lib/perl5/site_perl" perlFlags= diff --git a/pkgs/development/tools/misc/automake/builder.sh b/pkgs/development/tools/misc/automake/builder.sh index b08e7251e9e2..9c6a90965f7f 100644 --- a/pkgs/development/tools/misc/automake/builder.sh +++ b/pkgs/development/tools/misc/automake/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - # Wrap the given `aclocal' program, appending extra `-I' flags # corresponding to the directories listed in $ACLOCAL_PATH. (Note # that `wrapProgram' can't be used for that purpose since it can only diff --git a/pkgs/os-specific/linux/nvidia-x11/builder.sh b/pkgs/os-specific/linux/nvidia-x11/builder.sh index 00f38b0a3042..8e5f554b512a 100755 --- a/pkgs/os-specific/linux/nvidia-x11/builder.sh +++ b/pkgs/os-specific/linux/nvidia-x11/builder.sh @@ -1,6 +1,3 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi -source $stdenv/setup - unpackManually() { skip=$(sed 's/^skip=//; t; d' $src) tail -n +$skip $src | bsdtar xvf - diff --git a/pkgs/servers/x11/xorg/builder.sh b/pkgs/servers/x11/xorg/builder.sh index 1ed163690f89..99a753301d7e 100644 --- a/pkgs/servers/x11/xorg/builder.sh +++ b/pkgs/servers/x11/xorg/builder.sh @@ -1,7 +1,4 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi # This is the builder for all X.org components. -source $stdenv/setup - # After installation, automatically add all "Requires" fields in the # pkgconfig files (*.pc) to the propagated build inputs. diff --git a/pkgs/stdenv/generic/default-builder.sh b/pkgs/stdenv/generic/default-builder.sh index d49fb8aa57fc..8dc78c5fd168 100644 --- a/pkgs/stdenv/generic/default-builder.sh +++ b/pkgs/stdenv/generic/default-builder.sh @@ -1,4 +1 @@ -if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi - -source $stdenv/setup genericBuild diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 087787055c1e..76bd46dd9353 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -400,7 +400,7 @@ else let ); }) // { builder = attrs.realBuilder or stdenv.shell; - args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; + args = attrs.args or ["-e" ./source-stdenv.sh (attrs.builder or ./default-builder.sh)]; inherit stdenv; # The `system` attribute of a derivation has special meaning to Nix. diff --git a/pkgs/stdenv/generic/source-stdenv.sh b/pkgs/stdenv/generic/source-stdenv.sh new file mode 100644 index 000000000000..44318cd23691 --- /dev/null +++ b/pkgs/stdenv/generic/source-stdenv.sh @@ -0,0 +1,3 @@ +if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi +source "$stdenv/setup" +source "$1" diff --git a/pkgs/tools/typesetting/tex/nix/animatedot.sh b/pkgs/tools/typesetting/tex/nix/animatedot.sh index f038b83ff7ad..971fed1a6151 100644 --- a/pkgs/tools/typesetting/tex/nix/animatedot.sh +++ b/pkgs/tools/typesetting/tex/nix/animatedot.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - mkdir -p $out for ((i = 1; i <= $nrFrames; i++)); do diff --git a/pkgs/tools/typesetting/tex/nix/dot2pdf.sh b/pkgs/tools/typesetting/tex/nix/dot2pdf.sh index 71cf601dfac0..c37e6a9868be 100644 --- a/pkgs/tools/typesetting/tex/nix/dot2pdf.sh +++ b/pkgs/tools/typesetting/tex/nix/dot2pdf.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - mkdir -p $out dot2pdf() { diff --git a/pkgs/tools/typesetting/tex/nix/dot2ps.sh b/pkgs/tools/typesetting/tex/nix/dot2ps.sh index dd8de4a23dbc..687e6416ddc8 100644 --- a/pkgs/tools/typesetting/tex/nix/dot2ps.sh +++ b/pkgs/tools/typesetting/tex/nix/dot2ps.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - mkdir -p $out dot2ps() { diff --git a/pkgs/tools/typesetting/tex/nix/lhs2tex.sh b/pkgs/tools/typesetting/tex/nix/lhs2tex.sh index bfef3df6b0e1..5e930125f875 100644 --- a/pkgs/tools/typesetting/tex/nix/lhs2tex.sh +++ b/pkgs/tools/typesetting/tex/nix/lhs2tex.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - mkdir -p $out mkdir root diff --git a/pkgs/tools/typesetting/tex/nix/run-latex.sh b/pkgs/tools/typesetting/tex/nix/run-latex.sh index 9c1807687284..f49e07676f30 100644 --- a/pkgs/tools/typesetting/tex/nix/run-latex.sh +++ b/pkgs/tools/typesetting/tex/nix/run-latex.sh @@ -1,5 +1,3 @@ -source $stdenv/setup - mkdir -p $out export VARTEXFONTS=$TMPDIR/texfonts