lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

treewide: load structured attributes in all bash builders consistently

It's hard to put the sourcing of ./.attrs.sh into all builder
consistently - mistakes will happen. Thus, load structured attrs once in
make-derivation and then source the remaining builder on top.

This should fix quite a few builders with structured attributes in
principle. Most importantly it helps substitute / substituteAll, which
are required for bootstrap on some platforms.

+6 -126
+2 -10
doc/stdenv/stdenv.chapter.md
··· 75 75 } 76 76 ``` 77 77 78 - where the builder can do anything it wants, but typically starts with 79 - 80 - ```bash 81 - source $stdenv/setup 82 - ``` 83 - 84 - 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: 78 + 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: 85 79 86 80 ```bash 87 - source $stdenv/setup 88 - 89 81 buildPhase() { 90 82 echo "... this is my custom build phase ..." 91 83 gcc foo.c -o foo ··· 1276 1268 1277 1269 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. 1278 1270 1279 - 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. 1271 + 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. 1280 1272 1281 1273 ### `move-docs.sh` {#move-docs.sh} 1282 1274
-2
nixos/lib/make-system-tarball.sh
··· 1 - source $stdenv/setup 2 - 3 1 sources_=($sources) 4 2 targets_=($targets) 5 3
-1
nixos/modules/services/computing/slurm/slurm.nix
··· 331 331 name = "wrappedSlurm"; 332 332 333 333 builder = pkgs.writeText "builder.sh" '' 334 - source $stdenv/setup 335 334 mkdir -p $out/bin 336 335 find ${lib.getBin cfg.package}/bin -type f -executable | while read EXE 337 336 do
-3
nixos/modules/services/networking/ircd-hybrid/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 doSub() { 5 2 local src=$1 6 3 local dst=$2
-3
nixos/modules/services/web-servers/jboss/builder.sh
··· 1 1 set -e 2 2 3 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 4 - source $stdenv/setup 5 - 6 3 mkdir -p $out/bin 7 4 8 5 cat > $out/bin/control <<EOF
-2
pkgs/applications/audio/pianoteq/default.nix
··· 111 111 stdenv.mkDerivation { 112 112 inherit name; 113 113 builder = writeShellScript "builder.sh" '' 114 - source $stdenv/setup 115 - 116 114 curlVersion=$(${curl}/bin/curl -V | head -1 | cut -d' ' -f2) 117 115 118 116 # Curl flags to handle redirects, not use EPSV, handle cookies for
-2
pkgs/applications/emulators/wine/builder-wow.sh
··· 1 1 ## build described at https://wiki.winehq.org/Building_Wine#Shared_WoW64 2 - 3 - source $stdenv/setup 4 2 preFlags="${configureFlags}" 5 3 6 4 unpackPhase
-3
pkgs/build-support/fetchbzr/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source "$stdenv/setup" 3 - 4 1 echo "exporting \`$url' (revision $rev) into \`$out'" 5 2 6 3 # Perform a lightweight checkout so that we don't end up importing
-3
pkgs/build-support/fetchcvs/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 (echo "#!$SHELL"; \ 5 2 echo 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"') > ssh 6 3 chmod +x ssh
-3
pkgs/build-support/fetchdarcs/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 tagtext="" 5 2 tagflags="" 6 3 # Darcs hashes are sha1 (120 bits, 40-character hex)
-2
pkgs/build-support/fetchdocker/fetchdocker-builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source "${stdenv}/setup" 3 1 echo "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}" 4 2 mkdir -p "${out}" 5 3
-1
pkgs/build-support/fetchdocker/generic-fetcher.nix
··· 35 35 stdenv.mkDerivation { 36 36 inherit name; 37 37 builder = writeText "${fetcher}-builder.sh" '' 38 - source "$stdenv/setup" 39 38 echo "${fetcher} exporting to $out" 40 39 41 40 declare -A creds
-2
pkgs/build-support/fetchfirefoxaddon/default.nix
··· 33 33 }; 34 34 35 35 builder = writeScript "xpibuilder" '' 36 - source $stdenv/setup 37 - 38 36 echo "firefox addon $name into $out" 39 37 40 38 UUID="${extid}"
-2
pkgs/build-support/fetchfossil/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 1 echo "Cloning Fossil $url [$rev] into $out" 4 2 5 3 # Fossil, bless its adorable little heart, wants to write global configuration
-2
pkgs/build-support/fetchgit/builder.sh
··· 3 3 # - revision specified and remote has a HEAD 4 4 # - revision specified and remote without HEAD 5 5 # 6 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 7 - source $stdenv/setup 8 6 9 7 echo "exporting $url (rev $rev) into $out" 10 8
-2
pkgs/build-support/fetchhg/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 1 echo "getting $url${rev:+ ($rev)} into $out" 4 2 5 3 hg clone --insecure "$url" hg-clone
-3
pkgs/build-support/fetchipfs/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 # Curl flags to handle redirects, not use EPSV, handle cookies for 5 2 # servers to need them during redirects, and work on SSL without a 6 3 # certificate (this isn't a security problem because we check the
-3
pkgs/build-support/fetchmtn/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 set -x 5 2 6 3 if ! [ -f "$cacheDB" ]; then
-3
pkgs/build-support/fetchsvn/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 echo "exporting $url (r$rev) into $out" 5 2 6 3 if test -n "$http_proxy"; then
-3
pkgs/build-support/fetchsvnssh/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 echo "exporting $url (r$rev) into $out" 5 2 6 3 if test "$sshSupport"; then
-3
pkgs/build-support/fetchurl/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 source $mirrorsFile 5 2 6 3 curlVersion=$(curl -V | head -1 | cut -d' ' -f2)
-2
pkgs/build-support/fetchurl/write-mirror-list.sh
··· 1 - source $stdenv/setup 2 - 3 1 # !!! this is kinda hacky. 4 2 set | grep -E '^[a-zA-Z]+=.*://' > $out
-2
pkgs/build-support/kernel/make-initrd.sh
··· 1 - source $stdenv/setup 2 - 3 1 set -o pipefail 4 2 5 3 objects=($objects)
-2
pkgs/build-support/kernel/modules-closure.sh
··· 1 - source $stdenv/setup 2 - 3 1 # When no modules are built, the $out/lib/modules directory will not 4 2 # exist. Because the rest of the script assumes it does exist, we 5 3 # handle this special case first.
-1
pkgs/build-support/substitute-files/substitute-all-files.nix
··· 5 5 stdenv.mkDerivation ({ 6 6 name = if args ? name then args.name else baseNameOf (toString args.src); 7 7 builder = builtins.toFile "builder.sh" '' 8 - source $stdenv/setup 9 8 set -o pipefail 10 9 11 10 eval "$preInstall"
-2
pkgs/build-support/substitute/substitute-all.sh
··· 1 - source $stdenv/setup 2 - 3 1 eval "$preInstall" 4 2 5 3 args=
-2
pkgs/build-support/substitute/substitute.sh
··· 1 - source $stdenv/setup 2 - 3 1 args= 4 2 5 3 target=$out
-3
pkgs/by-name/bo/boot/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 boot_bin=$out/bin/boot 5 2 6 3 mkdir -pv $(dirname $boot_bin)
-2
pkgs/by-name/in/invidious/videojs.sh
··· 1 - source $stdenv/setup 2 - 3 1 unpackPhase 4 2 cd source 5 3 # this helper downloads the videojs files and checks their checksums
-3
pkgs/by-name/wt/wtk/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 mkdir unzipped 5 2 pushd unzipped 6 3 unzip $src || true
-3
pkgs/by-name/xo/xorg_sys_opengl/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 mkdir -p $out/lib 5 2 6 3 ln -s /usr/lib/libGL.so.1 $out/lib/
-1
pkgs/by-name/ya/yandex-disk/package.nix
··· 28 28 }; 29 29 30 30 builder = writeText "builder.sh" '' 31 - . $stdenv/setup 32 31 mkdir -pv $out/bin 33 32 mkdir -pv $out/share 34 33 mkdir -pv $out/etc
-2
pkgs/development/bower-modules/generic/default.nix
··· 18 18 inherit bowerPackages; 19 19 20 20 builder = builtins.toFile "builder.sh" '' 21 - source $stdenv/setup 22 - 23 21 # The project's bower.json is required 24 22 cp $src/bower.json . 25 23
-3
pkgs/development/compilers/chicken/4/fetchegg/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 echo "exporting egg ${eggName} (version $version) into $out" 5 2 6 3 mkdir -p $out
-3
pkgs/development/compilers/fpc/binary-builder-darwin.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 pkgdir=$(pwd)/pkg 5 2 deploydir=$(pwd)/deploy 6 3
-3
pkgs/development/compilers/fpc/binary-builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 tar xf $src 5 2 cd */ 6 3 tarballdir=$(pwd)
-2
pkgs/development/compilers/ios-cross-compile/9.2_builder.sh
··· 1 1 # -*- shell-script -*- 2 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 3 - source $stdenv/setup 4 2 5 3 function extract 6 4 {
-3
pkgs/development/libraries/glibc/locales-builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 1 # Glibc cannot have itself in its RPATH. 3 2 export NIX_NO_SELF_RPATH=1 4 - 5 - source $stdenv/setup 6 3 7 4 postConfigure() { 8 5 # Hack: get rid of the `-static' flag set by the bootstrap stdenv.
-3
pkgs/development/libraries/gtk-sharp/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 genericBuild 5 2 6 3 # !!! hack
-3
pkgs/development/perl-modules/generic/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 PERL5LIB="$PERL5LIB${PERL5LIB:+:}$out/lib/perl5/site_perl" 5 2 6 3 perlFlags=
-3
pkgs/development/tools/misc/automake/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 # Wrap the given `aclocal' program, appending extra `-I' flags 5 2 # corresponding to the directories listed in $ACLOCAL_PATH. (Note 6 3 # that `wrapProgram' can't be used for that purpose since it can only
-3
pkgs/os-specific/linux/nvidia-x11/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - source $stdenv/setup 3 - 4 1 unpackManually() { 5 2 skip=$(sed 's/^skip=//; t; d' $src) 6 3 tail -n +$skip $src | bsdtar xvf -
-3
pkgs/servers/x11/xorg/builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 1 # This is the builder for all X.org components. 3 - source $stdenv/setup 4 - 5 2 6 3 # After installation, automatically add all "Requires" fields in the 7 4 # pkgconfig files (*.pc) to the propagated build inputs.
-3
pkgs/stdenv/generic/default-builder.sh
··· 1 - if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 - 3 - source $stdenv/setup 4 1 genericBuild
+1 -1
pkgs/stdenv/generic/make-derivation.nix
··· 400 400 ); 401 401 }) // { 402 402 builder = attrs.realBuilder or stdenv.shell; 403 - args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; 403 + args = attrs.args or ["-e" ./source-stdenv.sh (attrs.builder or ./default-builder.sh)]; 404 404 inherit stdenv; 405 405 406 406 # The `system` attribute of a derivation has special meaning to Nix.
+3
pkgs/stdenv/generic/source-stdenv.sh
··· 1 + if [ -e "$NIX_ATTRS_SH_FILE" ]; then . "$NIX_ATTRS_SH_FILE"; elif [ -f .attrs.sh ]; then . .attrs.sh; fi 2 + source "$stdenv/setup" 3 + source "$1"
-2
pkgs/tools/typesetting/tex/nix/animatedot.sh
··· 1 - source $stdenv/setup 2 - 3 1 mkdir -p $out 4 2 5 3 for ((i = 1; i <= $nrFrames; i++)); do
-2
pkgs/tools/typesetting/tex/nix/dot2pdf.sh
··· 1 - source $stdenv/setup 2 - 3 1 mkdir -p $out 4 2 5 3 dot2pdf() {
-2
pkgs/tools/typesetting/tex/nix/dot2ps.sh
··· 1 - source $stdenv/setup 2 - 3 1 mkdir -p $out 4 2 5 3 dot2ps() {
-2
pkgs/tools/typesetting/tex/nix/lhs2tex.sh
··· 1 - source $stdenv/setup 2 - 3 1 mkdir -p $out 4 2 5 3 mkdir root
-2
pkgs/tools/typesetting/tex/nix/run-latex.sh
··· 1 - source $stdenv/setup 2 - 3 1 mkdir -p $out 4 2 5 3 export VARTEXFONTS=$TMPDIR/texfonts