summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xpkgs/build-support/fetchurl/builder.sh10
-rw-r--r--pkgs/build-support/fetchurl/default.nix11
-rwxr-xr-xpkgs/development/compilers/gcc/builder.sh121
-rwxr-xr-xpkgs/development/compilers/strategoxt/builder.sh13
-rw-r--r--pkgs/development/compilers/strategoxt/default.nix16
-rw-r--r--pkgs/development/libraries/aterm/aterm-2.0.5.nix10
-rwxr-xr-xpkgs/development/libraries/aterm/builder.sh10
-rw-r--r--pkgs/development/libraries/aterm/default.nix12
-rwxr-xr-xpkgs/development/libraries/fontconfig/builder.sh1
-rwxr-xr-xpkgs/development/libraries/glibc/builder.sh40
-rw-r--r--pkgs/development/libraries/glibc/default.nix7
-rwxr-xr-xpkgs/development/libraries/gtk+-1/gtk+/builder.sh2
-rwxr-xr-xpkgs/development/libraries/gtk+/gtk+/builder.sh12
-rwxr-xr-xpkgs/development/libraries/gtk+/pango/builder.sh2
-rwxr-xr-xpkgs/development/libraries/libpng/builder.sh2
-rwxr-xr-xpkgs/development/libraries/pcre/builder.sh12
-rw-r--r--pkgs/development/libraries/pcre/default.nix6
-rwxr-xr-xpkgs/development/libraries/zlib/builder.sh14
-rw-r--r--pkgs/development/libraries/zlib/default.nix12
-rwxr-xr-xpkgs/development/tools/build-managers/gnumake/builder.sh12
-rw-r--r--pkgs/development/tools/build-managers/gnumake/default.nix8
-rw-r--r--pkgs/development/tools/build-managers/gnumake/log.diff125
-rwxr-xr-xpkgs/development/tools/misc/binutils/builder.sh19
-rw-r--r--pkgs/development/tools/misc/binutils/default.nix2
-rwxr-xr-xpkgs/os-specific/linux/kernel-headers/builder.sh28
-rwxr-xr-xpkgs/shells/bash/builder.sh14
-rw-r--r--pkgs/shells/bash/default.nix8
-rw-r--r--pkgs/stdenv/generic/docs.txt93
-rw-r--r--pkgs/stdenv/generic/setup.sh302
-rw-r--r--pkgs/stdenv/nix-linux/boot.nix6
-rw-r--r--pkgs/stdenv/nix/path.nix1
-rw-r--r--pkgs/system/all-packages-generic.nix8
-rw-r--r--pkgs/system/populate-cache.nix90
-rw-r--r--pkgs/system/stdenvs.nix12
-rwxr-xr-xpkgs/tools/archivers/gnutar/builder.sh12
-rw-r--r--pkgs/tools/archivers/gnutar/default.nix6
-rwxr-xr-xpkgs/tools/archivers/unzip/builder.sh20
-rw-r--r--pkgs/tools/archivers/unzip/default.nix6
-rwxr-xr-xpkgs/tools/compression/bzip2/builder.sh12
-rw-r--r--pkgs/tools/compression/bzip2/default.nix6
-rwxr-xr-xpkgs/tools/compression/gzip/builder.sh12
-rw-r--r--pkgs/tools/compression/gzip/default.nix6
-rwxr-xr-xpkgs/tools/graphics/graphviz/builder.sh14
-rwxr-xr-xpkgs/tools/misc/coreutils/builder.sh12
-rw-r--r--pkgs/tools/misc/coreutils/default.nix6
-rwxr-xr-xpkgs/tools/misc/findutils/builder.sh12
-rw-r--r--pkgs/tools/misc/findutils/default.nix6
-rwxr-xr-xpkgs/tools/networking/curl/builder.sh4
-rw-r--r--pkgs/tools/networking/curl/default.nix13
-rwxr-xr-xpkgs/tools/networking/wget/builder.sh12
-rw-r--r--pkgs/tools/networking/wget/default.nix12
-rwxr-xr-xpkgs/tools/text/diffutils/builder.sh10
-rw-r--r--pkgs/tools/text/diffutils/default.nix6
-rwxr-xr-xpkgs/tools/text/gawk/builder.sh12
-rw-r--r--pkgs/tools/text/gawk/default.nix6
-rwxr-xr-xpkgs/tools/text/gnugrep/builder.sh13
-rw-r--r--pkgs/tools/text/gnugrep/default.nix8
-rwxr-xr-xpkgs/tools/text/gnused/builder.sh10
-rw-r--r--pkgs/tools/text/gnused/default.nix6
59 files changed, 899 insertions, 384 deletions
diff --git a/pkgs/build-support/fetchurl/builder.sh b/pkgs/build-support/fetchurl/builder.sh
index e0f2517e3c2e..8ab2e6df9ed0 100755
--- a/pkgs/build-support/fetchurl/builder.sh
+++ b/pkgs/build-support/fetchurl/builder.sh
@@ -1,13 +1,15 @@
-#! /bin/sh
+#! /bin/sh -e
 
 . $stdenv/setup
 
-echo "downloading $url into $out..."
+header "downloading $out from $url"
 
-wget --passive-ftp "$url" -O "$out" || exit 1
+curl "$url" > "$out"
 
-actual=$(md5sum -b $out | cut -c1-32)
+actual=$(md5sum -b "$out" | cut -c1-32)
 if test "$actual" != "$md5"; then
     echo "hash is $actual, expected $md5"
     exit 1
 fi
