about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-03-07 23:09:05 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-03-07 23:09:05 +0100
commit234c6b74c67ccd7326a299235de68ff55d20835d (patch)
treefc896b088e34da4a1a5fd6b33ea86e10fc800da6 /pkgs/tools
parent197f6c6c4ce0c284afa437130f096d4ab7f755f1 (diff)
parent262c21ed464a2593b54ec274a3b84083c0795f2d (diff)
Merge remote-tracking branch 'origin/stdenv-updates'
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/X11/xpra/default.nix2
-rw-r--r--pkgs/tools/admin/tigervnc/default.nix31
-rw-r--r--pkgs/tools/archivers/gnutar/default.nix23
-rw-r--r--pkgs/tools/archivers/sharutils/default.nix7
-rw-r--r--pkgs/tools/backup/bup/default.nix2
-rw-r--r--pkgs/tools/bluetooth/kbluetooth/default.nix4
-rw-r--r--pkgs/tools/bluetooth/obexd/default.nix2
-rw-r--r--pkgs/tools/compression/bzip2/builder.sh2
-rw-r--r--pkgs/tools/compression/gzip/default.nix22
-rw-r--r--pkgs/tools/compression/gzip/gets-undeclared.patch26
-rw-r--r--pkgs/tools/compression/xz/default.nix4
-rw-r--r--pkgs/tools/filesystems/fuse-zip/default.nix6
-rw-r--r--pkgs/tools/filesystems/fuse-zip/libzip.patch24
-rw-r--r--pkgs/tools/filesystems/jfsutils/default.nix2
-rw-r--r--pkgs/tools/filesystems/jfsutils/types.patch12
-rw-r--r--pkgs/tools/filesystems/ntfs-3g/default.nix2
-rw-r--r--pkgs/tools/graphics/argyllcms/default.nix2
-rw-r--r--pkgs/tools/graphics/enblend-enfuse/default.nix2
-rw-r--r--pkgs/tools/graphics/pfstools/default.nix2
-rw-r--r--pkgs/tools/graphics/qrencode/default.nix2
-rw-r--r--pkgs/tools/misc/coreutils/8.19.nix70
-rw-r--r--pkgs/tools/misc/coreutils/default.nix30
-rw-r--r--pkgs/tools/misc/file/511.nix17
-rw-r--r--pkgs/tools/misc/file/default.nix19
-rw-r--r--pkgs/tools/misc/findutils/default.nix2
-rw-r--r--pkgs/tools/misc/grub/2.0x.nix6
-rw-r--r--pkgs/tools/misc/hddtemp/byteswap.patch28
-rw-r--r--pkgs/tools/misc/hddtemp/default.nix9
-rw-r--r--pkgs/tools/misc/hddtemp/dontwake.patch20
-rw-r--r--pkgs/tools/misc/hddtemp/execinfo.patch21
-rw-r--r--pkgs/tools/misc/hddtemp/satacmds.patch26
-rw-r--r--pkgs/tools/misc/idutils/default.nix7
-rw-r--r--pkgs/tools/misc/partition-manager/default.nix25
-rw-r--r--pkgs/tools/misc/ttf2pt1/default.nix2
-rw-r--r--pkgs/tools/misc/usbmuxd/default.nix2
-rw-r--r--pkgs/tools/misc/wv2/default.nix21
-rw-r--r--pkgs/tools/misc/wv2/fix-include.patch12
-rw-r--r--pkgs/tools/misc/xburst-tools/default.nix2
-rw-r--r--pkgs/tools/misc/youtube-dl/default.nix2
-rw-r--r--pkgs/tools/networking/curl/default.nix4
-rw-r--r--pkgs/tools/networking/inetutils/default.nix14
-rw-r--r--pkgs/tools/networking/lftp/default.nix16
-rw-r--r--pkgs/tools/networking/lftp/no-gets.patch15
-rw-r--r--pkgs/tools/networking/mailutils/default.nix2
-rw-r--r--pkgs/tools/networking/mailutils/no-gets.patch14
-rw-r--r--pkgs/tools/networking/modemmanager/default.nix2
-rw-r--r--pkgs/tools/networking/netboot/default.nix35
-rw-r--r--pkgs/tools/networking/network-manager-applet/default.nix2
-rw-r--r--pkgs/tools/networking/network-manager/default.nix2
-rw-r--r--pkgs/tools/networking/network-manager/pptp.nix2
-rw-r--r--pkgs/tools/networking/networkmanagement/default.nix2
-rw-r--r--pkgs/tools/networking/ntop/default.nix2
-rw-r--r--pkgs/tools/networking/openssh/default.nix1
-rw-r--r--pkgs/tools/networking/pptp/default.nix2
-rw-r--r--pkgs/tools/networking/surfraw/default.nix2
-rw-r--r--pkgs/tools/networking/wget/default.nix2
-rw-r--r--pkgs/tools/package-management/nix/default.nix6
-rw-r--r--pkgs/tools/package-management/nix/unstable.nix6
-rw-r--r--pkgs/tools/security/ccid/default.nix13
-rw-r--r--pkgs/tools/security/ccrypt/default.nix2
-rw-r--r--pkgs/tools/security/pcsclite/default.nix17
-rw-r--r--pkgs/tools/security/pinentry/default.nix2
-rw-r--r--pkgs/tools/security/polkit-gnome/default.nix2
-rw-r--r--pkgs/tools/security/polkit-kde-agent/default.nix2
-rw-r--r--pkgs/tools/system/acct/default.nix2
-rw-r--r--pkgs/tools/system/acct/no-gets.patch22
-rw-r--r--pkgs/tools/text/diffutils/default.nix22
-rw-r--r--pkgs/tools/text/diffutils/gets-undeclared.patch71
-rw-r--r--pkgs/tools/text/gawk/default.nix18
-rw-r--r--pkgs/tools/text/gnugrep/default.nix14
-rw-r--r--pkgs/tools/text/gnupatch/darwin-fix.patch60
-rw-r--r--pkgs/tools/text/gnupatch/default.nix17
-rw-r--r--pkgs/tools/text/groff/default.nix12
-rw-r--r--pkgs/tools/text/kdiff3/default.nix2
-rw-r--r--pkgs/tools/text/wdiff/default.nix9
75 files changed, 573 insertions, 345 deletions
diff --git a/pkgs/tools/X11/xpra/default.nix b/pkgs/tools/X11/xpra/default.nix
index 3fbb350e0ab01..929332275fc1b 100644
--- a/pkgs/tools/X11/xpra/default.nix
+++ b/pkgs/tools/X11/xpra/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "1s1z6r0r78qvf59ci3vxammjz7lj5m64jyk0bfn7yxd5jl3sy41y";
   };
 
-  buildNativeInputs = [ cython ];
+  nativeBuildInputs = [ cython ];
 
   buildInputs = [
     pkgconfig python pygtk gtk ffmpeg x264 libvpx makeWrapper
diff --git a/pkgs/tools/admin/tigervnc/default.nix b/pkgs/tools/admin/tigervnc/default.nix
index f74463b106355..be42fb4d2a56c 100644
--- a/pkgs/tools/admin/tigervnc/default.nix
+++ b/pkgs/tools/admin/tigervnc/default.nix
@@ -4,7 +4,7 @@
 , fixesproto, damageproto, xcmiscproto, bigreqsproto, randrproto, renderproto
 , fontsproto, videoproto, compositeproto, scrnsaverproto, resourceproto
 , libxkbfile, libXfont, libpciaccess, cmake, libjpeg_turbo, libXft, fltk, libXinerama
-, xineramaproto, libXcursor, fetchsvn, libxcrypt
+, xineramaproto, libXcursor, fetchsvn
 }:
 
 with stdenv.lib;
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   revision = 5005;
   version = "r${toString revision}";
   name = "tigervnc-${version}";