+
+stopNext
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix
index fe2c79bbcdd1..f1b9566fb270 100644
--- a/pkgs/build-support/fetchurl/default.nix
+++ b/pkgs/build-support/fetchurl/default.nix
@@ -1,9 +1,12 @@
-{stdenv}: {url, md5}: derivation {
+{stdenv, curl}: {url, md5}:
+
+# Note that `curl' may be `null', in case of the native stdenv.
+
+derivation {
   name = baseNameOf (toString url);
   system = stdenv.system;
   builder = ./builder.sh;
-  stdenv = stdenv;
-  url = url;
-  md5 = md5;
+  buildInputs = [curl];
   id = md5;
+  inherit stdenv url md5;
 }
diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh
index c1438e6d0e88..1b35be16e431 100755
--- a/pkgs/development/compilers/gcc/builder.sh
+++ b/pkgs/development/compilers/gcc/builder.sh
@@ -1,65 +1,74 @@
 #! /bin/sh -e
 
-buildinputs="$binutils"
 . $stdenv/setup
 
-tar xvfj $src
 
-if test "$noSysDirs" = "1"; then
-    # Disable the standard include directories.
-    cd gcc-*
-    cat >> ./gcc/cppdefault.h <<EOF
+preConfigure() {
+    
+    if test "$noSysDirs" = "1"; then
+        # Disable the standard include directories.
+        cat >> ./gcc/cppdefault.h <<EOF
 #undef LOCAL_INCLUDE_DIR
 #undef SYSTEM_INCLUDE_DIR
 #undef STANDARD_INCLUDE_DIR
 EOF
-    cd ..
-fi
-
-langs="c"
-if test -n "$langCC"; then
-    langs="$langs,c++"
-fi
-if test -n "$langF77"; then
-    langs="$langs,f77"
-fi
-
-# Configure.
-mkdir build
-cd build
-../gcc-*/configure --prefix=$out --enable-languages="$langs"
-
-if test "$noSysDirs" = "1"; then
-    # Patch some of the makefiles to force linking against our own glibc.
-    . $NIX_GCC/nix-support/add-flags # add glibc/gcc flags
-    extraflags="-Wl,-s $NIX_CFLAGS_COMPILE $NIX_CFLAGS_LINK"
-    for i in $NIX_LDFLAGS; do
-        extraflags="$extraflags -Wl,$i"
-    done
-
-    mf=Makefile
-    sed \
-        -e "s^FLAGS_FOR_TARGET =\(.*\)^FLAGS_FOR_TARGET = \1 $extraflags^" \
-        < $mf > $mf.tmp
-    mv $mf.tmp $mf
-
-    mf=gcc/Makefile
-    sed \
-        -e "s^X_CFLAGS =\(.*\)^X_CFLAGS = \1 $extraflags^" \
-        < $mf > $mf.tmp
-    mv $mf.tmp $mf
-
-    # Patch gcc/Makefile to prevent fixinc.sh from "fixing" system header files
-    # from /usr/include.
-    mf=gcc/Makefile
-    sed \
-        -e "s^NATIVE_SYSTEM_HEADER_DIR =\(.*\)^NATIVE_SYSTEM_HEADER_DIR = /fixinc-disabled^" \
-        < $mf > $mf.tmp
-    mv $mf.tmp $mf
-fi
-
-# Build and install.
-make bootstrap
-make install
-
-find $out -name "*.a" -exec strip -S {} \;
+    fi
+
+    # Determine the frontends to build.
+    langs="c"
+    if test -n "$langCC"; then
+        langs="$langs,c++"
+    fi
+    if test -n "$langF77"; then
+        langs="$langs,f77"
+    fi
+
+    # Perform the build in a different directory.
+    mkdir ../build
+    cd ../build
+
+    configureScript=../$sourceRoot/configure
+    configureFlags="--enable-languages=$langs"
+}
+
+preConfigure=preConfigure
+
+
+postConfigure() {
+    if test "$noSysDirs" = "1"; then
+        # Patch some of the makefiles to force linking against our own
+        # glibc.
+        . $NIX_GCC/nix-support/add-flags # add glibc/gcc flags
+        extraflags="-Wl,-s $NIX_CFLAGS_COMPILE $NIX_CFLAGS_LINK"
+        for i in $NIX_LDFLAGS; do
+            extraflags="$extraflags -Wl,$i"
+        done
+
+        mf=Makefile
+        sed \
+            -e "s^FLAGS_FOR_TARGET =\(.*\)^FLAGS_FOR_TARGET = \1 $extraflags^" \
+            < $mf > $mf.tmp
+        mv $mf.tmp $mf
+
+        mf=gcc/Makefile
+        sed \
+            -e "s^X_CFLAGS =\(.*\)^X_CFLAGS = \1 $extraflags^" \
+            < $mf > $mf.tmp
+        mv $mf.tmp $mf
+
+        # Patch gcc/Makefile to prevent fixinc.sh from "fixing" system
+        # header files from /usr/include.
+        mf=gcc/Makefile
+        sed \
+            -e "s^NATIVE_SYSTEM_HEADER_DIR =\(.*\)^NATIVE_SYSTEM_HEADER_DIR = /fixinc-disabled^" \
+            < $mf > $mf.tmp
+        mv $mf.tmp $mf
+    fi
+}
+
+postConfigure=postConfigure
+
+
+makeFlags="bootstrap"
+
+genericBuild
diff --git a/pkgs/development/compilers/strategoxt/builder.sh b/pkgs/development/compilers/strategoxt/builder.sh
index 13f29624239e..68289b2f8be1 100755
--- a/pkgs/development/compilers/strategoxt/builder.sh
+++ b/pkgs/development/compilers/strategoxt/builder.sh
@@ -1,10 +1,7 @@
-#! /bin/sh
+#! /bin/sh -e
 
-buildinputs="$aterm $sdf"
-. $stdenv/setup || exit 1
+buildInputs="$aterm $sdf"
+. $stdenv/setup
 
-tar zxf $src || exit 1
-cd $dir* || exit 1
-./configure --prefix=$out --with-aterm=$aterm --with-sdf=$sdf || exit 1
-make || exit 1
-make install || exit 1
+configureFlags="--with-aterm=$aterm --with-sdf=$sdf"
+genericBuild
diff --git a/pkgs/development/compilers/strategoxt/default.nix b/pkgs/development/compilers/strategoxt/default.nix
index 666fbce583c4..75f8eacc3da4 100644
--- a/pkgs/development/compilers/strategoxt/default.nix
+++ b/pkgs/development/compilers/strategoxt/default.nix
@@ -1,14 +1,12 @@
-{stdenv, fetchurl, aterm, sdf}: derivation {
-  name = "strategoxt-0.9.4-4626";
+{stdenv, fetchurl, aterm, sdf}:
+
+derivation {
+  name = "strategoxt-0.9.4";
   system = stdenv.system;
   builder = ./builder.sh;
   src = fetchurl {
-    url = http://losser.labs.cs.uu.nl/~mbravenb/dailydist/strategoxt/src/strategoxt-0.9.4-4626.tar.gz;
-    md5 = "f33ae9fdb9d8628ae01fa0f26bfa0429";
+    url = ftp://ftp.stratego-language.org/pub/stratego/StrategoXT/strategoxt-0.9.4.tar.gz;
+    md5 = "b61aee784cebac6cce0d96383bdb1b37";
   };
-  stdenv = stdenv;
-  aterm = aterm;
-  sdf = sdf;
-  tarfile = "true";
-  dir = "strategoxt";
+  inherit stdenv aterm sdf;
 }
diff --git a/pkgs/development/libraries/aterm/aterm-2.0.5.nix b/pkgs/development/libraries/aterm/aterm-2.0.5.nix
deleted file mode 100644
index 9ed878d37752..000000000000
--- a/pkgs/development/libraries/aterm/aterm-2.0.5.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{stdenv, fetchurl}: derivation {
-  name = "aterm-2.0.5";
-  system = stdenv.system;
-  builder = ./builder.sh;
-  src = fetchurl {
-    url = http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.5.tar.gz;
-    md5 = "68aefb0c10b2ab876b8d3c0b2d0cdb1b";
-  };
-  stdenv = stdenv;
-}
diff --git a/pkgs/development/libraries/aterm/builder.sh b/pkgs/development/libraries/aterm/builder.sh
index 5915dc0f87d1..5946961adc58 100755
--- a/pkgs/development/libraries/aterm/builder.sh
+++ b/pkgs/development/libraries/aterm/builder.sh
@@ -1,10 +1,6 @@
 #! /bin/sh
 
-. $stdenv/setup || exit 1
+. $stdenv/setup
 
-tar xvfz $src || exit 1
-cd aterm-* || exit 1
-./configure --prefix=$out --with-gcc || exit 1
-make || exit 1
-make install || exit 1
-strip -S $out/lib/*.a || exit 1
+configureFlags="--with-gcc"
+genericBuild
diff --git a/pkgs/development/libraries/aterm/default.nix b/pkgs/development/libraries/aterm/default.nix
index 56b4c265ec0b..2d2a946f60a9 100644
--- a/pkgs/development/libraries/aterm/default.nix
+++ b/pkgs/development/libraries/aterm/default.nix
@@ -1,10 +1,12 @@
-{stdenv, fetchurl}: derivation {
-  name = "aterm-2.0";
+{stdenv, fetchurl}:
+
+derivation {
+  name = "aterm-2.0.5";
   system = stdenv.system;
   builder = ./builder.sh;
   src = fetchurl {
-    url = http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.tar.gz;
-    md5 = "853474e4bcf4a85f7d38a0676b36bded";
+    url = http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.5.tar.gz;
+    md5 = "68aefb0c10b2ab876b8d3c0b2d0cdb1b";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/development/libraries/fontconfig/builder.sh b/pkgs/development/libraries/fontconfig/builder.sh
index 7a521ea16f00..dc4243fadfec 100755
--- a/pkgs/development/libraries/fontconfig/builder.sh
+++ b/pkgs/development/libraries/fontconfig/builder.sh
@@ -10,7 +10,6 @@ export TZ=UTC
 tar xvfz $src
 cd fontconfig-*
 ./configure --prefix=$out --with-confdir=$out/etc/fonts \
- --x-includes=$x11/include --x-libraries=$x11/lib \
  --with-expat-includes=$expat/include --with-expat-lib=$expat/lib
 make
 make install
diff --git a/pkgs/development/libraries/glibc/builder.sh b/pkgs/development/libraries/glibc/builder.sh
index e2423ad37c29..29bcc7dc8e79 100755
--- a/pkgs/development/libraries/glibc/builder.sh
+++ b/pkgs/development/libraries/glibc/builder.sh
@@ -2,26 +2,36 @@
 
 # glibc cannot have itself in its rpath.
 export NIX_NO_SELF_RPATH=1
-buildinputs="$patch"
+
 . $stdenv/setup
 
-tar xvfj $glibcSrc
-(cd glibc-* && tar xvfj $linuxthreadsSrc) || false
 
-(cd glibc-* && patch -p1 < $vaargsPatch) || false
+postUnpack() {
+    cd $sourceRoot
+    unpackFile $linuxthreadsSrc
+    cd ..
+}
+
+postUnpack=postUnpack
+
+
+preConfigure() {
+    mkdir ../build
+    cd ../build
+    configureScript=../$sourceRoot/configure
+    configureFlags="--enable-add-ons --disable-profile"
+}
+
+preConfigure=preConfigure
 
-mkdir build
-cd build
-../glibc-*/configure --prefix=$out --enable-add-ons --disable-profile
 
-make
-make install
-make localedata/install-locales
-strip -S $out/lib/*.a $out/lib/*.so $out/lib/gconv/*.so || true
-strip -s $out/bin/* $out/sbin/* $out/libexec/* || true
+postInstall() {
+    make localedata/install-locales
+    rm $out/etc/ld.so.cache
+    (cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1
+}
 
-rm $out/etc/ld.so.cache
+postInstall=postInstall
 
-(cd $out/include && ln -s $kernelHeaders/include/* .) || false
 
-exit 0
+genericBuild
diff --git a/pkgs/development/libraries/glibc/default.nix b/pkgs/development/libraries/glibc/default.nix
index 6106e92812f7..c65281a7ce3a 100644
--- a/pkgs/development/libraries/glibc/default.nix
+++ b/pkgs/development/libraries/glibc/default.nix
@@ -7,7 +7,7 @@ derivation {
   system = stdenv.system;
   builder = ./builder.sh;
 
-  glibcSrc = fetchurl {
+  src = fetchurl {
     url = ftp://ftp.nl.net/pub/gnu/glibc/glibc-2.3.2.tar.bz2;
     md5 = "ede969aad568f48083e413384f20753c";
   };
@@ -18,7 +18,8 @@ derivation {
 
   # This is a patch to make glibc compile under GCC 3.3.  Presumably
   # later releases of glibc won't need this.
-  vaargsPatch = ./glibc-2.3.2-sscanf-1.patch;
+  patches = [./glibc-2.3.2-sscanf-1.patch];
 
-  inherit stdenv kernelHeaders patch;
+  buildInputs = [patch];
+  inherit stdenv kernelHeaders;
 }
diff --git a/pkgs/development/libraries/gtk+-1/gtk+/builder.sh b/pkgs/development/libraries/gtk+-1/gtk+/builder.sh
index 38cd16b31c78..14ba61f7054d 100755
--- a/pkgs/development/libraries/gtk+-1/gtk+/builder.sh
+++ b/pkgs/development/libraries/gtk+-1/gtk+/builder.sh
@@ -5,7 +5,7 @@ buildinputs="$x11 $glib"
 
 tar xvfz $src
 cd gtk+-*
-./configure --prefix=$out --x-includes=$x11/include --x-libraries=$x11/lib
+./configure --prefix=$out
 make
 make install
 
diff --git a/pkgs/development/libraries/gtk+/gtk+/builder.sh b/pkgs/development/libraries/gtk+/gtk+/builder.sh
index f899bec6cb61..0b444c1f0093 100755
--- a/pkgs/development/libraries/gtk+/gtk+/builder.sh
+++ b/pkgs/development/libraries/gtk+/gtk+/builder.sh
@@ -3,9 +3,19 @@
 buildinputs="$pkgconfig $x11 $glib $atk $pango $perl $libtiff $libjpeg $libpng"
 . $stdenv/setup
 
+IFS=:
+for i in $PATH; do echo $i; done
+
+#exit 1
+# A utility function for fixing up libtool scripts that scan in
+# default directories like /usr.  This is a bit of a hack.  A better
+# solution would be to fix libtool, but since it is included in so
+# many packages that is not feasible right now.
+
 tar xvfj $src
 cd gtk+-*
-./configure --prefix=$out --x-includes=$x11/include --x-libraries=$x11/lib
+fixLibtool ltmain.sh
+./configure --prefix=$out
 make
 make install
 
diff --git a/pkgs/development/libraries/gtk+/pango/builder.sh b/pkgs/development/libraries/gtk+/pango/builder.sh
index e3d0a68fd5f9..6242083508d8 100755
--- a/pkgs/development/libraries/gtk+/pango/builder.sh
+++ b/pkgs/development/libraries/gtk+/pango/builder.sh
@@ -5,7 +5,7 @@ buildinputs="$pkgconfig $x11 $glib $xft"
 
 tar xvfj $src
 cd pango-*
-./configure --prefix=$out --x-includes=$x11/include --x-libraries=$x11/lib
+./configure --prefix=$out
 make
 make install
 
diff --git a/pkgs/development/libraries/libpng/builder.sh b/pkgs/development/libraries/libpng/builder.sh
index 51e7a38a831c..24b847b59860 100755
--- a/pkgs/development/libraries/libpng/builder.sh
+++ b/pkgs/development/libraries/libpng/builder.sh
@@ -1,6 +1,6 @@
 #! /bin/sh -e
 
-buildinputs="$zlib"
+buildInputs="$zlib"
 . $stdenv/setup
 
 tar xvfj $src
diff --git a/pkgs/development/libraries/pcre/builder.sh b/pkgs/development/libraries/pcre/builder.sh
index dea883667fcc..a73f5a6d5b8d 100755
--- a/pkgs/development/libraries/pcre/builder.sh
+++ b/pkgs/development/libraries/pcre/builder.sh
@@ -1,9 +1,3 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfj $src || exit 1
-cd pcre-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+genericBuild
diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix
index 9e18d88fccf2..5b98a264e3ca 100644
--- a/pkgs/development/libraries/pcre/default.nix
+++ b/pkgs/development/libraries/pcre/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "pcre-4.3";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,5 @@
     url = ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-4.3.tar.bz2;
     md5 = "7bc7d5b590a41e6f9ede30f272002a02";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/development/libraries/zlib/builder.sh b/pkgs/development/libraries/zlib/builder.sh
index 4ca1a8305440..b8e06a6907f9 100755
--- a/pkgs/development/libraries/zlib/builder.sh
+++ b/pkgs/development/libraries/zlib/builder.sh
@@ -1,10 +1,4 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfz $src || exit 1
-cd zlib-* || exit 1
-./configure --prefix=$out --shared || exit 1
-make || exit 1
-mkdir $out || exit 1
-make install || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+configureFlags="--shared"
+genericBuild
diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index 7dfe3e6a9ab8..c5889e57fb4a 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -1,10 +1,12 @@
-{stdenv, fetchurl}: derivation {
-  name = "zlib-1.1.4";
+{stdenv, fetchurl}:
+
+derivation {
+  name = "zlib-1.2.1";
   system = stdenv.system;
   builder = ./builder.sh;
   src = fetchurl {
-    url = http://www.gzip.org/zlib/zlib-1.1.4.tar.gz;
-    md5 = "abc405d0bdd3ee22782d7aa20e440f08";
+    url = http://www.gzip.org/zlib/zlib-1.2.1.tar.gz;
+    md5 = "ef1cb003448b4a53517b8f25adb12452";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/development/tools/build-managers/gnumake/builder.sh b/pkgs/development/tools/build-managers/gnumake/builder.sh
index 362de7cd9a88..a73f5a6d5b8d 100755
--- a/pkgs/development/tools/build-managers/gnumake/builder.sh
+++ b/pkgs/development/tools/build-managers/gnumake/builder.sh
@@ -1,9 +1,3 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfj $src || exit 1
-cd make-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+genericBuild
diff --git a/pkgs/development/tools/build-managers/gnumake/default.nix b/pkgs/development/tools/build-managers/gnumake/default.nix
index 6ca56d57ba6d..de0bd9c901d4 100644
--- a/pkgs/development/tools/build-managers/gnumake/default.nix
+++ b/pkgs/development/tools/build-managers/gnumake/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl, patch}:
+
+derivation {
   name = "gnumake-3.80";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,7 @@
     url = ftp://ftp.nluug.nl/pub/gnu/make/make-3.80.tar.bz2;
     md5 = "0bbd1df101bc0294d440471e50feca71";
   };
-  stdenv = stdenv;
+  patches = [./log.diff];
+  buildInputs = [patch];
+  inherit stdenv;
 }
diff --git a/pkgs/development/tools/build-managers/gnumake/log.diff b/pkgs/development/tools/build-managers/gnumake/log.diff
new file mode 100644
index 000000000000..5d76ecdf4daa
--- /dev/null
+++ b/pkgs/development/tools/build-managers/gnumake/log.diff
@@ -0,0 +1,125 @@
+diff -rc make-3.80-orig/job.c make-3.80/job.c
+*** make-3.80-orig/job.c	2002-08-10 03:27:17.000000000 +0200
+--- make-3.80/job.c	2004-03-18 22:13:11.000000000 +0100
+***************
+*** 987,993 ****
+       appear.  */
+  
+    message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
+! 	   ? "%s" : (char *) 0, p);
+  
+    /* Tell update_goal_chain that a command has been started on behalf of
+       this target.  It is important that this happens here and not in
+--- 987,993 ----
+       appear.  */
+  
+    message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
+! 	   ? "\e[3s\e[a%s\e[b" : (char *) 0, p);
+  
+    /* Tell update_goal_chain that a command has been started on behalf of
+       this target.  It is important that this happens here and not in
+Only in make-3.80: job.c~
+diff -rc make-3.80-orig/main.c make-3.80/main.c
+*** make-3.80-orig/main.c	2002-08-10 03:27:17.000000000 +0200
+--- make-3.80/main.c	2004-03-18 22:23:50.000000000 +0100
+***************
+*** 254,259 ****
+--- 254,262 ----
+     they appear out of date or not.  */
+  
+  int always_make_flag = 0;
++ 
++ int logNesting = 0;
++ 
+  
+  /* The usage output.  We write it this way to make life easier for the
+     translators, especially those trying to translate to right-to-left
+***************
+*** 827,832 ****
+--- 830,842 ----
+  }
+  
+  
++ static void closeNesting()
++ {
++   while (logNesting--)
++     printf("\e[q");
++ }
++ 
++ 
+  #ifndef _AMIGA
+  int
+  main (argc, argv, envp)
+***************
+*** 854,859 ****
+--- 864,871 ----
+    no_default_sh_exe = 1;
+  #endif
+  
++   atexit(closeNesting);
++ 
+    default_goal_file = 0;
+    reading_file = 0;
+  
+***************
+*** 2782,2787 ****
+--- 2794,2805 ----
+  
+    /* Use entire sentences to give the translators a fighting chance.  */
+  
++   if (entering)
++     {
++       printf("\e[p");
++       logNesting++;
++     }
++   
+    if (makelevel == 0)
+      if (starting_directory == 0)
+        if (entering)
+***************
+*** 2810,2813 ****
+--- 2828,2837 ----
+        else
+          printf (_("%s[%u]: Leaving directory `%s'\n"),
+                  program, makelevel, starting_directory);
++ 
++   if (!entering)
++     {
++       printf("\e[q");
++       logNesting--;
++     }
+  }
+Only in make-3.80: main.c~
+diff -rc make-3.80-orig/make.h make-3.80/make.h
+*** make-3.80-orig/make.h	2002-09-11 18:55:44.000000000 +0200
+--- make-3.80/make.h	2004-03-18 22:22:00.000000000 +0100
+***************
+*** 559,562 ****
+--- 559,566 ----
+  extern int atomic_stat PARAMS ((const char *file, struct stat *buf));
+  extern struct dirent *atomic_readdir PARAMS ((DIR *dir));
+  
++ 
+  #endif
++ 
++ 
++ extern int logNesting;
+Only in make-3.80: make.h~
+diff -rc make-3.80-orig/remake.c make-3.80/remake.c
+*** make-3.80-orig/remake.c	2002-08-08 02:11:19.000000000 +0200
+--- make-3.80/remake.c	2004-03-18 22:27:04.000000000 +0100
+***************
+*** 1049,1055 ****
+--- 1049,1059 ----
+        /* The normal case: start some commands.  */
+        if (!touch_flag || file->cmds->any_recurse)
+  	{
++           message(0, "\e[pbuilding %s", file->name);
++           logNesting++;
+  	  execute_file_commands (file);
++           printf("\e[q");
++           logNesting--;
+  	  return;
+  	}
+  
+Only in make-3.80: remake.c~
diff --git a/pkgs/development/tools/misc/binutils/builder.sh b/pkgs/development/tools/misc/binutils/builder.sh
index 6de59a675d75..409cd4bba8c4 100755
--- a/pkgs/development/tools/misc/binutils/builder.sh
+++ b/pkgs/development/tools/misc/binutils/builder.sh
@@ -2,16 +2,13 @@
 
 . $stdenv/setup
 