-  
+
   src = fetchsvn {
     # Release url = "mirror://sourceforge/tigervnc/${version}/${name}.tar.gz";
     url = "https://tigervnc.svn.sourceforge.net/svnroot/tigervnc/trunk";
@@ -25,9 +25,9 @@ stdenv.mkDerivation rec {
   inherit fontDirectories;
 
   patchPhase = ''
-    sed -i -e 's,$(includedir)/pixman-1,${if stdenv ? cross then pixman.hostDrv else pixman}/include/pixman-1,' unix/xserver/hw/vnc/Makefile.am
-    sed -i -e '/^$pidFile/a$ENV{XKB_BINDIR}="${if stdenv ? cross then xkbcomp.hostDrv else xkbcomp}/bin";' unix/vncserver 
-    sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -xkbdir ${if stdenv ? cross then xkeyboard_config.hostDrv else xkeyboard_config}/etc/X11/xkb";' unix/vncserver 
+    sed -i -e 's,$(includedir)/pixman-1,${if stdenv ? cross then pixman.crossDrv else pixman}/include/pixman-1,' unix/xserver/hw/vnc/Makefile.am
+    sed -i -e '/^$pidFile/a$ENV{XKB_BINDIR}="${if stdenv ? cross then xkbcomp.crossDrv else xkbcomp}/bin";' unix/vncserver
+    sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -xkbdir ${if stdenv ? cross then xkeyboard_config.crossDrv else xkeyboard_config}/etc/X11/xkb";' unix/vncserver
 
     fontPath=
     for i in $fontDirectories; do
@@ -35,8 +35,8 @@ stdenv.mkDerivation rec {
         addToSearchPathWithCustomDelimiter "," fontPath $(dirname $j)
       done
     done
-    
-    sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -fp '"$fontPath"'";' unix/vncserver 
+
+    sed -i -e '/^\$cmd \.= " -pn";/a$cmd .= " -fp '"$fontPath"'";' unix/vncserver
   '';
 
   # I don't know why I can't use in the script
@@ -69,7 +69,7 @@ stdenv.mkDerivation rec {
   '';
 
   crossAttrs = {
-    buildInputs = (map (x : x.hostDrv) (buildInputs ++ [
+    buildInputs = (map (x : x.crossDrv) (buildInputs ++ [
       fixesproto damageproto xcmiscproto bigreqsproto randrproto renderproto
       fontsproto videoproto compositeproto scrnsaverproto resourceproto
       libxkbfile libXfont libpciaccess xineramaproto
@@ -79,16 +79,16 @@ stdenv.mkDerivation rec {
   buildInputs =
     [ libX11 libXext gettext libICE libXtst libXi libSM libXft
       nasm libgcrypt gnutls pam pixman libjpeg_turbo fltk xineramaproto
-      libXinerama libXcursor libxcrypt
+      libXinerama libXcursor
     ];
-  
-  buildNativeInputs = 
-    [ autoconf automake cvs utilmacros fontutil libtool flex bison 
+
+  nativeBuildInputs =
+    [ autoconf automake cvs utilmacros fontutil libtool flex bison
       cmake
-    ] 
-      ++ xorgserver.buildNativeInputs;
+    ]
+      ++ xorgserver.nativeBuildInputs;
 
-  propagatedBuildNativeInputs = xorgserver.propagatedBuildNativeInputs;
+  propagatedNativeBuildInputs = xorgserver.propagatedNativeBuildInputs;
 
   meta = {
     homepage = http://www.tigervnc.org/;
@@ -97,5 +97,4 @@ stdenv.mkDerivation rec {
     maintainers = with stdenv.lib.maintainers; [viric];
     platforms = with stdenv.lib.platforms; linux;
   };
-
 }
diff --git a/pkgs/tools/archivers/gnutar/default.nix b/pkgs/tools/archivers/gnutar/default.nix
index 4ef973bd56a08..51d5d35fe800e 100644
--- a/pkgs/tools/archivers/gnutar/default.nix
+++ b/pkgs/tools/archivers/gnutar/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl }:
 
-stdenv.mkDerivation (rec {
+stdenv.mkDerivation rec {
   name = "gnutar-1.26";
 
   src = fetchurl {
@@ -8,6 +8,12 @@ stdenv.mkDerivation (rec {
     sha256 = "0hbdkzmchq9ycr2x1pxqdcgdbaxksh8c6ac0jf75jajhcks6jlss";
   };
 
+  patches = [ ./gets-undeclared.patch ];
+
+  # May have some issues with root compilation because the bootstrap tool
+  # cannot be used as a login shell for now.
+  FORCE_UNSAFE_CONFIGURE = stdenv.lib.optionalString (stdenv.system == "armv7l-linux") "1";
+
   meta = {
     homepage = http://www.gnu.org/software/tar/;
     description = "GNU implementation of the `tar' archiver";
@@ -33,18 +39,3 @@ stdenv.mkDerivation (rec {
     platforms = stdenv.lib.platforms.all;
   };
 }
-  # May have some issues with root compilation because the bootstrap tool
-  # cannot be used as a login shell for now.
-// stdenv.lib.optionalAttrs (stdenv.system == "armv7l-linux") {
-  FORCE_UNSAFE_CONFIGURE = 1;
-}
-
-//
-
-{
-  crossAttrs =
-    # XXX: Temporary workaround to allow GNU/Hurd builds with newer libcs.
-    (stdenv.lib.optionalAttrs (stdenv.cross.config == "i586-pc-gnu") {
-      patches = [ ./gets-undeclared.patch ];
-    });
-})
diff --git a/pkgs/tools/archivers/sharutils/default.nix b/pkgs/tools/archivers/sharutils/default.nix
index 2773e112a49bd..7346b8e4e0589 100644
--- a/pkgs/tools/archivers/sharutils/default.nix
+++ b/pkgs/tools/archivers/sharutils/default.nix
@@ -8,6 +8,13 @@ stdenv.mkDerivation rec {
     sha256 = "1mallg1gprimlggdisfzdmh1xi676jsfdlfyvanlcw72ny8fsj3g";
   };
 
+  preConfigure =
+    ''
+       # Fix for building on Glibc 2.16.  Won't be needed once the
+       # gnulib in sharutils is updated.
+       sed -i '/gets is a security hole/d' lib/stdio.in.h
+    '';
+
   # GNU Gettext is needed on non-GNU platforms.
   buildInputs = [ gettext ];
 
diff --git a/pkgs/tools/backup/bup/default.nix b/pkgs/tools/backup/bup/default.nix
index 7ba5175d550bc..7062053703e89 100644
--- a/pkgs/tools/backup/bup/default.nix
+++ b/pkgs/tools/backup/bup/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
     rev = "458e92da32ddd3c18fc1c3e52a76e9f0b48b832f";
   };
 
-  buildNativeInputs = [ pandoc perl makeWrapper ];
+  nativeBuildInputs = [ pandoc perl makeWrapper ];
 
   buildInputs = [ python git ];
 
diff --git a/pkgs/tools/bluetooth/kbluetooth/default.nix b/pkgs/tools/bluetooth/kbluetooth/default.nix
index 047b4f822ae75..81916cb3982f7 100644
--- a/pkgs/tools/bluetooth/kbluetooth/default.nix
+++ b/pkgs/tools/bluetooth/kbluetooth/default.nix
@@ -24,7 +24,7 @@ mkDerivation rec {
   meta = with stdenv.lib; {
     description = "Bluetooth manager for KDE";
     license = "GPLv2";
-    inherit (kdelibs.meta) platforms;
+    #inherit (kdelibs.meta) platforms; # doesn't build and seems to be dead
     maintainers = [ maintainers.phreedom ];
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/tools/bluetooth/obexd/default.nix b/pkgs/tools/bluetooth/obexd/default.nix
index 1cf3918c21fcb..47db0877dd20c 100644
--- a/pkgs/tools/bluetooth/obexd/default.nix
+++ b/pkgs/tools/bluetooth/obexd/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ glib dbus.libs openobex bluez libical ];
 
-  buildNativeInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig ];
 
   meta = {
     homepage = http://www.bluez.org/;
diff --git a/pkgs/tools/compression/bzip2/builder.sh b/pkgs/tools/compression/bzip2/builder.sh
index 4610bdd40850e..a598dfcf808c1 100644
--- a/pkgs/tools/compression/bzip2/builder.sh
+++ b/pkgs/tools/compression/bzip2/builder.sh
@@ -10,7 +10,7 @@ if test -n "$sharedLibrary"; then
     preInstall() {
         mkdir -p $out/lib
         mv libbz2.so* $out/lib
-        ln -s libbz2.so.1.0 $out/lib/libbz2.so
+        (cd $out/lib && ln -s libbz2.so.1.0.? libbz2.so && ln -s libbz2.so.1.0.? libbz2.so.1);
     }
     
 fi
diff --git a/pkgs/tools/compression/gzip/default.nix b/pkgs/tools/compression/gzip/default.nix
index e1d6d75da51a0..d15b26f48b656 100644
--- a/pkgs/tools/compression/gzip/default.nix
+++ b/pkgs/tools/compression/gzip/default.nix
@@ -1,15 +1,13 @@
-{stdenv, fetchurl}:
+{ stdenv, fetchurl }:
 
-stdenv.mkDerivation (rec {
-  name = "gzip-1.4";
+stdenv.mkDerivation rec {
+  name = "gzip-1.5";
 
   src = fetchurl {
-    url = "mirror://gnu/gzip/${name}.tar.gz";
-    sha256 = "1vhiyzls60fws48scw48wvwn8mpv1f4yhcsnafys239qvb9wyrni";
+    url = "mirror://gnu/gzip/${name}.tar.xz";
+    sha256 = "0wx1nqk709kx75cwp2axachnbxryp4gyl06qxn5nl95184w0mhls";
   };
 
-  doCheck = true;
-
   meta = {
     homepage = http://www.gnu.org/software/gzip/;
     description = "Gzip, the GNU zip compression program";
@@ -31,13 +29,3 @@ stdenv.mkDerivation (rec {
     maintainers = [ stdenv.lib.maintainers.ludo ];
   };
 }
-
-//
-
-{
-  crossAttrs =
-    # XXX: Temporary workaround to allow GNU/Hurd builds with newer libcs.
-    (stdenv.lib.optionalAttrs (stdenv.cross.config == "i586-pc-gnu") {
-      patches = [ ./gets-undeclared.patch ];
-    });
-})
diff --git a/pkgs/tools/compression/gzip/gets-undeclared.patch b/pkgs/tools/compression/gzip/gets-undeclared.patch
deleted file mode 100644
index a09f59b122a2e..0000000000000
--- a/pkgs/tools/compression/gzip/gets-undeclared.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-This patch is needed to allow builds with newer versions of
-the GNU libc (2.16+).
-
-This is a backport of this patch:
-
-commit 66712c23388e93e5c518ebc8515140fa0c807348
-Author: Eric Blake <eblake@redhat.com>
-Date:   Thu Mar 29 13:30:41 2012 -0600
-
-    stdio: don't assume gets any more
-    
---- gzip/lib/stdio.in.h	2012-07-02 14:28:45.000000000 +0200
-+++ gzip/lib/stdio.in.h	2012-07-02 14:28:50.000000000 +0200
-@@ -160,12 +160,6 @@ _GL_WARN_ON_USE (fflush, "fflush is not
-                  "use gnulib module fflush for portable POSIX compliance");
- #endif
- 
--/* It is very rare that the developer ever has full control of stdin,
--   so any use of gets warrants an unconditional warning.  Assume it is
--   always declared, since it is required by C89.  */
--#undef gets
--_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
--
- #if @GNULIB_FOPEN@
- # if @REPLACE_FOPEN@
- #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
diff --git a/pkgs/tools/compression/xz/default.nix b/pkgs/tools/compression/xz/default.nix
index 78a8ed95a4e91..6b74ba41ecab5 100644
--- a/pkgs/tools/compression/xz/default.nix
+++ b/pkgs/tools/compression/xz/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "xz-5.0.3";
+  name = "xz-5.0.4";
 
   src = fetchurl {
     url = "http://tukaani.org/xz/${name}.tar.bz2";
-    sha256 = "1sgaq4gdh8llz3gnlgvd65x610fwc8h4m32skhqn5npwgghvj4as";
+    sha256 = "14nf55b47335aakswqk0kqv1qsh4269rnb757dmkkbd1sdhb1naw";
   };
 
   doCheck = true;
diff --git a/pkgs/tools/filesystems/fuse-zip/default.nix b/pkgs/tools/filesystems/fuse-zip/default.nix
index 346b11015f46f..a5ac74fe47a50 100644
--- a/pkgs/tools/filesystems/fuse-zip/default.nix
+++ b/pkgs/tools/filesystems/fuse-zip/default.nix
@@ -2,16 +2,18 @@
 
 stdenv.mkDerivation rec {
   name = "fuse-zip-0.2.13";
-  
+
   src = fetchurl {
     url = "http://fuse-zip.googlecode.com/files/${name}.tar.gz";
     sha1 = "9cfa00e38a59d4e06fd47bfaca75ad5e299ecc6b";
   };
 
+  patches = [ ./libzip.patch ]; # problems with new libzip; from Gentoo
+
   buildInputs = [ pkgconfig fuse libzip zlib ];
 
   makeFlags = "INSTALLPREFIX=$(out)";
-  
+
   meta = {
     homepage = http://code.google.com/p/fuse-zip/;
     description = "A FUSE-based filesystem that allows read and write access to ZIP files";
diff --git a/pkgs/tools/filesystems/fuse-zip/libzip.patch b/pkgs/tools/filesystems/fuse-zip/libzip.patch
new file mode 100644
index 0000000000000..f2348e5f1baba
--- /dev/null
+++ b/pkgs/tools/filesystems/fuse-zip/libzip.patch
@@ -0,0 +1,24 @@
+diff -ru fuse-zip-0.2.13/lib/bigBuffer.cpp fuse-zip-0.2.13.new//lib/bigBuffer.cpp
+--- fuse-zip-0.2.13/lib/bigBuffer.cpp	2010-12-06 12:34:32.000000000 -0500
++++ fuse-zip-0.2.13.new//lib/bigBuffer.cpp	2011-09-28 21:40:01.294946957 -0400
+@@ -236,7 +236,7 @@
+     len = offset;
+ }
+ 
+-ssize_t BigBuffer::zipUserFunctionCallback(void *state, void *data, size_t len, enum zip_source_cmd cmd) {
++zip_int64_t BigBuffer::zipUserFunctionCallback(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd) {
+     CallBackStruct *b = (CallBackStruct*)state;
+     switch (cmd) {
+         case ZIP_SOURCE_OPEN: {
+diff -ru fuse-zip-0.2.13/lib/bigBuffer.h fuse-zip-0.2.13.new//lib/bigBuffer.h
+--- fuse-zip-0.2.13/lib/bigBuffer.h	2010-12-06 12:34:32.000000000 -0500
++++ fuse-zip-0.2.13.new//lib/bigBuffer.h	2011-09-28 21:40:23.203719133 -0400
+@@ -52,7 +52,7 @@
+      * never called because read() always successfull.
+      * See zip_source_function(3) for details.
+      */
+-    static ssize_t zipUserFunctionCallback(void *state, void *data, size_t len, enum zip_source_cmd cmd);
++    static zip_int64_t zipUserFunctionCallback(void *state, void *data, zip_uint64_t len, enum zip_source_cmd cmd);
+ 
+     /**
+      * Return number of chunks needed to keep 'offset' bytes.
diff --git a/pkgs/tools/filesystems/jfsutils/default.nix b/pkgs/tools/filesystems/jfsutils/default.nix
index dc07734b96036..9712721021ea6 100644
--- a/pkgs/tools/filesystems/jfsutils/default.nix
+++ b/pkgs/tools/filesystems/jfsutils/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha1 = "291e8bd9d615cf3d27e4000117c81a3602484a50";
   };
 
+  patches = [ ./types.patch ];
+
   buildInputs = [ libuuid ];
 
   meta = {
diff --git a/pkgs/tools/filesystems/jfsutils/types.patch b/pkgs/tools/filesystems/jfsutils/types.patch
new file mode 100644
index 0000000000000..a682f2695f9e0
--- /dev/null
+++ b/pkgs/tools/filesystems/jfsutils/types.patch
@@ -0,0 +1,12 @@
+diff -ru -x '*~' jfsutils-1.1.15-orig/libfs/devices.h jfsutils-1.1.15/libfs/devices.h
+--- jfsutils-1.1.15-orig/libfs/devices.h	2005-11-22 21:43:55.000000000 +0100
++++ jfsutils-1.1.15/libfs/devices.h	2013-01-28 13:58:56.888630278 +0100
+@@ -18,6 +18,8 @@
+ #ifndef H_DEVICES
+ #define H_DEVICES
+ 
++#include <inttypes.h>
++
+ #define GET	0
+ #define PUT	1
+ #define VRFY	2
diff --git a/pkgs/tools/filesystems/ntfs-3g/default.nix b/pkgs/tools/filesystems/ntfs-3g/default.nix
index cedb8df39d14a..a306a424ee1ec 100644
--- a/pkgs/tools/filesystems/ntfs-3g/default.nix
+++ b/pkgs/tools/filesystems/ntfs-3g/default.nix
@@ -7,7 +7,7 @@ stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   buildInputs = [libuuid] ++ stdenv.lib.optionals crypto [gnutls libgcrypt];
-  buildNativeInputs = stdenv.lib.optional crypto pkgconfig;
+  nativeBuildInputs = stdenv.lib.optional crypto pkgconfig;
 
   src = fetchurl {
     url = "http://tuxera.com/opensource/${name}.tgz";
diff --git a/pkgs/tools/graphics/argyllcms/default.nix b/pkgs/tools/graphics/argyllcms/default.nix
index 08cd012e0797d..934a27ef25b76 100644
--- a/pkgs/tools/graphics/argyllcms/default.nix
+++ b/pkgs/tools/graphics/argyllcms/default.nix
@@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
       -ljpeg -ltiff ;
   '';
 
-  buildNativeInputs = [ jam unzip ];
+  nativeBuildInputs = [ jam unzip ];
 
   preConfigure = ''
     cp ${jamTop} Jamtop
diff --git a/pkgs/tools/graphics/enblend-enfuse/default.nix b/pkgs/tools/graphics/enblend-enfuse/default.nix
index f1759d7a7820c..b77d63d510df8 100644
--- a/pkgs/tools/graphics/enblend-enfuse/default.nix
+++ b/pkgs/tools/graphics/enblend-enfuse/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libtiff libpng lcms libxmi boost mesa freeglut glew ];
 
-  buildNativeInputs = [ perl pkgconfig ];
+  nativeBuildInputs = [ perl pkgconfig ];
 
   patches =
     let
diff --git a/pkgs/tools/graphics/pfstools/default.nix b/pkgs/tools/graphics/pfstools/default.nix
index 0c829eab13091..9b0a83725eaac 100644
--- a/pkgs/tools/graphics/pfstools/default.nix
+++ b/pkgs/tools/graphics/pfstools/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ libtiff openexr imagemagick libjpeg qt4 mesa freeglut
     bzip2 libX11 libpng expat ];
 
-  buildNativeInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig ];
 
   meta = {
     homepage = http://pfstools.sourceforge.net/;
diff --git a/pkgs/tools/graphics/qrencode/default.nix b/pkgs/tools/graphics/qrencode/default.nix
index 866b121f76baa..3b83a18fd36ed 100644
--- a/pkgs/tools/graphics/qrencode/default.nix
+++ b/pkgs/tools/graphics/qrencode/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ libpng ];
-  buildNativeInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig ];
 
   meta = {
     homepage = http://fukuchi.org/works/qrencode/;
diff --git a/pkgs/tools/misc/coreutils/8.19.nix b/pkgs/tools/misc/coreutils/8.19.nix
new file mode 100644
index 0000000000000..f3bee55196003
--- /dev/null
+++ b/pkgs/tools/misc/coreutils/8.19.nix
@@ -0,0 +1,70 @@
+{ stdenv, fetchurl, perl, gmp ? null
+, aclSupport ? false, acl ? null
+, selinuxSupport? false, libselinux ? null, libsepol ? null
+}:
+
+assert aclSupport -> acl != null;
+assert selinuxSupport -> libselinux != null && libsepol != null;
+
+stdenv.mkDerivation rec {
+  name = "coreutils-8.19";
+
+  src = fetchurl {
+    url = "mirror://gnu/coreutils/${name}.tar.xz";
+    sha256 = "1rx9x3fp848w4nny7irdkcpkan9fcx24d99v5dkwgkyq7wc76f5d";
+  };
+
+  nativeBuildInputs = [ perl ];
+  buildInputs = [ gmp ]
+    ++ stdenv.lib.optional aclSupport acl
+    ++ stdenv.lib.optional selinuxSupport libselinux
+    ++ stdenv.lib.optional selinuxSupport libsepol;
+
+  crossAttrs = ({
+    buildInputs = [ gmp ]
+      ++ stdenv.lib.optional aclSupport acl.crossDrv
+      ++ stdenv.lib.optional selinuxSupport libselinux.crossDrv
+      ++ stdenv.lib.optional selinuxSupport libsepol.crossDrv
+      ++ stdenv.lib.optional (stdenv.gccCross.libc ? libiconv)
+        stdenv.gccCross.libc.libiconv.crossDrv;
+
+    # Needed for fstatfs()
+    # I don't know why it is not properly detected cross building with glibc.
+    configureFlags = [ "fu_cv_sys_stat_statfs2_bsize=yes" ];
+    doCheck = false;
+  }
+
+  //
+
+  # XXX: Temporary workaround to allow GNU/Hurd builds with newer libcs.
+  (stdenv.lib.optionalAttrs (stdenv.cross.config == "i586-pc-gnu") {
+    patches = [ ./gets-undeclared.patch ];
+  }));
+
+  # The tests are known broken on Cygwin
+  # (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19025),
+  # Darwin (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19351),
+  # and {Open,Free}BSD.
+  doCheck = stdenv ? glibc;
+
+  enableParallelBuilding = true;
+
+  NIX_LDFLAGS = stdenv.lib.optionalString selinuxSupport "-lsepol";
+
+  meta = {
+    homepage = http://www.gnu.org/software/coreutils/;
+    description = "The basic file, shell and text manipulation utilities of the GNU operating system";
+
+    longDescription = ''
+      The GNU Core Utilities are the basic file, shell and text
+      manipulation utilities of the GNU operating system.  These are
+      the core utilities which are expected to exist on every
+      operating system.
+    '';
+
+    license = "GPLv3+";
+
+    maintainers = [ stdenv.lib.maintainers.ludo ];
+  };
+}
+
diff --git a/pkgs/tools/misc/coreutils/default.nix b/pkgs/tools/misc/coreutils/default.nix
index 9d9ea52f3f584..065d237a07318 100644
--- a/pkgs/tools/misc/coreutils/default.nix
+++ b/pkgs/tools/misc/coreutils/default.nix
@@ -4,48 +4,41 @@
 }:
 
 assert aclSupport -> acl != null;
-assert selinuxSupport -> ( (libselinux != null) && (libsepol != null) );
+assert selinuxSupport -> libselinux != null && libsepol != null;
 
 stdenv.mkDerivation rec {
-  name = "coreutils-8.15";
+  name = "coreutils-8.21";
 
   src = fetchurl {
     url = "mirror://gnu/coreutils/${name}.tar.xz";
-    sha256 = "176lgw810xw84c6fz5xwhydxggkndmzggl0pxqzldbjf85vv6zl3";
+    sha256 = "064f512185iysqqcvhnhaf3bfmzrvcgs7n405qsyp99zmfyl9amd";
   };
 
-  buildNativeInputs = [ perl ];
+  nativeBuildInputs = [ perl ];
   buildInputs = [ gmp ]
     ++ stdenv.lib.optional aclSupport acl
     ++ stdenv.lib.optional selinuxSupport libselinux
     ++ stdenv.lib.optional selinuxSupport libsepol;
 
-  crossAttrs = ({
+  crossAttrs = {
     buildInputs = [ gmp ]
-      ++ stdenv.lib.optional aclSupport acl.hostDrv
-      ++ stdenv.lib.optional selinuxSupport libselinux.hostDrv
-      ++ stdenv.lib.optional selinuxSupport libsepol.hostDrv
+      ++ stdenv.lib.optional aclSupport acl.crossDrv
+      ++ stdenv.lib.optional selinuxSupport libselinux.crossDrv
+      ++ stdenv.lib.optional selinuxSupport libsepol.crossDrv
       ++ stdenv.lib.optional (stdenv.gccCross.libc ? libiconv)
-        stdenv.gccCross.libc.libiconv.hostDrv;
+        stdenv.gccCross.libc.libiconv.crossDrv;
 
     # Needed for fstatfs()
     # I don't know why it is not properly detected cross building with glibc.
     configureFlags = [ "fu_cv_sys_stat_statfs2_bsize=yes" ];
     doCheck = false;
-  }
-
-  //
-
-  # XXX: Temporary workaround to allow GNU/Hurd builds with newer libcs.
-  (stdenv.lib.optionalAttrs (stdenv.cross.config == "i586-pc-gnu") {
-    patches = [ ./gets-undeclared.patch ];
-  }));
+  };
 
   # The tests are known broken on Cygwin
   # (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19025),
   # Darwin (http://thread.gmane.org/gmane.comp.gnu.core-utils.bugs/19351),
   # and {Open,Free}BSD.
-  doCheck = (stdenv ? glibc);
+  doCheck = stdenv ? glibc;
 
   enableParallelBuilding = true;
 
@@ -67,4 +60,3 @@ stdenv.mkDerivation rec {
     maintainers = [ stdenv.lib.maintainers.ludo ];
   };
 }
-
diff --git a/pkgs/tools/misc/file/511.nix b/pkgs/tools/misc/file/511.nix
deleted file mode 100644
index 4e62462b8b35d..0000000000000
--- a/pkgs/tools/misc/file/511.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{stdenv, fetchurl, zlib}:
- 
-stdenv.mkDerivation rec {
-  name = "file-5.11";
-
-  buildInputs = [ zlib ];
-
-  src = fetchurl {
-    url = "ftp://ftp.astron.com/pub/file/${name}.tar.gz";
-    sha256 = "c70ae29a28c0585f541d5916fc3248c3e91baa481f63d7ccec53d1534cbcc9b7";
-  };
-
-  meta = {
-    description = "A program that shows the type of files";
-    homepage = "http://darwinsys.com/file";
-  };
-}
diff --git a/pkgs/tools/misc/file/default.nix b/pkgs/tools/misc/file/default.nix
index 38fb0b78cb13c..8b141fea82629 100644
--- a/pkgs/tools/misc/file/default.nix
+++ b/pkgs/tools/misc/file/default.nix
@@ -1,18 +1,17 @@
-{stdenv, fetchurl}:
- 
-stdenv.mkDerivation {
-  name = "file-5.04";
+{ stdenv, fetchurl, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "file-5.12";
+
+  buildInputs = [ zlib ];
 
   src = fetchurl {
-    urls = [
-      ftp://ftp.astron.com/pub/file/file-5.04.tar.gz
-      http://pkgs.fedoraproject.org/repo/pkgs/file/file-5.04.tar.gz/accade81ff1cc774904b47c72c8aeea0/file-5.04.tar.gz
-    ];
-    sha256 = "0316lj3jxmp2g8azv0iykmmwjsnjanq93bklccwb6k77jiwnx7jc";
+    url = "ftp://ftp.astron.com/pub/file/${name}.tar.gz";
+    sha256 = "08ix4xrvan0k80n0l5lqfmc4azjv5lyhvhwdxny4r09j5smhv78r";
   };
 
   meta = {
+    homepage = "http://darwinsys.com/file";
     description = "A program that shows the type of files";
-    homepage = ftp://ftp.astron.com/pub/file;
   };
 }
diff --git a/pkgs/tools/misc/findutils/default.nix b/pkgs/tools/misc/findutils/default.nix
index eeb6b852e61fa..88cb2c313c0aa 100644
--- a/pkgs/tools/misc/findutils/default.nix
+++ b/pkgs/tools/misc/findutils/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3";
   };
 
-  buildNativeInputs = [coreutils];
+  nativeBuildInputs = [coreutils];
 
   patches = [ ./findutils-path.patch ./change_echo_path.patch ];
 
diff --git a/pkgs/tools/misc/grub/2.0x.nix b/pkgs/tools/misc/grub/2.0x.nix
index d37ce9f5aac44..d824d76a86493 100644
--- a/pkgs/tools/misc/grub/2.0x.nix
+++ b/pkgs/tools/misc/grub/2.0x.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     sha256 = "0n64hpmsccvicagvr0c6v0kgp2yw0kgnd3jvsyd26cnwgs7c6kkq";
   };
 
-  buildNativeInputs = [ flex bison ];
+  nativeBuildInputs = [ flex bison ];
   buildInputs = [ ncurses libusb freetype gettext devicemapper ]
     ++ stdenv.lib.optional doCheck qemu;
 
@@ -43,6 +43,10 @@ stdenv.mkDerivation rec {
        # See <http://www.mail-archive.com/qemu-devel@nongnu.org/msg22775.html>.
        sed -i "tests/util/grub-shell.in" \
            -e's/qemu-system-i386/qemu-system-x86_64 -nodefaults/g'
+
+       # Fix for building on Glibc 2.16.  Won't be needed once the
+       # gnulib in grub is updated.
+       sed -i '/gets is a security hole/d' grub-core/gnulib/stdio.in.h
     '';
 
   prePatch =
diff --git a/pkgs/tools/misc/hddtemp/byteswap.patch b/pkgs/tools/misc/hddtemp/byteswap.patch
new file mode 100644
index 0000000000000..7b0dddc2ae47e
--- /dev/null
+++ b/pkgs/tools/misc/hddtemp/byteswap.patch
@@ -0,0 +1,28 @@
+diff -Nuar --exclude '*~' hddtemp-0.3-beta15.orig/src/sata.c hddtemp-0.3-beta15/src/sata.c
+--- hddtemp-0.3-beta15.orig/src/sata.c	2006-05-14 02:09:55.579437498 -0700
++++ hddtemp-0.3-beta15/src/sata.c	2006-05-14 02:06:08.495948437 -0700
+@@ -88,7 +88,9 @@
+     return strdup(_("unknown"));
+   else
+   {
++		//fprintf(stderr,"sata_model1=%s\n",identify + 54);
+     sata_fixstring(identify + 54, 24);
++		//fprintf(stderr,"sata_model2=%s\n",identify + 54);
+     return strdup(identify + 54);
+   }
+ }
+diff -Nuar --exclude '*~' hddtemp-0.3-beta15.orig/src/satacmds.c hddtemp-0.3-beta15/src/satacmds.c
+--- hddtemp-0.3-beta15.orig/src/satacmds.c	2006-05-14 02:09:40.983470339 -0700
++++ hddtemp-0.3-beta15/src/satacmds.c	2006-05-14 02:09:02.319557333 -0700
+@@ -98,7 +98,10 @@
+   /* convert from big-endian to host byte order */
+   for (p = end ; p != s;) {
+     unsigned short *pp = (unsigned short *) (p -= 2);
+-    *pp = ntohs(*pp);
++		char tmp = p[0];
++		p[0] = p[1];
++		p[1] = tmp;
++    //*pp = ntohs(*pp);
+   }
+ 
+   /* strip leading blanks */
diff --git a/pkgs/tools/misc/hddtemp/default.nix b/pkgs/tools/misc/hddtemp/default.nix
index 7db9324c2813a..df75e7b338965 100644
--- a/pkgs/tools/misc/hddtemp/default.nix
+++ b/pkgs/tools/misc/hddtemp/default.nix
@@ -7,20 +7,23 @@ stdenv.mkDerivation {
     url = http://download.savannah.nongnu.org/releases/hddtemp/hddtemp.db;
     sha256 = "1fr6qgns6qv7cr40lic5yqwkkc7yjmmgx8j0z6d93csg3smzhhya";
   };
-  
+
   src = fetchurl {
     url = http://download.savannah.nongnu.org/releases/hddtemp/hddtemp-0.3-beta15.tar.bz2;
     sha256 = "0nzgg4nl8zm9023wp4dg007z6x3ir60rwbcapr9ks2al81c431b1";
   };
 
+  # from Gentoo
+  patches = [ ./byteswap.patch ./dontwake.patch ./execinfo.patch ./satacmds.patch ];
+
   configurePhase =
     ''
       mkdir -p $out/nix-support
       cp $db $out/nix-support/hddtemp.db
       ./configure --prefix=$out --with-db-path=$out/nix-support/hddtemp.db
-    ''; 
+    '';
 
-  meta = { 
+  meta = {
     description = "Tool for displaying hard disk temperature";
     homepage = https://savannah.nongnu.org/projects/hddtemp/;
     license = "GPL2";
diff --git a/pkgs/tools/misc/hddtemp/dontwake.patch b/pkgs/tools/misc/hddtemp/dontwake.patch
new file mode 100644
index 0000000000000..969da7a70e40d
--- /dev/null
+++ b/pkgs/tools/misc/hddtemp/dontwake.patch
@@ -0,0 +1,20 @@
+--- hddtemp-0.3-beta15/src/sata.c	2012-07-01 16:35:01.681708074 +0200
++++ hddtemp-0.3-beta15/src/sata.c	2012-07-01 16:33:58.172109699 +0200
+@@ -125,6 +125,17 @@
+     dsk->fd = -1;
+     return GETTEMP_NOSENSOR;
+   }
++
++  switch(ata_get_powermode(dsk->fd)) {
++  case PWM_STANDBY:
++  case PWM_SLEEPING:
++    if (!wakeup)
++      return GETTEMP_DRIVE_SLEEP;
++  case PWM_UNKNOWN:
++  case PWM_ACTIVE: /* active or idle */
++  default:
++    break;
++  }
+   
+   /* get SMART values */
+   if(sata_enable_smart(dsk->fd) != 0) {
diff --git a/pkgs/tools/misc/hddtemp/execinfo.patch b/pkgs/tools/misc/hddtemp/execinfo.patch
new file mode 100644
index 0000000000000..1e7239535d4d1
--- /dev/null
+++ b/pkgs/tools/misc/hddtemp/execinfo.patch
@@ -0,0 +1,21 @@
+--- hddtemp-0.3-beta15/configure.in~	2005-10-17 19:14:19 +0000
++++ hddtemp-0.3-beta15/configure.in	2006-12-11 18:23:22 +0000
+@@ -18,6 +18,7 @@
+ AC_HEADER_STDC
+ AC_CHECK_HEADERS(fcntl.h)
+ AC_CHECK_HEADERS(netinet/in.h)
++AC_CHECK_HEADERS(execinfo.h)
+ AC_CHECK_TYPE(in_addr_t, ,[AC_DEFINE_UNQUOTED([in_addr_t], [uint32_t], [Define to 'uint32_t' if <netinet/in.h> does not define.])], [#include <netinet/in.h>])
+ 
+ # Checks for typedefs, structures, and compiler characteristics.
+--- hddtemp-0.3-beta15/src/backtrace.c-orig	2006-12-11 18:20:41 +0000
++++ hddtemp-0.3-beta15/src/backtrace.c	2006-12-11 18:23:28 +0000
+@@ -18,7 +18,7 @@
+ 
+ #include <features.h>
+ 
+-#if defined(__i386__) && defined(__GLIBC__)
++#ifdef HAS_EXECINFO_H
+ 
+ #include <execinfo.h>
+ 
diff --git a/pkgs/tools/misc/hddtemp/satacmds.patch b/pkgs/tools/misc/hddtemp/satacmds.patch
new file mode 100644
index 0000000000000..d67e0681f33f6
--- /dev/null
+++ b/pkgs/tools/misc/hddtemp/satacmds.patch
@@ -0,0 +1,26 @@
+diff -Naurp hddtemp-0.3-beta15-orig/src/satacmds.c hddtemp-0.3-beta15/src/satacmds.c
+--- hddtemp-0.3-beta15-orig/src/satacmds.c	2007-02-10 14:25:15.000000000 +0100
++++ hddtemp-0.3-beta15/src/satacmds.c	2007-02-10 14:26:53.000000000 +0100
+@@ -54,7 +54,6 @@ int sata_pass_thru(int device, unsigned 
+   unsigned char cdb[16];
+   unsigned char sense[32];
+   int dxfer_direction;
+-  int ret;
+   
+   memset(cdb, 0, sizeof(cdb));
+   cdb[0] = ATA_16;
+@@ -78,13 +77,7 @@ int sata_pass_thru(int device, unsigned 
+     cdb[6] = cmd[1];
+   cdb[14] = cmd[0];
+ 
+-  ret = scsi_SG_IO(device, cdb, sizeof(cdb), buffer, cmd[3] * 512, sense, sizeof(sense), dxfer_direction);
+- 
+-  /* Verify SATA magics */
+-  if (sense[0] != 0x72 || sense[7] != 0x0e || sense[9] != 0x0e || sense[10] != 0x00)
+-    return 1;		  
+-  else 
+-    return ret;
++  return scsi_SG_IO(device, cdb, sizeof(cdb), buffer, cmd[3] * 512, sense, sizeof(sense), dxfer_direction);
+ }
+ 
+ void sata_fixstring(unsigned char *s, int bytecount)
diff --git a/pkgs/tools/misc/idutils/default.nix b/pkgs/tools/misc/idutils/default.nix
index 4b81d48b02786..b76b9a187151f 100644
--- a/pkgs/tools/misc/idutils/default.nix
+++ b/pkgs/tools/misc/idutils/default.nix
@@ -8,6 +8,13 @@ stdenv.mkDerivation rec {
     sha256 = "1hmai3422iaqnp34kkzxdnywl7n7pvlxp11vrw66ybxn9wxg90c1";
   };
 
+  preConfigure =
+    ''
+       # Fix for building on Glibc 2.16.  Won't be needed once the
+       # gnulib in idutils is updated.
+       sed -i '/gets is a security hole/d' lib/stdio.in.h
+    '';
+
   buildInputs = stdenv.lib.optional stdenv.isLinux emacs;
 
   doCheck = true;
diff --git a/pkgs/tools/misc/partition-manager/default.nix b/pkgs/tools/misc/partition-manager/default.nix
index 46be78965fbd7..19a0df2616958 100644
--- a/pkgs/tools/misc/partition-manager/default.nix
+++ b/pkgs/tools/misc/partition-manager/default.nix
@@ -1,16 +1,21 @@
-{ stdenv, fetchurl, cmake, gettext, parted, libuuid, qt4, kdelibs, kde_baseapps,
-  automoc4, phonon, perl }:
+{ stdenv, fetchurl, pkgconfig, cmake, gettext, automoc4, perl
+, parted, libuuid, qt4, kdelibs, kde_baseapps, phonon, libatasmart
+}:
 
-stdenv.mkDerivation {
-  name = "partitionmanager-1.0.0";
+stdenv.mkDerivation rec {
+  name = "partitionmanager-1.0.3_p20120804";
 
   src = fetchurl {
-    url = http://www.kde-apps.org/CONTENT/content-files/89595-partitionmanager-1.0.0.tar.bz2;
-    sha256 = "03ibn4vns7pa0ygkp2jh6zcdy106as5cc7p6rv1f5c15wxx0zsk1";
+    #url = "mirror://sourceforge/partitionman/${name}.tar.bz2";
+    # the upstream version is old and doesn't build
+    url = "http://dev.gentoo.org/~kensington/distfiles/${name}.tar.bz2";
+    sha256 = "1j6zpgj8xs98alzxvcibwch9yj8jsx0s7y864gbdx280jmj8c1np";
   };
 
-  buildInputs =
-    [ cmake gettext parted libuuid qt4 kdelibs kde_baseapps automoc4 perl phonon ];
+  buildInputs = [
+    pkgconfig cmake gettext automoc4 perl
+    parted libuuid qt4 kdelibs kde_baseapps phonon libatasmart
+  ];
 
   preConfigure = ''
     export VERBOSE=1
@@ -19,13 +24,13 @@ stdenv.mkDerivation {
 
   postInstall = ''
     set -x
-    rpath=`patchelf --print-rpath $out/bin/partitionmanager-bin`:${qt4}/lib 
+    rpath=`patchelf --print-rpath $out/bin/partitionmanager-bin`:${qt4}/lib
     for p in $out/bin/partitionmanager-bin; do
       patchelf --set-rpath $rpath $p
     done
   '';
 
-  meta = { 
+  meta = {
     description = "Utility program to help you manage the disk devices";
     homepage = http://www.kde-apps.org/content/show.php/KDE+Partition+Manager?content=89595; # ?
     license = "GPL";
diff --git a/pkgs/tools/misc/ttf2pt1/default.nix b/pkgs/tools/misc/ttf2pt1/default.nix
index 379db7d533f06..659b04a623861 100644
--- a/pkgs/tools/misc/ttf2pt1/default.nix
+++ b/pkgs/tools/misc/ttf2pt1/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
   '';
 
   buildInputs = [ freetype ];
-  buildNativeInputs = [ perl ];
+  nativeBuildInputs = [ perl ];
   
   patches = ./gentoo-makefile.patch; # also contains the freetype patch
 
diff --git a/pkgs/tools/misc/usbmuxd/default.nix b/pkgs/tools/misc/usbmuxd/default.nix
index c4b4124935586..b95dfde985005 100644
--- a/pkgs/tools/misc/usbmuxd/default.nix
+++ b/pkgs/tools/misc/usbmuxd/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "09swwr6x46qxmwylrylnyqh4pznr0swla9gijggwxxw8dw82r840";
   };
 
-  buildNativeInputs = [ cmake pkgconfig ];
+  nativeBuildInputs = [ cmake pkgconfig ];
   propagatedBuildInputs = [ libusb1 libplist ];
 
   patchPhase =
diff --git a/pkgs/tools/misc/wv2/default.nix b/pkgs/tools/misc/wv2/default.nix
index 7a30d011be265..a3938c1af4c46 100644
--- a/pkgs/tools/misc/wv2/default.nix
+++ b/pkgs/tools/misc/wv2/default.nix
@@ -1,10 +1,19 @@
-{stdenv, fetchurl, pkgconfig, libgsf, glib, libxml2}:
+{ stdenv, fetchurl, pkgconfig, cmake, libgsf, glib, libxml2 }:
 
-stdenv.mkDerivation {
-  name = "wv2-0.3.1";
+stdenv.mkDerivation rec {
+  name = "wv2-0.4.2";
   src = fetchurl {
-    url = mirror://sourceforge/wvware/wv2-0.3.1.tar.bz2;
-    sha256 = "896ff8ec59e280e8cb1ef9a953b364845dd65de1cdf8e4ed8a7e045a3f81c546";
+    url = "mirror://sourceforge/wvware/${name}.tar.bz2";
+    sha256 = "1p1qxr8z5bsiq8pvlina3c8c1vjcb5d96bs3zz4jj3nb20wnsawz";
+  };
+
+  patches = [ ./fix-include.patch ];
+
+  buildInputs = [ pkgconfig cmake libgsf glib libxml2 ];
+
+  meta = {
+    description = "Excellent MS Word filter lib, used in most Office suites";
+    license = "LGPLv2";
+    homepage = http://wvware.sourceforge.net;
   };
-  buildInputs = [ pkgconfig libgsf glib libxml2 ];
 }
diff --git a/pkgs/tools/misc/wv2/fix-include.patch b/pkgs/tools/misc/wv2/fix-include.patch
new file mode 100644
index 0000000000000..df34d24af9424
--- /dev/null
+++ b/pkgs/tools/misc/wv2/fix-include.patch
@@ -0,0 +1,12 @@
+From: http://sourceforge.net/tracker/?func=detail&aid=3544851&group_id=10501&atid=110501
+--- a/src/olestream.h
++++ b/src/olestream.h
+@@ -23,7 +23,7 @@
+ #include "global.h"  // U8,... typedefs
+ #include <stack>
+ 
+-#include <glib/giochannel.h> // GSeekType
++#include <glib.h> // GSeekType
+ 
+ namespace wvWare {
+ 
diff --git a/pkgs/tools/misc/xburst-tools/default.nix b/pkgs/tools/misc/xburst-tools/default.nix
index 563406e430b88..cc9f98a94f60f 100644
--- a/pkgs/tools/misc/xburst-tools/default.nix
+++ b/pkgs/tools/misc/xburst-tools/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation {
   # Not to strip cross build binaries (this is for the gcc-cross-wrapper)
   dontCrossStrip = true;
 
-  buildNativeInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ libusb libusb1 autoconf automake confuse ] ++
     stdenv.lib.optional (gccCross != null) gccCross;
 
diff --git a/pkgs/tools/misc/youtube-dl/default.nix b/pkgs/tools/misc/youtube-dl/default.nix
index 16d844d10d5d4..09752ec71ce94 100644
--- a/pkgs/tools/misc/youtube-dl/default.nix
+++ b/pkgs/tools/misc/youtube-dl/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [ python ];
-  buildNativeInputs = [ pandoc zip ];
+  nativeBuildInputs = [ pandoc zip ];
 
   patchPhase = ''
     rm youtube-dl
diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index 88cdab38aafde..0f44c67e01cd5 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     ${if linkStatic then "--enable-static --disable-shared" else ""}
   '';
 
-  dontDisableStatic = if linkStatic then true else false;
+  dontDisableStatic = linkStatic;
 
   CFLAGS = if stdenv ? isDietLibC then "-DHAVE_INET_NTOA_R_2_ARGS=1" else "";
   LDFLAGS = if linkStatic then "-static" else "";
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
     # We should refer to the cross built openssl
     # For the 'urandom', maybe it should be a cross-system option
     configureFlags = ''
-      ${if sslSupport then "--with-ssl=${openssl.hostDrv}" else "--without-ssl"}
+      ${if sslSupport then "--with-ssl=${openssl.crossDrv}" else "--without-ssl"}
       ${if linkStatic then "--enable-static --disable-shared" else ""}
       --with-random /dev/urandom
     '';
diff --git a/pkgs/tools/networking/inetutils/default.nix b/pkgs/tools/networking/inetutils/default.nix
index 6734465dbba5a..24d73ff4d6fed 100644
--- a/pkgs/tools/networking/inetutils/default.nix
+++ b/pkgs/tools/networking/inetutils/default.nix
@@ -1,18 +1,26 @@
 { stdenv, fetchurl, ncurses }:
 
 stdenv.mkDerivation rec {
-  name = "inetutils-1.8";
+  name = "inetutils-1.9.1";
 
   src = fetchurl {
     url = "mirror://gnu/inetutils/${name}.tar.gz";
-    sha256 = "1iqihfv54nzjmclivys2dpcyfhavgynj8pp6r44a97jbw2p0nl68";
+    sha256 = "0azzg6njgq79byl6960kb0wihfhhzf49snslhxgvi30ribgfpa82";
   };
 
   buildInputs = [ ncurses /* for `talk' */ ];
 
   configureFlags = "--with-ncurses-include-dir=${ncurses}/include";
 
-  doCheck = true;
+  preConfigure = ''
+     # Fix for building on Glibc 2.16.  Won't be needed once the
+     # gnulib in inetutils is updated.
+     sed -i '/gets is a security hole/d' lib/stdio.in.h
+  '';
+
+  # Test fails with "UNIX socket name too long", probably because our
+  # $TMPDIR is too long.
+  #doCheck = true;
 
   postInstall = ''
     # XXX: These programs are normally installed setuid but since it
diff --git a/pkgs/tools/networking/lftp/default.nix b/pkgs/tools/networking/lftp/default.nix
index 64e7ac50bc0f9..e2d1d8ed62a34 100644
--- a/pkgs/tools/networking/lftp/default.nix
+++ b/pkgs/tools/networking/lftp/default.nix
@@ -1,12 +1,20 @@
-{stdenv, fetchurl, gnutls, libtasn1, pkgconfig, readline, zlib, xz}:
+{ stdenv, fetchurl, gnutls, pkgconfig, readline, zlib, xz }:
 
 stdenv.mkDerivation rec {
-  name = "lftp-4.3.1";
+  name = "lftp-4.4.0";
 
   src = fetchurl {
     url = "ftp://ftp.cs.tu-berlin.de/pub/net/ftp/lftp/${name}.tar.xz";
-    sha256 = "0v3591fknmimarzk5icm0qxdcfzfckwi2drh165vsiggmj590iyx";
+    sha256 = "0cg4gabya2sygbwh2b0cdr8v719q9gv929hdb5g1mxgj8npjd4y7";
   };
 
-  buildInputs = [gnutls libtasn1 pkgconfig readline zlib];
+  patches = [ ./no-gets.patch ];
+
+  buildInputs = [ gnutls pkgconfig readline zlib ];
+
+  meta = {
+    homepage = http://lftp.yar.ru/;
+    description = "A file transfer program supporting a number of network protocols";
+    license = "GPL";
+  };
 }
diff --git a/pkgs/tools/networking/lftp/no-gets.patch b/pkgs/tools/networking/lftp/no-gets.patch
new file mode 100644
index 0000000000000..0c2cb7c8ae6c0
--- /dev/null
+++ b/pkgs/tools/networking/lftp/no-gets.patch
@@ -0,0 +1,15 @@
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -702,10 +702,12 @@
+ /* It is very rare that the developer ever has full control of stdin,
+    so any use of gets warrants an unconditional warning; besides, C11
+    removed it.  */
++#ifdef gets
+ #undef gets
+ #if HAVE_RAW_DECL_GETS
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+ #endif
++#endif
+ 
+ 
+ #if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
diff --git a/pkgs/tools/networking/mailutils/default.nix b/pkgs/tools/networking/mailutils/default.nix
index 43293b7957824..3a84516cd370d 100644
--- a/pkgs/tools/networking/mailutils/default.nix
+++ b/pkgs/tools/networking/mailutils/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "0szbqa12zqzldqyw97lxqax3ja2adis83i7brdfsxmrfw68iaf65";
   };
 
-  patches = [ ./path-to-cat.patch ];
+  patches = [ ./path-to-cat.patch ./no-gets.patch ];
 
   buildInputs =
    [ gettext gdbm libtool pam readline ncurses
diff --git a/pkgs/tools/networking/mailutils/no-gets.patch b/pkgs/tools/networking/mailutils/no-gets.patch
new file mode 100644
index 0000000000000..d72fa3f056cc4
--- /dev/null
+++ b/pkgs/tools/networking/mailutils/no-gets.patch
@@ -0,0 +1,14 @@
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -138,8 +138,10 @@
+ /* It is very rare that the developer ever has full control of stdin,
+    so any use of gets warrants an unconditional warning.  Assume it is
+    always declared, since it is required by C89.  */
+-#undef gets
++#ifdef gets
++# undef gets
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
++#endif
+ 
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
diff --git a/pkgs/tools/networking/modemmanager/default.nix b/pkgs/tools/networking/modemmanager/default.nix
index d3198cee32c72..bfa673eff09f2 100644
--- a/pkgs/tools/networking/modemmanager/default.nix
+++ b/pkgs/tools/networking/modemmanager/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "1fdf5d5cc494825afe9f551248e00a2d91e220e88435b47f109ca2a707a40f1f";
   };
 
-  buildNativeInputs = [ intltool pkgconfig ];
+  nativeBuildInputs = [ intltool pkgconfig ];
 
   buildInputs = [ udev polkit dbus_glib ppp ];
 
diff --git a/pkgs/tools/networking/netboot/default.nix b/pkgs/tools/networking/netboot/default.nix
index 684507a1d2e0c..ec49770d269bf 100644
--- a/pkgs/tools/networking/netboot/default.nix
+++ b/pkgs/tools/networking/netboot/default.nix
@@ -1,46 +1,33 @@
 x@{builderDefsPackage
-  , fetchgit, ...}:
+  , fetchurl, yacc, bison, ...}:
 builderDefsPackage
-(a :  
-let 
-  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ 
-    ["fetchgit"];
+(a :
+let
+  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++
+    [];
 
   buildInputs = map (n: builtins.getAttr n x)
     (builtins.attrNames (builtins.removeAttrs x helperArgNames));
   sourceInfo = rec {
-    version="git-head-${rev}";
+    version="0.10.2";
     baseName="netboot";
-    rev="19a955cd87b399a5b56";
-    name="${baseName}-git-head";
-    url="git://github.com/ITikhonov/netboot.git";
-    hash="7610c734dc46183439c161d327e7ef6a3d5bc07b5173850b92f71ec047b109d6";
+    name="${baseName}-${version}";
+    url="mirror://sourceforge/netboot/${name}.tar.gz";
+    hash="09w09bvwgb0xzn8hjz5rhi3aibysdadbg693ahn8rylnqfq4hwg0";
   };
 in
 rec {
-  srcDrv = a.fetchgit {
+  src = a.fetchurl {
     url = sourceInfo.url;
     sha256 = sourceInfo.hash;
-    rev = sourceInfo.rev;
   };
 
-  src=srcDrv + "/";
-
   inherit (sourceInfo) name version;
   inherit buildInputs;
 
   /* doConfigure should be removed if not needed */
-  phaseNames = ["doBuild" "doDeploy"];
-
-  doBuild = a.fullDepEntry ''
-    gcc netboot.c -o netboot
-  '' ["doUnpack" "addInputs"];
+  phaseNames = ["doUnpack" "doConfigure" "doMakeInstall"];
 
-  doDeploy = a.fullDepEntry ''
-    mkdir -p "$out/bin"
-    cp netboot "$out/bin"
-  '' ["defEnsureDir" "minInit"];
-      
   meta = {
     description = "Mini PXE server";
     maintainers = with a.lib.maintainers;
diff --git a/pkgs/tools/networking/network-manager-applet/default.nix b/pkgs/tools/networking/network-manager-applet/default.nix
index 042fd58c8f102..d38bbcae014d4 100644
--- a/pkgs/tools/networking/network-manager-applet/default.nix
+++ b/pkgs/tools/networking/network-manager-applet/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     polkit isocodes 
   ];
 
-  buildNativeInputs = [ intltool pkgconfig ];
+  nativeBuildInputs = [ intltool pkgconfig ];
 
   makeFlags = [
     ''CFLAGS=-DMOBILE_BROADBAND_PROVIDER_INFO=\"${mobile_broadband_provider_info}/share/mobile-broadband-provider-info/serviceproviders.xml\"''
diff --git a/pkgs/tools/networking/network-manager/default.nix b/pkgs/tools/networking/network-manager/default.nix
index 0e3eaecf4cb08..d9e73a706dbe4 100644
--- a/pkgs/tools/networking/network-manager/default.nix
+++ b/pkgs/tools/networking/network-manager/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ dbus_glib gnutls libgcrypt ];
 
-  buildNativeInputs = [ intltool pkgconfig ];
+  nativeBuildInputs = [ intltool pkgconfig ];
 
   patches =
     [ ( substituteAll {
diff --git a/pkgs/tools/networking/network-manager/pptp.nix b/pkgs/tools/networking/network-manager/pptp.nix
index 8d2acfe9b3168..b71e41c8b56a9 100644
--- a/pkgs/tools/networking/network-manager/pptp.nix
+++ b/pkgs/tools/networking/network-manager/pptp.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ networkmanager pptp ppp ]
     ++ stdenv.lib.optionals withGnome [ gtk libgnome_keyring ];
 
-  buildNativeInputs = [ intltool pkgconfig ];
+  nativeBuildInputs = [ intltool pkgconfig ];
 
   configureFlags =
     if withGnome then "--with-gnome --with-gtkver=2" else "--without-gnome";
diff --git a/pkgs/tools/networking/networkmanagement/default.nix b/pkgs/tools/networking/networkmanagement/default.nix
index 1919186586a6f..474a46387588e 100644
--- a/pkgs/tools/networking/networkmanagement/default.nix
+++ b/pkgs/tools/networking/networkmanagement/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [ kdelibs kde_workspace networkmanager ];
-  buildNativeInputs = [ gettext pkgconfig ];
+  nativeBuildInputs = [ gettext pkgconfig ];
 
   NIX_CFLAGS_COMPILE="-I${kde_workspace}/include/solid/control";
 
diff --git a/pkgs/tools/networking/ntop/default.nix b/pkgs/tools/networking/ntop/default.nix
index 945effabcfbd4..48f2c9f08938a 100644
--- a/pkgs/tools/networking/ntop/default.nix
+++ b/pkgs/tools/networking/ntop/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     cp ${libtool}/share/aclocal/libtool.m4 libtool.m4.in
   '';
 
-  buildNativeInputs = [ autoconf automake libtool wget libpcap gdbm zlib openssl rrdtool
+  nativeBuildInputs = [ autoconf automake libtool wget libpcap gdbm zlib openssl rrdtool
     python geoip ];
 
   meta = {
diff --git a/pkgs/tools/networking/openssh/default.nix b/pkgs/tools/networking/openssh/default.nix
index 2d60b0f0e304e..1c0ed3c6e7789 100644
--- a/pkgs/tools/networking/openssh/default.nix
+++ b/pkgs/tools/networking/openssh/default.nix
@@ -28,7 +28,6 @@ stdenv.mkDerivation rec {
 
   patches = [ ./locale_archive.patch ];
 
-  buildNativeInptus = [ perl ];
   buildInputs = [ zlib openssl libedit pkgconfig pam ];
 
   # I set --disable-strip because later we strip anyway. And it fails to strip
diff --git a/pkgs/tools/networking/pptp/default.nix b/pkgs/tools/networking/pptp/default.nix
index 88f1a86a2edcf..5bfb6f58bea2d 100644
--- a/pkgs/tools/networking/pptp/default.nix
+++ b/pkgs/tools/networking/pptp/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
           MANDIR=$out/share/man/man8 PPPDIR=$out/etc/ppp )
     '';
 
-  buildNativeInputs = [ perl ];
+  nativeBuildInputs = [ perl ];
 
   meta = {
     description = "PPTP client for Linux";
diff --git a/pkgs/tools/networking/surfraw/default.nix b/pkgs/tools/networking/surfraw/default.nix
index 6fcc031aab4b2..bd3a1135a845d 100644
--- a/pkgs/tools/networking/surfraw/default.nix
+++ b/pkgs/tools/networking/surfraw/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     "--disable-opensearch"
   ];
 
-  buildNativeInputs = [ perl ];
+  nativeBuildInputs = [ perl ];
 
   meta = {
     description = "Provides a fast unix command line interface to a variety of popular WWW search engines and other artifacts of power";
diff --git a/pkgs/tools/networking/wget/default.nix b/pkgs/tools/networking/wget/default.nix
index 3199c1cadb84a..3b6c28d2ac113 100644
--- a/pkgs/tools/networking/wget/default.nix
+++ b/pkgs/tools/networking/wget/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
        done
     '';
 
-  buildNativeInputs = [ gettext ];
+  nativeBuildInputs = [ gettext ];
   buildInputs =
     stdenv.lib.optionals doCheck [ perl LWP ]
     ++ stdenv.lib.optional (gnutls != null) gnutls;
diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix
index b4af004e2b0af..e8255ccb2966b 100644
--- a/pkgs/tools/package-management/nix/default.nix
+++ b/pkgs/tools/package-management/nix/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "c53ec8a5518445bea658e1edb4e3be8c315b583aefc55d6969f2bf6f6c805239";
   };
 
-  buildNativeInputs = [ perl pkgconfig ];
+  nativeBuildInputs = [ perl pkgconfig ];
 
   buildInputs = [ curl openssl boehmgc sqlite ];
 
@@ -43,8 +43,8 @@ stdenv.mkDerivation rec {
 
   crossAttrs = {
     postUnpack =
-      '' export CPATH="${bzip2.hostDrv}/include"
-         export NIX_CROSS_LDFLAGS="-L${bzip2.hostDrv}/lib -rpath-link ${bzip2.hostDrv}/lib $NIX_CROSS_LDFLAGS"
+      '' export CPATH="${bzip2.crossDrv}/include"
+         export NIX_CROSS_LDFLAGS="-L${bzip2.crossDrv}/lib -rpath-link ${bzip2.crossDrv}/lib $NIX_CROSS_LDFLAGS"
       '';
 
     configureFlags =
diff --git a/pkgs/tools/package-management/nix/unstable.nix b/pkgs/tools/package-management/nix/unstable.nix
index 38dd3fa809bc8..ff36e0cc3cc57 100644
--- a/pkgs/tools/package-management/nix/unstable.nix
+++ b/pkgs/tools/package-management/nix/unstable.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "7478fd6fea91ec094645e8487b9ef001abd300703d79e04743f4d212469cf13d";
   };
 
-  buildNativeInputs = [ perl pkgconfig ];
+  nativeBuildInputs = [ perl pkgconfig ];
 
   buildInputs = [ curl openssl boehmgc sqlite ];
 
@@ -43,8 +43,8 @@ stdenv.mkDerivation rec {
 
   crossAttrs = {
     postUnpack =
-      '' export CPATH="${bzip2.hostDrv}/include"
-         export NIX_CROSS_LDFLAGS="-L${bzip2.hostDrv}/lib -rpath-link ${bzip2.hostDrv}/lib $NIX_CROSS_LDFLAGS"
+      '' export CPATH="${bzip2.crossDrv}/include"
+         export NIX_CROSS_LDFLAGS="-L${bzip2.crossDrv}/lib -rpath-link ${bzip2.crossDrv}/lib $NIX_CROSS_LDFLAGS"
       '';
 
     configureFlags =
diff --git a/pkgs/tools/security/ccid/default.nix b/pkgs/tools/security/ccid/default.nix
index 896e034ee76bd..0e607092412bd 100644
--- a/pkgs/tools/security/ccid/default.nix
+++ b/pkgs/tools/security/ccid/default.nix
@@ -1,20 +1,21 @@
-{stdenv, fetchurl, pcsclite, pkgconfig, libusb, perl}:
-stdenv.mkDerivation {
-  name = "ccid-1.3.11";
+{ stdenv, fetchurl, pcsclite, pkgconfig, libusb1, perl }:
+stdenv.mkDerivation rec {
+  name = "ccid-1.4.9";
 
   src = fetchurl {
-    url = https://alioth.debian.org/frs/download.php/3080/ccid-1.3.11.tar.bz2;
-    sha256 = "01l9956wids087d38bprr8jqcl05j48cdp25k9q7vzran215mgzp";
+    url = "https://alioth.debian.org/frs/download.php/3866/${name}.tar.bz2";
+    sha256 = "1dj0cw4js4ab678l94rf9p8a8gppkf1hm66qhmq5ajra6r5nv3m9";
   };
 
   patchPhase = ''
     sed -i 's,/usr/bin/env perl,${perl}/bin/perl,' src/*.pl
+    substituteInPlace src/Makefile.in --replace /bin/echo echo
   '';
   preConfigure = ''
     configureFlags="$configureFlags --enable-usbdropdir=$out/pcsc/drivers"
   '';
 
-  buildInputs = [ pcsclite pkgconfig libusb ];
+  buildInputs = [ pcsclite pkgconfig libusb1 ];
 
   meta = {
     description = "ccid drivers for pcsclite";
diff --git a/pkgs/tools/security/ccrypt/default.nix b/pkgs/tools/security/ccrypt/default.nix
index a134f45c988e6..5653af424d1e2 100644
--- a/pkgs/tools/security/ccrypt/default.nix
+++ b/pkgs/tools/security/ccrypt/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation {
     sha256 = "1bzbfq19jnnlp221kilzxpy0l6w3hk9b1iqjz4haypzlyxswnf35";
   };
 
-  buildNativeInputs = [ perl ];
+  nativeBuildInputs = [ perl ];
 
   meta = {
     homepage = http://ccrypt.sourceforge.net/;
diff --git a/pkgs/tools/security/pcsclite/default.nix b/pkgs/tools/security/pcsclite/default.nix
index 28a673d03effd..de0fef9b73f3a 100644
--- a/pkgs/tools/security/pcsclite/default.nix
+++ b/pkgs/tools/security/pcsclite/default.nix
@@ -1,23 +1,26 @@
-{ stdenv, fetchurl, udev, pkgconfig, dbus_libs }:
+{ stdenv, fetchurl, pkgconfig, udev, dbus_libs, perl }:
 
 stdenv.mkDerivation rec {
-  name = "pcsclite-1.7.4";
+  name = "pcsclite-1.8.8";
 
   src = fetchurl {
-    url = "http://alioth.debian.org/frs/download.php/3598/${name}.tar.bz2";
-    sha256 = "1lc3amxisv2ya51v0gysygldj25kv7zj81famv69s205mvmagr6q";
+    url = "http://alioth.debian.org/frs/download.php/3862/${name}.tar.bz2";
+    sha256 = "1rw5530vr2jf02ziyf32jbd98n5q8zjcfwp5nkw3x3bkgr53arpy";
   };
 
   # The OS should care on preparing the drivers into this location
-  configureFlags = [ "--enable-usbdropdir=/var/lib/pcsc/drivers" ];
+  configureFlags = [
+    "--enable-usbdropdir=/var/lib/pcsc/drivers"
+    "--with-systemdsystemunitdir=$out/lib/systemd/system" # probably
+  ];
 
   preConfigure = ''
     configureFlags="$configureFlags --enable-confdir=$out/etc"
   '';
 
-  buildInputs = [ udev dbus_libs ];
+  buildInputs = [ udev dbus_libs perl ];
 
-  buildNativeInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig ];
 
   meta = {
     description = "Middleware to access a smart card using SCard API (PC/SC)";
diff --git a/pkgs/tools/security/pinentry/default.nix b/pkgs/tools/security/pinentry/default.nix
index ba4ce8a3e2201..543c5d81ba1a0 100644
--- a/pkgs/tools/security/pinentry/default.nix
+++ b/pkgs/tools/security/pinentry/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     ++ (if useGtk then ["--enable-pinentry-gtk2"] else ["--disable-pinentry-gtk"])
     ++ (if useQt4 then ["--enable-pinentry-qt4"] else ["--disable-pinentry-qt4"]);
 
-  buildNativeInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig ];
 
   meta = {
     homepage = "http://gnupg.org/aegypten2/";
diff --git a/pkgs/tools/security/polkit-gnome/default.nix b/pkgs/tools/security/polkit-gnome/default.nix
index b70aa427031ef..c06aac204a1c6 100644
--- a/pkgs/tools/security/polkit-gnome/default.nix
+++ b/pkgs/tools/security/polkit-gnome/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [ polkit gtk3 ];
-  buildNativeInputs = [ pkgconfig intltool ];
+  nativeBuildInputs = [ pkgconfig intltool ];
 
   configureFlags = "--disable-introspection";
 
diff --git a/pkgs/tools/security/polkit-kde-agent/default.nix b/pkgs/tools/security/polkit-kde-agent/default.nix
index 10836366b1871..7696ee93bce0a 100644
--- a/pkgs/tools/security/polkit-kde-agent/default.nix
+++ b/pkgs/tools/security/polkit-kde-agent/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ kdelibs polkit_qt_1 ];
 
-  buildNativeInputs = [ gettext ];
+  nativeBuildInputs = [ gettext ];
 
   patchPhase = "sed -e s/KDE4_AUTOSTART/AUTOSTART/ -i CMakeLists.txt";
 
diff --git a/pkgs/tools/system/acct/default.nix b/pkgs/tools/system/acct/default.nix
index 003dbb45a2a48..a2ea6176c7468 100644
--- a/pkgs/tools/system/acct/default.nix
+++ b/pkgs/tools/system/acct/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "1mbg18acrva5m7kxc9pzhaknsqm4r90nrp7ax9jkm9wjkrxwhqs1";
   };
 
+  patches = [ ./no-gets.patch ];
+
   doCheck = true;
 
   meta = {
diff --git a/pkgs/tools/system/acct/no-gets.patch b/pkgs/tools/system/acct/no-gets.patch
new file mode 100644
index 0000000000000..3478b66de9dba
--- /dev/null
+++ b/pkgs/tools/system/acct/no-gets.patch
@@ -0,0 +1,22 @@
+hack until acct pulls a newer gnulib version
+
+From 66712c23388e93e5c518ebc8515140fa0c807348 Mon Sep 17 00:00:00 2001
+From: Eric Blake <eblake@redhat.com>
+Date: Thu, 29 Mar 2012 13:30:41 -0600
+Subject: [PATCH] stdio: don't assume gets any more
+
+Gnulib intentionally does not have a gets module, and now that C11
+and glibc have dropped it, we should be more proactive about warning
+any user on a platform that still has a declaration of this dangerous
+interface.
+
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -125,7 +125,6 @@
+    so any use of gets warrants an unconditional warning.  Assume it is
+    always declared, since it is required by C89.  */
+ #undef gets
+-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+ 
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
diff --git a/pkgs/tools/text/diffutils/default.nix b/pkgs/tools/text/diffutils/default.nix
index 086a44675a9a7..fc4293ad7cff4 100644
--- a/pkgs/tools/text/diffutils/default.nix
+++ b/pkgs/tools/text/diffutils/default.nix
@@ -1,28 +1,20 @@
-{stdenv, fetchurl, coreutils ? null}:
+{ stdenv, fetchurl, coreutils ? null }:
 
-stdenv.mkDerivation ({
+stdenv.mkDerivation {
   name = "diffutils-3.2";
-  
+
   src = fetchurl {
     url = mirror://gnu/diffutils/diffutils-3.2.tar.gz;
     sha256 = "1lsf0ln0h3mnm2y0mwgrfk0lyfi7bnm4r886acvdrrsvc7pypaia";
   };
-  
+
+  patches = [ ./gets-undeclared.patch ];
+
   /* If no explicit coreutils is given, use the one from stdenv. */
-  buildNativeInputs = [coreutils];
+  nativeBuildInputs = [ coreutils ];
 
   meta = {
     homepage = http://www.gnu.org/software/diffutils/diffutils.html;
     description = "Commands for showing the differences between files (diff, cmp, etc.)";
   };
 }
-
-//
-
-{
-  crossAttrs =
-    # XXX: Temporary workaround to allow GNU/Hurd builds with newer libcs.
-    (stdenv.lib.optionalAttrs (stdenv.cross.config == "i586-pc-gnu") {
-      patches = [ ../../misc/coreutils/gets-undeclared.patch ];
-    });
-})
diff --git a/pkgs/tools/text/diffutils/gets-undeclared.patch b/pkgs/tools/text/diffutils/gets-undeclared.patch
new file mode 100644
index 0000000000000..b6cdc77caa849
--- /dev/null
+++ b/pkgs/tools/text/diffutils/gets-undeclared.patch
@@ -0,0 +1,71 @@
+This patch is needed to allow builds with newer versions of
+the GNU libc (2.16+).
+
+
+commit 66712c23388e93e5c518ebc8515140fa0c807348
+Author: Eric Blake <eblake@redhat.com>
+Date:   Thu Mar 29 13:30:41 2012 -0600
+
+    stdio: don't assume gets any more
+    
+    Gnulib intentionally does not have a gets module, and now that C11
+    and glibc have dropped it, we should be more proactive about warning
+    any user on a platform that still has a declaration of this dangerous
+    interface.
+    
+    * m4/stdio_h.m4 (gl_STDIO_H, gl_STDIO_H_DEFAULTS): Drop gets
+    support.
+    * modules/stdio (Makefile.am): Likewise.
+    * lib/stdio-read.c (gets): Likewise.
+    * tests/test-stdio-c++.cc: Likewise.
+    * m4/warn-on-use.m4 (gl_WARN_ON_USE_PREPARE): Fix comment.
+    * lib/stdio.in.h (gets): Make warning occur in more places.
+    * doc/posix-functions/gets.texi (gets): Update documentation.
+    Reported by Christer Solskogen.
+    
+    Signed-off-by: Eric Blake <eblake@redhat.com>
+
+diff --git a/lib/stdio.in.h b/lib/stdio.in.h
+index aa7b599..c377b6e 100644
+--- a/lib/stdio.in.h
++++ b/lib/stdio.in.h
+@@ -698,22 +698,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
+ # endif
+ #endif
+ 
+-#if @GNULIB_GETS@
+-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
+-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+-#   undef gets
+-#   define gets rpl_gets
+-#  endif
+-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
+-_GL_CXXALIAS_RPL (gets, char *, (char *s));
+-# else
+-_GL_CXXALIAS_SYS (gets, char *, (char *s));
+-#  undef gets
+-# endif
+-_GL_CXXALIASWARN (gets);
+ /* It is very rare that the developer ever has full control of stdin,
+-   so any use of gets warrants an unconditional warning.  Assume it is
+-   always declared, since it is required by C89.  */
++   so any use of gets warrants an unconditional warning; besides, C11
++   removed it.  */
++#undef gets
++#if HAVE_RAW_DECL_GETS
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+ #endif
+ 
+@@ -1053,9 +1042,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
+ # endif
+ #endif
+ 
+-/* Some people would argue that sprintf should be handled like gets
+-   (for example, OpenBSD issues a link warning for both functions),
+-   since both can cause security holes due to buffer overruns.
++/* Some people would argue that all sprintf uses should be warned about
++   (for example, OpenBSD issues a link warning for it),
++   since it can cause security holes due to buffer overruns.
+    However, we believe that sprintf can be used safely, and is more
+    efficient than snprintf in those safe cases; and as proof of our
+    belief, we use sprintf in several gnulib modules.  So this header
diff --git a/pkgs/tools/text/gawk/default.nix b/pkgs/tools/text/gawk/default.nix
index bb6e4e20d244c..29b3936a0ba9c 100644
--- a/pkgs/tools/text/gawk/default.nix
+++ b/pkgs/tools/text/gawk/default.nix
@@ -1,14 +1,16 @@
 { stdenv, fetchurl, libsigsegv }:
 
-stdenv.mkDerivation (rec {
-  name = "gawk-4.0.0";
+stdenv.mkDerivation rec {
+  name = "gawk-4.0.2";
 
   src = fetchurl {
-    url = "mirror://gnu/gawk/${name}.tar.bz2";
-    sha256 = "0sss7rhpvizi2a88h6giv0i7w5h07s2fxkw3s6n1hqvcnhrfgbb0";
+    url = "mirror://gnu/gawk/${name}.tar.xz";
+    sha256 = "04vd0axif762mf781pj3days6ilv2333b9zi9c50y5mma66g5q91";
   };
 
-  doCheck = !stdenv.isCygwin;      # XXX: `test-dup2' segfaults on Cygwin 6.1
+  patches = stdenv.lib.optional stdenv.isCygwin [ ./cygwin-identifiers.patch ];
+
+  doCheck = !stdenv.isCygwin; # XXX: `test-dup2' segfaults on Cygwin 6.1
 
   buildInputs = [ libsigsegv ];
 
@@ -37,9 +39,3 @@ stdenv.mkDerivation (rec {
     maintainers = [ stdenv.lib.maintainers.ludo ];
   };
 }
-
-//
-
-stdenv.lib.optionalAttrs stdenv.isCygwin {
-  patches = [ ./cygwin-identifiers.patch ];
-})
diff --git a/pkgs/tools/text/gnugrep/default.nix b/pkgs/tools/text/gnugrep/default.nix
index 8368edef6563e..98a737339d27b 100644
--- a/pkgs/tools/text/gnugrep/default.nix
+++ b/pkgs/tools/text/gnugrep/default.nix
@@ -1,19 +1,21 @@
 { stdenv, fetchurl, pcre, libiconv ? null }:
 
-let version = "2.10"; in
+let version = "2.14"; in
 
-stdenv.mkDerivation ({
+stdenv.mkDerivation {
   name = "gnugrep-${version}";
 
   src = fetchurl {
     url = "mirror://gnu/grep/grep-${version}.tar.xz";
-    sha256 = "1cvsqyfzk1p38fcaav22dn76fkd02g7bjnqna6vrpk9vy9rnfybc";
+    sha256 = "1qbjb1l7f9blckc5pqy8jlf6482hpx4awn2acmhyf5mv9wfq03p7";
   };
 
   buildInputs = [ pcre ]
-    ++ (stdenv.lib.optional (libiconv != null) libiconv);
+    ++ stdenv.lib.optional (libiconv != null) libiconv;
 
-  doCheck = if stdenv.isDarwin then false else true;
+  NIX_LDFLAGS = stdenv.lib.optionalString (libiconv != null) "-L${libiconv}/lib -liconv";
+
+  doCheck = !stdenv.isDarwin;
 
   # On Mac OS X, force use of mkdir -p, since Grep's fallback
   # (./install-sh) is broken.
@@ -38,4 +40,4 @@ stdenv.mkDerivation ({
   };
 
   passthru = {inherit pcre;};
-} // (if libiconv != null then { NIX_LDFLAGS="-L${libiconv}/lib -liconv"; } else {}) )
+}
diff --git a/pkgs/tools/text/gnupatch/darwin-fix.patch b/pkgs/tools/text/gnupatch/darwin-fix.patch
deleted file mode 100644
index 50d0853481482..0000000000000
--- a/pkgs/tools/text/gnupatch/darwin-fix.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-Fix builds on Darwin:
-http://lists.gnu.org/archive/html/bug-patch/2010-01/msg00004.html .
-
-
-commit 2c4e3ecddec8a686bd50d238f4cefebb950298b7
-Author: Andreas Gruenbacher <agruen@suse.de>
-Date:   Fri Jan 1 15:58:15 2010 +0100
-
-    * Makefile.in (LIBSRCS, LIBM4FILES): Add the missing files strnlen.c,
-    strnlen.m4, and safe-read.m4.
-
-diff --git a/Makefile.in b/Makefile.in
-index 3b3d78a..26dc281 100644
---- a/Makefile.in
-+++ b/Makefile.in
-@@ -91,6 +91,7 @@ LIBSRCS = \
- 	gl/lib/stripslash.c \
- 	gl/lib/strncasecmp.c \
- 	gl/lib/strndup.c \
-+	gl/lib/strnlen.c \
- 	gl/lib/xmalloc.c \
- 	gl/lib/xstrndup.c
-
-
-Add the missing bits from Gnulib.
-
---- /dev/null	2012-04-23 08:54:35.747205543 +0200
-+++ b/gl/lib/strnlen.c	2012-01-16 22:35:02.000000000 +0100
-@@ -0,0 +1,31 @@
-+/* Find the length of STRING, but scan at most MAXLEN characters.
-+   Copyright (C) 2005-2007, 2009-2012 Free Software Foundation, Inc.
-+   Written by Simon Josefsson.
-+
-+   This program is free software; you can redistribute it and/or modify
-+   it under the terms of the GNU General Public License as published by
-+   the Free Software Foundation; either version 2, or (at your option)
-+   any later version.
-+
-+   This program is distributed in the hope that it will be useful,
-+   but WITHOUT ANY WARRANTY; without even the implied warranty of
-+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+   GNU General Public License for more details.
-+
-+   You should have received a copy of the GNU General Public License
-+   along with this program; if not, write to the Free Software Foundation,
-+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
-+
-+#include <config.h>
-+
-+#include <string.h>
-+
-+/* Find the length of STRING, but scan at most MAXLEN characters.
-+   If no '\0' terminator is found in that many characters, return MAXLEN.  */
-+
-+size_t
-+strnlen (const char *string, size_t maxlen)
-+{
-+  const char *end = memchr (string, '\0', maxlen);
-+  return end ? (size_t) (end - string) : maxlen;
-+}
diff --git a/pkgs/tools/text/gnupatch/default.nix b/pkgs/tools/text/gnupatch/default.nix
index a7a166c95c3be..c8c336ad202c8 100644
--- a/pkgs/tools/text/gnupatch/default.nix
+++ b/pkgs/tools/text/gnupatch/default.nix
@@ -1,20 +1,21 @@
 { stdenv, fetchurl, ed }:
 
-stdenv.mkDerivation (rec {
-  name = "patch-2.6.1";
+stdenv.mkDerivation rec {
+  name = "patch-2.7.1";
 
   src = fetchurl {
     url = "mirror://gnu/patch/${name}.tar.gz";
-    sha256 = "1fc1jyq80nswkf492fiqdbl2bhvlw2wb44ghqlfd3zngx4qkfmni";
+    sha256 = "1m9r83b5c154xnxbvgjg4lfff58xjapanj6dmmivqx1liik2hpy0";
   };
 
-  buildInputs = (stdenv.lib.optional doCheck ed);
+  buildInputs = stdenv.lib.optional doCheck ed;
 
   crossAttrs = {
     configureFlags = [ "ac_cv_func_strnlen_working=yes" ];
   };
 
-  doCheck = true;
+  # Tests fail on FreeBSD due to a Bashism in the tests.
+  doCheck = !stdenv.isFreeBSD;
 
   meta = {
     description = "GNU Patch, a program to apply differences to files";
@@ -33,9 +34,3 @@ stdenv.mkDerivation (rec {
     platforms = stdenv.lib.platforms.all;
   };
 }
-
-//
-
-(stdenv.lib.optionalAttrs stdenv.isDarwin {
-  patches = [ ./darwin-fix.patch ];
-}))
diff --git a/pkgs/tools/text/groff/default.nix b/pkgs/tools/text/groff/default.nix
index 243fe8dcab810..90c5ef0ba819e 100644
--- a/pkgs/tools/text/groff/default.nix
+++ b/pkgs/tools/text/groff/default.nix
@@ -1,15 +1,15 @@
 { stdenv, fetchurl, ghostscript, perl, groff }:
 
 stdenv.mkDerivation rec {
-  name = "groff-1.20.1";
+  name = "groff-1.22.2";
 
   src = fetchurl {
     url = "mirror://gnu/groff/${name}.tar.gz";
-    sha256 = "01fq5i68p4s4fc6m8i90y5d28wk1x6zh2mkw85n0qqnb6n0qfidn";
+    sha256 = "0xi07nhj5vdgax37rj25mwxzdmsz1ifx50hjgc6hqbkpqkd6821q";
   };
 
   buildInputs = [ ghostscript ];
-  buildNativeInputs = [ perl ];
+  nativeBuildInputs = [ perl ];
 
   doCheck = true;
 
@@ -22,7 +22,9 @@ stdenv.mkDerivation rec {
   };
 
   meta = {
+    homepage = "http://www.gnu.org/software/groff/";
     description = "GNU Troff, a typesetting package that reads plain text and produces formatted output";
+    license = "GPLv3+";
 
     longDescription = ''
       groff is the GNU implementation of troff, a document formatting
@@ -35,9 +37,5 @@ stdenv.mkDerivation rec {
       version gxditview of the X11 xditview previewer, and an
       implementation of the -mm macros.
     '';
-
-    homepage = http://www.gnu.org/software/groff/;
-
-    license = "GPLv3+";
   };
 }
diff --git a/pkgs/tools/text/kdiff3/default.nix b/pkgs/tools/text/kdiff3/default.nix
index d8807bda08bc3..fc8813e7cec70 100644
--- a/pkgs/tools/text/kdiff3/default.nix
+++ b/pkgs/tools/text/kdiff3/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ kdelibs ];
-  buildNativeInputs = [ cmake gettext ];
+  nativeBuildInputs = [ cmake gettext ];
 
   meta = {
     homepage = http://kdiff3.sourceforge.net/;
diff --git a/pkgs/tools/text/wdiff/default.nix b/pkgs/tools/text/wdiff/default.nix
index 0d0576ee4a761..b64d05e19e167 100644
--- a/pkgs/tools/text/wdiff/default.nix
+++ b/pkgs/tools/text/wdiff/default.nix
@@ -1,14 +1,11 @@
 { stdenv, fetchurl, which, screen }:
 
-let
-  name = "wdiff-1.1.0";
-in
-stdenv.mkDerivation {
-  inherit name;
+stdenv.mkDerivation rec {
+  name = "wdiff-1.1.2";
 
   src = fetchurl {
     url = "mirror://gnu/wdiff/${name}.tar.gz";
-    sha256 = "1lg5lz78xij4jjifv8fj68ixr9mha1c5vp8xzyg6rdx6ynkvnm5i";
+    sha256 = "0q78y5awvjjmsvizqilbpwany62shlmlq2ayxkjbygmdafpk1k8j";
   };
 
   # Required for the compile-time for the test suite.