-tar xvfj $src
-cd binutils-*
+patchConfigure() {
+    # Clear the default library search path.
+    if test "$noSysDirs" = "1"; then
+        echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
+    fi
+}
 
-# Clear the default library search path.
-if test "$noSysDirs" = "1"; then
-    echo 'NATIVE_LIB_DIRS=' >> ld/configure.tgt
-fi
+preConfigure=patchConfigure
 
-./configure --prefix=$out
-make
-make install
-
-strip -S $out/lib/*.a
+genericBuild
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index 63039877d6f4..5208abef6379 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -5,7 +5,7 @@ derivation {
   system = stdenv.system;
   builder = ./builder.sh;
   src = fetchurl {
-    url = ftp://ftp.nluug.nl/pub/gnu/binutils/binutils-2.14.tar.bz2;
+    url = ftp://ftp.nl.net/pub/gnu/binutils/binutils-2.14.tar.bz2;
     md5 = "2da8def15d28af3ec6af0982709ae90a";
   };
   inherit stdenv noSysDirs;
diff --git a/pkgs/os-specific/linux/kernel-headers/builder.sh b/pkgs/os-specific/linux/kernel-headers/builder.sh
index 87d022349980..957a2552c87f 100755
--- a/pkgs/os-specific/linux/kernel-headers/builder.sh
+++ b/pkgs/os-specific/linux/kernel-headers/builder.sh
@@ -2,16 +2,24 @@
 
 . $stdenv/setup
 
-tar xvfj $src
-cd linux-*
 
-make include/linux/version.h
+buildPhase() {
+    make include/linux/version.h
+}
 
-mkdir $out
-mkdir $out/include
-cp -prvd include/linux include/asm-i386 $out/include
-cd $out/include
-ln -s asm-i386 asm
+buildPhase=buildPhase
 
-# config.h includes autoconf.h, which doesn't exist.
-echo -n > $out/include/linux/autoconf.h
+
+installPhase() {
+    mkdir $out
+    mkdir $out/include
+    cp -prvd include/linux include/asm-i386 $out/include
+    cd $out/include
+    ln -s asm-i386 asm
+    echo -n > $out/include/linux/autoconf.h
+}
+
+installPhase=installPhase
+
+
+genericBuild
diff --git a/pkgs/shells/bash/builder.sh b/pkgs/shells/bash/builder.sh
index 7b0d093c5760..73a4e9020eb5 100755
--- a/pkgs/shells/bash/builder.sh
+++ b/pkgs/shells/bash/builder.sh
@@ -1,10 +1,4 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfz $src || exit 1
-cd bash-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
-(cd $out/bin; ln -s bash sh) || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+genericBuild
+(cd $out/bin && ln -s bash sh) || exit 1
diff --git a/pkgs/shells/bash/default.nix b/pkgs/shells/bash/default.nix
index 921995659041..3e824cfecc57 100644
--- a/pkgs/shells/bash/default.nix
+++ b/pkgs/shells/bash/default.nix
@@ -1,10 +1,12 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "bash-2.05b";
   system = stdenv.system;
   builder = ./builder.sh;
   src = fetchurl {
-    url = ftp://ftp.nluug.nl/pub/gnu/bash/bash-2.05b.tar.gz;
+    url = ftp://ftp.nl.net/pub/gnu/bash/bash-2.05b.tar.gz;
     md5 = "5238251b4926d778dfe162f6ce729733";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/stdenv/generic/docs.txt b/pkgs/stdenv/generic/docs.txt
new file mode 100644
index 000000000000..060f3cd154b9
--- /dev/null
+++ b/pkgs/stdenv/generic/docs.txt
@@ -0,0 +1,93 @@
+* genericBuild performs a generic build of (typically) autotool-style
+  packages
+
+  
+* unpack phase
+
+** may be overriden by setting $unpackPhase to point at a function that
+   unpacks the source (which should set $sourceRoot)
+
+** the generic unpacker unpacks all sources specified by $srcs, or
+   $src if $srcs is empty
+
+** supports tar, bzipped tar, gzipped tar, compressed tar, zip
+
+** zip must be in scope (in $buildinputs)
+
+** additional file types may be supported by setting $findUnpacker,
+   which is called with a single argument specifying the file to be
+   unpacked
+
+** $findUnpacker should set $unpackCmd, specifying the full command to
+   unpack the file (must include the file name)
+
+** alternatively, $unpackCmd can be set before calling the generic
+   builder (e.g., 'unpackCmd="unrar x $src"'); this only works if
+   there is a single source file
+
+** the generic unpacker then sets $sourceRoot to the name of the
+   directory created by unpacking the source archives
+
+** the source archives should produce only one directory
+
+** alternatively, $setSourceRoot may be set to a function that sets
+   $sourceRoot
+
+
+* the generic builder then chdirs to $sourceRoot
+
+
+* patch phase (skipped if neither $patchPhase nor $patches are set)
+
+** may be overriden by setting $patchPhase to point at a function that
+   unpacks the source (which should set $sourceRoot)
+
+** if the $patches variable is set, it runs `patch -p1 < ...' in
+   $sourceRoot for each element in $patches (the `patch' command
+   should be in $PATH; note that it isn't in the standard environment)
+
+
+* configuration phase
+
+** may be overriden by setting $configurePhase to point at a function
+
+** calls $preConfigurer first, if set (useful for running
+   autoconf/automake)
+
+** the configure script is specified by $configureScript, which
+   defaults to ./configure
+   
+** if no executable file exists at $configureScript, does nothing
+
+** if a file ./ltmain.sh exists and $dontFixLibtool is not set, calls
+   function fixLibtool to remove its default search path (/usr etc.)
+
+** adds "--prefix=$out" to $configureFlags unless $dontAddPrefix is
+   set
+
+** calls $configureScript with $configureFlags
+
+** calls $postConfigurer, if set (useful for any last-minute patches
+   prior to building)
+
+
+* build phase
+
+** may be overriden by setting $buildPhase to point at a function
+
+** runs make with flags $makeFlags
+
+
+* install phase
+
+** may be overriden by setting $installPhase to point at a function
+
+** runs make with flags $installFlags
+
+** unless $dontStrip is set or $NIX_STRIP_DEBUG is not 1, finds all *.a
+   files in $out and runs "strip -S" on them (executables and dynamic
+   libraries can be stripped automatically by setting NIX_STRIP_DEBUG
+   to 1 (default))
+
+** if $propagatedBuildInputs is set, its contents are written to
+   $out/nix-support/propagated-build-inputs
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 2dedf46ac2b3..f64260f490ae 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -40,7 +40,14 @@ fi
 findInputs()
 {
     local pkg=$1
-    pkgs=(${pkgs[@]} $pkg)
+
+    case $pkgs in
+        *\ $pkg\ *)
+            return 0
+            ;;
+    esac
+    
+    pkgs="$pkgs $pkg "
 
     if test -f $pkg/nix-support/setup-hook; then
         . $pkg/nix-support/setup-hook
@@ -53,8 +60,11 @@ findInputs()
     fi
 }
 
-pkgs=()
-for i in $buildinputs; do
+pkgs=""
+if test -n "$buildinputs"; then
+    buildInputs="$buildinputs" # compatibility
+fi
+for i in $buildInputs; do
     findInputs $i
 done
 
@@ -66,7 +76,7 @@ addToEnv()
     local pkg=$1
 
     if test -d $1/bin; then
-        export _PATH=$_PATH:$1/bin
+        export _PATH=$_PATH${_PATH:+:}$1/bin
     fi
 
     for i in "${envHooks[@]}"; do
@@ -74,7 +84,7 @@ addToEnv()
     done
 }
 
-for i in "${pkgs[@]}"; do
+for i in $pkgs; do
     addToEnv $i
 done
 
@@ -121,3 +131,285 @@ PATH=$_PATH${_PATH:+:}$PATH
 if test "$NIX_DEBUG" = "1"; then
     echo "Final path: $PATH"
 fi
+
+
+######################################################################
+# What follows is the generic builder.
+
+
+nestingLevel=0
+
+startNest() {
+    nestingLevel=$(($nestingLevel + 1))
+    echo -en "\e[$1p"
+}
+
+stopNest() {
+    nestingLevel=$(($nestingLevel - 1))
+    echo -en "\e[q"
+}
+
+header() {
+    startNest "$2"
+    echo "$1"
+}
+
+# Make sure that even when we exit abnormally, the original nesting
+# level is properly restored.
+closeNest() {
+    while test $nestingLevel -gt 0; do
+        stopNest
+    done
+}
+
+trap "closeNest" EXIT
+
+
+# Utility function: return the base name of the given path, with the
+# prefix `HASH-' removed, if present.
+stripHash() {
+    strippedName=$(basename $1);
+    if echo "$strippedName" | grep -q '^[a-f0-9]\{32\}-'; then
+        strippedName=$(echo "$strippedName" | cut -c34-)
+    fi
+}
+
+
+unpackFile() {
+    local file=$1
+    local cmd
+
+    case $file in
+        *.tar) cmd="tar xvf $file";;
+        *.tar.gz | *.tgz | *.tar.Z) cmd="tar xvfz $file";;
+        *.tar.bz2 | *.tbz2) cmd="tar xvfj $file";;
+        *.zip) cmd="unzip $file";;
+        *)
+            if test -d "$file"; then
+                stripHash $file
+                cmd="cp -prvd $file $strippedName"
+            else
+                if test -n "$findUnpacker"; then
+                    $findUnpacker $1;
+                fi
+                if test -z "$unpackCmd"; then
+                    echo "source archive $file has unknown type"
+                    exit 1
+                fi
+                cmd=$unpackCmd
+            fi
+            ;;
+    esac
+
+    header "unpacking source archive $file (using $cmd)" 3
+    $cmd
+    stopNest
+}
+
+
+unpackW() {
+    if test -n "$unpackPhase"; then
+        $unpackPhase
+        return
+    fi
+
+    if test -z "$srcs"; then
+        if test -z "$src"; then
+            echo 'variable $src or $srcs should point to the source'
+            exit 1
+        fi
+        srcs="$src"
+    fi
+
+    # To determine the source directory created by unpacking the
+    # source archives, we record the contents of the current
+    # directory, then look below which directory got added.  Yeah,
+    # it's rather hacky.
+    local dirsBefore=""
+    for i in *; do
+        if test -d "$i"; then
+            dirsBefore="$dirsBefore $i "
+        fi
+    done
+
+    # Unpack all source archives.
+    for i in $srcs; do
+        unpackFile $i
+    done
+
+    # Find the source directory.
+    if test -n "$setSourceRoot"; then
+        $setSourceRoot
+    else
+        sourceRoot=
+        for i in *; do
+            if test -d "$i"; then
+                case $dirsBefore in
+                    *\ $i\ *)
+                        ;;
+                    *)
+                        if test -n "$sourceRoot"; then
+                            echo "unpacker produced multiple directories"
+                            exit 1
+                        fi
+                        sourceRoot=$i
+                        ;;
+                esac
+            fi
+        done
+    fi
+
+    if test -z "$sourceRoot"; then
+        echo "unpacker appears to have produced no directories"
+        exit 1
+    fi
+
+    echo "source root is $sourceRoot"
+
+    if test -n "$postUnpack"; then
+        $postUnpack
+    fi
+}
+
+
+unpackPhase() {
+    header "unpacking sources"
+    unpackW
+    stopNest
+}
+
+
+patchW() {
+    if test -n "$patchPhase"; then
+        $patchPhase
+        return
+    fi
+
+    for i in $patches; do
+        header "applying patch $i" 3
+        patch -p1 < $i
+        stopNest
+    done
+}
+
+
+patchPhase() {
+    if test -z "$patchPhase" -a -z "$patches"; then return; fi
+    header "patching sources"
+    patchW
+    stopNest
+}
+
+
+fixLibtool () {
+    sed 's^eval sys_lib_.*search_path=.*^^' < $1 > $1.tmp
+    mv $1.tmp $1
+}
+
+
+configureW() {
+    if test -n "$configurePhase"; then
+        $configurePhase
+        stopNest
+        return
+    fi
+
+    if test -n "$preConfigure"; then
+        $preConfigure
+    fi
+
+    if test -z "$configureScript"; then
+        configureScript=./configure
+    fi
+    
+    if ! test -x $configureScript; then
+        echo "no configure script, doing nothing"
+        return
+    fi
+
+    if test -z "$dontFixLibtool" -a -f ./ltmain.sh; then
+        fixLibtool ./ltmain.sh
+    fi
+
+    if test -z "$dontAddPrefix"; then
+        configureFlags="--prefix=$out $configureFlags"
+    fi
+
+    echo "configure flags: $configureFlags"
+    $configureScript $configureFlags
+
+    if test -n "$postConfigure"; then
+        $postConfigure
+    fi
+}
+
+
+configurePhase() {
+    header "configuring"
+    configureW
+    stopNest
+}
+
+
+buildW() {
+    if test -n "$buildPhase"; then
+        $buildPhase
+        return
+    fi
+
+    echo "make flags: $makeFlags"
+    make $makeFlags
+}
+
+
+buildPhase() {
+    header "building"
+    buildW
+    stopNest
+}
+
+
+installW() {
+    if test -n "$installPhase"; then
+        $installPhase
+        return
+    fi
+    
+    if test -n "$preInstall"; then
+        $preInstall
+    fi
+    
+    make install $installFlags
+
+    if test -z "$dontStrip" -a "$NIX_STRIP_DEBUG" = 1; then
+        find $out -name "*.a" -exec echo stripping {} \; -exec strip -S {} \;
+    fi
+
+    if test -n "$propagatedBuildInputs"; then
+        mkdir -f $out/nix-support
+        echo "$propagatedBuildInputs" > $out/nix-support/propagated-build-inputs
+    fi
+
+    if test -n "$postInstall"; then
+        $postInstall
+    fi
+}
+
+
+installPhase() {
+    header "installing"
+    installW
+    stopNest
+}
+
+
+genericBuild () {
+    header "building $out"
+    unpackPhase
+    cd $sourceRoot
+    patchPhase
+    configurePhase
+    buildPhase
+    installPhase
+    stopNest
+}
diff --git a/pkgs/stdenv/nix-linux/boot.nix b/pkgs/stdenv/nix-linux/boot.nix
index 2e1f272fc603..de2d5128e288 100644
--- a/pkgs/stdenv/nix-linux/boot.nix
+++ b/pkgs/stdenv/nix-linux/boot.nix
@@ -1,13 +1,13 @@
-{stdenv, glibc}:
+{stdenv, glibc, genericStdenv, gccWrapper}:
 
-(import ../generic) {
+genericStdenv {
   name = "stdenv-nix-linux-boot";
   preHook = ./prehook-boot.sh;
   initialPath = "/usr/local /usr /";
 
   inherit stdenv;
 
-  gcc = (import ../../build-support/gcc-wrapper) {
+  gcc = gccWrapper {
     name = "gcc-native";
     nativeTools = true;
     nativeGlibc = false;
diff --git a/pkgs/stdenv/nix/path.nix b/pkgs/stdenv/nix/path.nix
index b3348cb0f350..c05c0ec7ec02 100644
--- a/pkgs/stdenv/nix/path.nix
+++ b/pkgs/stdenv/nix/path.nix
@@ -8,7 +8,6 @@
   pkgs.gnutar
   pkgs.gzip
   pkgs.bzip2
-  pkgs.wget
   pkgs.binutils
   pkgs.gnumake
   pkgs.gcc
diff --git a/pkgs/system/all-packages-generic.nix b/pkgs/system/all-packages-generic.nix
index 7a263f124ee6..db0f0325b310 100644
--- a/pkgs/system/all-packages-generic.nix
+++ b/pkgs/system/all-packages-generic.nix
@@ -2,7 +2,7 @@
 # identifier and a standard build environment, returns the set of all
 # packages provided by the Nix Package Collection.
 
-{stdenv, noSysDirs ? true}:
+{stdenv, bootCurl, noSysDirs ? true}:
 
 rec {
 
@@ -13,6 +13,7 @@ rec {
 
   fetchurl = (import ../build-support/fetchurl) {
     inherit stdenv;
+    curl = bootCurl;
   };
 
   fetchsvn = (import ../build-support/fetchsvn) {
@@ -86,6 +87,10 @@ rec {
     inherit fetchurl stdenv;
   };
 
+  curl = (import ../tools/networking/curl) {
+    inherit fetchurl stdenv zlib;
+  };
+
   par2cmdline = (import ../tools/networking/par2cmdline) {
     inherit fetchurl stdenv;
   };
@@ -176,6 +181,7 @@ rec {
 
   gnumake = (import ../development/tools/build-managers/gnumake) {
     inherit fetchurl stdenv;
+    patch = gnupatch;
   };
 
   bison = (import ../development/tools/parsing/bison) {
diff --git a/pkgs/system/populate-cache.nix b/pkgs/system/populate-cache.nix
index d8eeee34dda0..a716f6be4eed 100644
--- a/pkgs/system/populate-cache.nix
+++ b/pkgs/system/populate-cache.nix
@@ -2,54 +2,54 @@ let {
   pkgs = import ./i686-linux.nix;
   body = 
     [
-#      pkgs.coreutils
-#      pkgs.findutils
-#      pkgs.diffutils
-#      pkgs.gnupatch
-#      pkgs.gnused
-#      pkgs.gnugrep
-#      pkgs.gawk
-#      pkgs.gnutar
-#      pkgs.zip
-#      pkgs.unzip
-#      pkgs.gzip
-#      pkgs.bzip2
-#      pkgs.wget
-#      pkgs.par2cmdline
-#      pkgs.cksfv
-#      pkgs.bittorrent
-#      pkgs.graphviz
-#      pkgs.bash
-#      pkgs.binutils
-#      pkgs.gnum4
-#      pkgs.valgrind
-#      pkgs.texinfo
+      pkgs.coreutils
+      pkgs.findutils
+      pkgs.diffutils
+      pkgs.gnupatch
+      pkgs.gnused
+      pkgs.gnugrep
+      pkgs.gawk
+      pkgs.gnutar
+      pkgs.zip
+      pkgs.unzip
+      pkgs.gzip
+      pkgs.bzip2
+      pkgs.wget
+      pkgs.par2cmdline
+      pkgs.cksfv
+      pkgs.bittorrent
+      pkgs.graphviz
+      pkgs.bash
+      pkgs.binutils
+      pkgs.gnum4
+      pkgs.valgrind
+      pkgs.texinfo
       pkgs.octavefront
-#      pkgs.gnumake
-#      pkgs.bisonnew
-#      pkgs.flexnew
+      pkgs.gnumake
+      pkgs.bisonnew
+      pkgs.flexnew
       pkgs.gcc
-#      pkgs.strategoxt093
-#      pkgs.ghc
-#      pkgs.helium
-#      pkgs.perl
-#      pkgs.python
-#      pkgs.libxml2
-#      pkgs.libxslt
-#      pkgs.docbook_xml_dtd
-#      pkgs.docbook_xml_xslt
+      pkgs.strategoxt093
+      pkgs.ghc
+      pkgs.helium
+      pkgs.perl
+      pkgs.python
+      pkgs.libxml2
+      pkgs.libxslt
+      pkgs.docbook_xml_dtd
+      pkgs.docbook_xml_xslt
       pkgs.subversion
       pkgs.pan
-#      pkgs.sylpheed
-#      pkgs.firefox
-#      pkgs.MPlayer
-#      pkgs.MPlayerPlugin
-#      pkgs.vlc
-#      pkgs.zapping
-#      pkgs.gqview
-#      pkgs.hello
-#      pkgs.nxml
-#      pkgs.uml
-#      pkgs.nix
+      pkgs.sylpheed
+      pkgs.firefox
+      pkgs.MPlayer
+      pkgs.MPlayerPlugin
+      pkgs.vlc
+      pkgs.zapping
+      pkgs.gqview
+      pkgs.hello
+      pkgs.nxml
+      pkgs.uml
+      pkgs.nix
     ];
 }
diff --git a/pkgs/system/stdenvs.nix b/pkgs/system/stdenvs.nix
index ecf8fa0f5280..d8006ddb8299 100644
--- a/pkgs/system/stdenvs.nix
+++ b/pkgs/system/stdenvs.nix
@@ -25,7 +25,11 @@
   # with it (e.g., because they require GNU Make).
   stdenvNative = (import ../stdenv/native) {stdenv = stdenvInitial;};
 
-  stdenvNativePkgs = allPackages {stdenv = stdenvNative; noSysDirs = false;};
+  stdenvNativePkgs = allPackages {
+    stdenv = stdenvNative;
+    bootCurl = null;
+    noSysDirs = false;
+  };
 
 
   # The Nix build environment.
@@ -49,10 +53,14 @@
   stdenvLinuxBoot1 = (import ../stdenv/nix-linux/boot.nix) {
     stdenv = stdenvNative;
     glibc = stdenvLinuxGlibc;
+    inherit genericStdenv gccWrapper;
   };
 
   # 3) Now we can build packages that will have the Nix glibc.
-  stdenvLinuxBoot1Pkgs = allPackages {stdenv = stdenvLinuxBoot1;};
+  stdenvLinuxBoot1Pkgs = allPackages {
+    stdenv = stdenvLinuxBoot1;
+    bootCurl = null;
+  };
 
   # 4) However, since these packages are built by an native C compiler
   #    and linker, they may well pick up impure references (e.g., bash
diff --git a/pkgs/tools/archivers/gnutar/builder.sh b/pkgs/tools/archivers/gnutar/builder.sh
index f79d158b86a5..a73f5a6d5b8d 100755
--- a/pkgs/tools/archivers/gnutar/builder.sh
+++ b/pkgs/tools/archivers/gnutar/builder.sh
@@ -1,9 +1,3 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfz $src || exit 1
-cd tar-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+genericBuild
diff --git a/pkgs/tools/archivers/gnutar/default.nix b/pkgs/tools/archivers/gnutar/default.nix
index b7c18e872ad9..e5cbf559cf8f 100644
--- a/pkgs/tools/archivers/gnutar/default.nix
+++ b/pkgs/tools/archivers/gnutar/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "gnutar-1.13.25";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,5 @@
     url = ftp://alpha.gnu.org/gnu/tar/tar-1.13.25.tar.gz;
     md5 = "6ef8c906e81eee441f8335652670ac4a";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/tools/archivers/unzip/builder.sh b/pkgs/tools/archivers/unzip/builder.sh
index 90613620c7b9..f0b9d031802c 100755
--- a/pkgs/tools/archivers/unzip/builder.sh
+++ b/pkgs/tools/archivers/unzip/builder.sh
@@ -1,8 +1,16 @@
-#! /bin/sh
+#! /bin/sh -e
 
-. $stdenv/setup || exit 1
+. $stdenv/setup
 
-tar xvfz $src || exit 1
-cd unzip-* || exit 1
-make -f unix/Makefile generic || exit 1
-make -f unix/Makefile prefix=$out install || exit 1
+builder() {
+    make -f unix/Makefile generic
+}
+
+installer() {
+    make -f unix/Makefile prefix=$out install
+}
+
+buildPhase=builder
+installPhase=installer
+
+genericBuild
diff --git a/pkgs/tools/archivers/unzip/default.nix b/pkgs/tools/archivers/unzip/default.nix
index b9904ea8646d..8467e00d029d 100644
--- a/pkgs/tools/archivers/unzip/default.nix
+++ b/pkgs/tools/archivers/unzip/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "unzip-5.50";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,5 @@
     url = ftp://ftp.info-zip.org/pub/infozip/src/unzip550.tar.gz;
     md5 = "798592d62e37f92571184236947122ed";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/tools/compression/bzip2/builder.sh b/pkgs/tools/compression/bzip2/builder.sh
index 2fa113aa17a6..e2c5982852e6 100755
--- a/pkgs/tools/compression/bzip2/builder.sh
+++ b/pkgs/tools/compression/bzip2/builder.sh
@@ -1,8 +1,4 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfz $src || exit 1
-cd bzip2-* || exit 1
-make || exit 1
-make install PREFIX=$out || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+installFlags="PREFIX=$out"
+genericBuild
diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix
index 1684edd1659f..af3ec46dec79 100644
--- a/pkgs/tools/compression/bzip2/default.nix
+++ b/pkgs/tools/compression/bzip2/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "bzip2-1.0.2";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,5 @@
     url = ftp://sources.redhat.com/pub/bzip2/v102/bzip2-1.0.2.tar.gz;
     md5 = "ee76864958d568677f03db8afad92beb";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/tools/compression/gzip/builder.sh b/pkgs/tools/compression/gzip/builder.sh
index 0254e252958a..a73f5a6d5b8d 100755
--- a/pkgs/tools/compression/gzip/builder.sh
+++ b/pkgs/tools/compression/gzip/builder.sh
@@ -1,9 +1,3 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfz $src || exit 1
-cd gzip-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+genericBuild
diff --git a/pkgs/tools/compression/gzip/default.nix b/pkgs/tools/compression/gzip/default.nix
index a5902361fe7f..d766635b05b2 100644
--- a/pkgs/tools/compression/gzip/default.nix
+++ b/pkgs/tools/compression/gzip/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "gzip-1.3.3";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,5 @@
     url = http://www.gzip.org/gzip-1.3.3.tar.gz;
     md5 = "52eaf713673507d21f7abefee98ba662";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/tools/graphics/graphviz/builder.sh b/pkgs/tools/graphics/graphviz/builder.sh
index f37ee4412c2f..3fd6c6bb902a 100755
--- a/pkgs/tools/graphics/graphviz/builder.sh
+++ b/pkgs/tools/graphics/graphviz/builder.sh
@@ -1,10 +1,10 @@
-#! /bin/sh
+#! /bin/sh -e
 
 buildinputs="$x11 $libpng $libjpeg $expat $freetype"
-. $stdenv/setup || exit 1
+. $stdenv/setup
 
-tar xvfz $src || exit 1
-cd graphviz-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+if test -z "$x11"; then 
+    configureFlags="$configureFlags --without-x"
+fi
+
+genericBuild
diff --git a/pkgs/tools/misc/coreutils/builder.sh b/pkgs/tools/misc/coreutils/builder.sh
index 753086391082..a73f5a6d5b8d 100755
--- a/pkgs/tools/misc/coreutils/builder.sh
+++ b/pkgs/tools/misc/coreutils/builder.sh
@@ -1,9 +1,3 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfj $src || exit 1
-cd coreutils-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+genericBuild
diff --git a/pkgs/tools/misc/coreutils/default.nix b/pkgs/tools/misc/coreutils/default.nix
index d5a4b7295569..009ff76ab672 100644
--- a/pkgs/tools/misc/coreutils/default.nix
+++ b/pkgs/tools/misc/coreutils/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "coreutils-5.0";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,5 @@
     url = ftp://ftp.nluug.nl/pub/gnu/coreutils/coreutils-5.0.tar.bz2;
     md5 = "94e5558ee2a65723d4840bfde2d323f0";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/tools/misc/findutils/builder.sh b/pkgs/tools/misc/findutils/builder.sh
index f61ec740c1b8..a73f5a6d5b8d 100755
--- a/pkgs/tools/misc/findutils/builder.sh
+++ b/pkgs/tools/misc/findutils/builder.sh
@@ -1,9 +1,3 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfz $src || exit 1
-cd findutils-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+genericBuild
diff --git a/pkgs/tools/misc/findutils/default.nix b/pkgs/tools/misc/findutils/default.nix
index 957aef5e0e4b..1aafc9999159 100644
--- a/pkgs/tools/misc/findutils/default.nix
+++ b/pkgs/tools/misc/findutils/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "findutils-4.1.20";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,5 @@
     url = ftp://alpha.gnu.org/pub/gnu/findutils/findutils-4.1.20.tar.gz;
     md5 = "e90ce7222daadeb8616b8db461e17cbc";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/tools/networking/curl/builder.sh b/pkgs/tools/networking/curl/builder.sh
new file mode 100755
index 000000000000..6e33f41fff56
--- /dev/null
+++ b/pkgs/tools/networking/curl/builder.sh
@@ -0,0 +1,4 @@
+#! /bin/sh -e
+. $stdenv/setup
+configureFlags="--without-ssl"
+genericBuild
diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
new file mode 100644
index 000000000000..a2e9c273847f
--- /dev/null
+++ b/pkgs/tools/networking/curl/default.nix
@@ -0,0 +1,13 @@
+{stdenv, fetchurl, zlib}:
+
+derivation {
+  name = "curl-7.11.1";
+  system = stdenv.system;
+  builder = ./builder.sh;
+  src = fetchurl {
+    url = http://curl.haxx.se/download/curl-7.11.1.tar.bz2;
+    md5 = "c2af7c3364a1a8839516f74961b6bd11";
+  };
+  buildInputs = [zlib];
+  inherit stdenv;
+}
diff --git a/pkgs/tools/networking/wget/builder.sh b/pkgs/tools/networking/wget/builder.sh
index 9523d7e9ca82..a73f5a6d5b8d 100755
--- a/pkgs/tools/networking/wget/builder.sh
+++ b/pkgs/tools/networking/wget/builder.sh
@@ -1,9 +1,3 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfz $src || exit 1
-cd wget-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+genericBuild
diff --git a/pkgs/tools/networking/wget/default.nix b/pkgs/tools/networking/wget/default.nix
index d0b7d01c1de8..b3ec1829421f 100644
--- a/pkgs/tools/networking/wget/default.nix
+++ b/pkgs/tools/networking/wget/default.nix
@@ -1,10 +1,12 @@
-{stdenv, fetchurl}: derivation {
-  name = "wget-1.9";
+{stdenv, fetchurl}:
+
+derivation {
+  name = "wget-1.9.1";
   system = stdenv.system;
   builder = ./builder.sh;
   src = fetchurl {
-    url = ftp://ftp.nluug.nl/pub/gnu/wget/wget-1.9.tar.gz;
-    md5 = "18ac093db70801b210152dd69b4ef08a";
+    url = ftp://ftp.nl.net/pub/gnu/wget/wget-1.9.1.tar.gz;
+    md5 = "e6051f1e1487ec0ebfdbda72bedc70ad";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/tools/text/diffutils/builder.sh b/pkgs/tools/text/diffutils/builder.sh
index 408b75eb8037..46f69284ae87 100755
--- a/pkgs/tools/text/diffutils/builder.sh
+++ b/pkgs/tools/text/diffutils/builder.sh
@@ -1,9 +1,3 @@
 #! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfz $src || exit 1
-cd diffutils-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+. $stdenv/setup
+genericBuild
diff --git a/pkgs/tools/text/diffutils/default.nix b/pkgs/tools/text/diffutils/default.nix
index bbf1990f7131..bcb9a4891b6d 100644
--- a/pkgs/tools/text/diffutils/default.nix
+++ b/pkgs/tools/text/diffutils/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "diffutils-2.8.1";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,5 @@
     url = ftp://ftp.nluug.nl/pub/gnu/diffutils/diffutils-2.8.1.tar.gz;
     md5 = "71f9c5ae19b60608f6c7f162da86a428";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/tools/text/gawk/builder.sh b/pkgs/tools/text/gawk/builder.sh
index f1a951f1fd5c..a73f5a6d5b8d 100755
--- a/pkgs/tools/text/gawk/builder.sh
+++ b/pkgs/tools/text/gawk/builder.sh
@@ -1,9 +1,3 @@
-#! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfj $src || exit 1
-cd gawk-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+#! /bin/sh -e
+. $stdenv/setup
+genericBuild
diff --git a/pkgs/tools/text/gawk/default.nix b/pkgs/tools/text/gawk/default.nix
index 85de9289dd06..26340d74f4dc 100644
--- a/pkgs/tools/text/gawk/default.nix
+++ b/pkgs/tools/text/gawk/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "gawk-3.1.3";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,5 @@
     url = ftp://ftp.nluug.nl/pub/gnu/gawk/gawk-3.1.3.tar.bz2;
     md5 = "a116eec17e7ba085febb74c7758823bd";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }
diff --git a/pkgs/tools/text/gnugrep/builder.sh b/pkgs/tools/text/gnugrep/builder.sh
index cb2c91a6b078..a73f5a6d5b8d 100755
--- a/pkgs/tools/text/gnugrep/builder.sh
+++ b/pkgs/tools/text/gnugrep/builder.sh
@@ -1,14 +1,3 @@
 #! /bin/sh -e
-
-set -x
-export NIX_DEBUG=1
-buildinputs="$pcre"
 . $stdenv/setup
-
-echo $NIX_LDFLAGS
-
-tar xvfj $src
-cd grep-*
-./configure --prefix=$out
-make
-make install
+genericBuild
diff --git a/pkgs/tools/text/gnugrep/default.nix b/pkgs/tools/text/gnugrep/default.nix
index b526c81fa776..f8a2563de6e1 100644
--- a/pkgs/tools/text/gnugrep/default.nix
+++ b/pkgs/tools/text/gnugrep/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl, pcre}: derivation {
+{stdenv, fetchurl, pcre}:
+
+derivation {
   name = "gnugrep-2.5.1";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,6 +8,6 @@
     url = ftp://ftp.nluug.nl/pub/gnu/grep/grep-2.5.1.tar.bz2;
     md5 = "ddd99e2d5d4f4611357e31e97f080cf2";
   };
-  stdenv = stdenv;
-  pcre = pcre;
+  buildInputs = [pcre];
+  inherit stdenv;
 }
diff --git a/pkgs/tools/text/gnused/builder.sh b/pkgs/tools/text/gnused/builder.sh
index 126635327925..46f69284ae87 100755
--- a/pkgs/tools/text/gnused/builder.sh
+++ b/pkgs/tools/text/gnused/builder.sh
@@ -1,9 +1,3 @@
 #! /bin/sh
-
-. $stdenv/setup || exit 1
-
-tar xvfz $src || exit 1
-cd sed-* || exit 1
-./configure --prefix=$out || exit 1
-make || exit 1
-make install || exit 1
+. $stdenv/setup
+genericBuild
diff --git a/pkgs/tools/text/gnused/default.nix b/pkgs/tools/text/gnused/default.nix
index a92b3996515d..bcca43fcec70 100644
--- a/pkgs/tools/text/gnused/default.nix
+++ b/pkgs/tools/text/gnused/default.nix
@@ -1,4 +1,6 @@
-{stdenv, fetchurl}: derivation {
+{stdenv, fetchurl}:
+
+derivation {
   name = "gnused-4.0.7";
   system = stdenv.system;
   builder = ./builder.sh;
@@ -6,5 +8,5 @@
     url = ftp://ftp.nluug.nl/pub/gnu/sed/sed-4.0.7.tar.gz;
     md5 = "005738e7f97bd77d95b6907156c8202a";
   };
-  stdenv = stdenv;
+  inherit stdenv;
 }