summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/closure/default.nix8
-rw-r--r--pkgs/development/compilers/coreclr/default.nix1
-rw-r--r--pkgs/development/compilers/emscripten-fastcomp/default.nix6
-rw-r--r--pkgs/development/compilers/emscripten/default.nix4
-rw-r--r--pkgs/development/compilers/gcc/5/default.nix5
-rw-r--r--pkgs/development/compilers/gcc/5/libcxx38-and-above.patch46
-rw-r--r--pkgs/development/compilers/gcc/snapshot/default.nix552
-rw-r--r--pkgs/development/compilers/ghc/7.10.3.nix1
-rw-r--r--pkgs/development/compilers/ghcjs/shims.nix4
-rw-r--r--pkgs/development/compilers/go/1.4.nix9
-rw-r--r--pkgs/development/compilers/go/1.6.nix7
-rw-r--r--pkgs/development/compilers/go/1.7.nix7
-rw-r--r--pkgs/development/compilers/go/1.8.nix12
-rw-r--r--pkgs/development/compilers/halvm/2.4.0.nix48
-rw-r--r--pkgs/development/compilers/ispc/default.nix4
-rw-r--r--pkgs/development/compilers/kotlin/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/3.7/libc++abi.nix17
-rw-r--r--pkgs/development/compilers/llvm/3.9/clang/default.nix11
-rw-r--r--pkgs/development/compilers/llvm/3.9/llvm.nix16
-rw-r--r--pkgs/development/compilers/llvm/4/clang/default.nix13
-rw-r--r--pkgs/development/compilers/llvm/4/default.nix11
-rw-r--r--pkgs/development/compilers/llvm/4/libc++/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/4/libc++abi.nix2
-rw-r--r--pkgs/development/compilers/llvm/4/lld.nix2
-rw-r--r--pkgs/development/compilers/llvm/4/lldb.nix2
-rw-r--r--pkgs/development/compilers/llvm/4/llvm.nix17
-rw-r--r--pkgs/development/compilers/nasm/default.nix4
-rw-r--r--pkgs/development/compilers/openjdk-darwin/8.nix11
-rw-r--r--pkgs/development/compilers/ponyc/default.nix4
-rw-r--r--pkgs/development/compilers/ponyc/pony-stable.nix6
-rw-r--r--pkgs/development/compilers/rust/nightlyBin.nix9
-rw-r--r--pkgs/development/compilers/scala/default.nix4
-rw-r--r--pkgs/development/compilers/souper/cmake-fix.patch14
-rw-r--r--pkgs/development/compilers/souper/default.nix20
-rw-r--r--pkgs/development/compilers/tinycc/default.nix6
-rw-r--r--pkgs/development/go-modules/generic/default.nix6
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix4
-rw-r--r--pkgs/development/haskell-modules/configuration-ghcjs.nix3
-rw-r--r--pkgs/development/haskell-modules/configuration-hackage2nix.yaml3
-rw-r--r--pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix59
-rw-r--r--pkgs/development/haskell-modules/configuration-nix.nix36
-rw-r--r--pkgs/development/haskell-modules/default.nix9
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix20
-rw-r--r--pkgs/development/haskell-modules/with-packages-wrapper.nix9
-rw-r--r--pkgs/development/interpreters/clips/default.nix29
-rw-r--r--pkgs/development/interpreters/clisp/hg.nix10
-rw-r--r--pkgs/development/interpreters/erlang/R14.nix64
-rw-r--r--pkgs/development/interpreters/erlang/R16.nix5
-rw-r--r--pkgs/development/interpreters/erlang/R16B02-8-basho.nix27
-rw-r--r--pkgs/development/interpreters/erlang/R17.nix7
-rw-r--r--pkgs/development/interpreters/erlang/R18.nix7
-rw-r--r--pkgs/development/interpreters/erlang/R19.nix9
-rw-r--r--pkgs/development/interpreters/guile/2.0.nix120
-rw-r--r--pkgs/development/interpreters/guile/default.nix33
-rw-r--r--pkgs/development/interpreters/guile/setup-hook-2.2.sh13
-rw-r--r--pkgs/development/interpreters/lua-5/5.2.darwin.patch4
-rw-r--r--pkgs/development/interpreters/pure/default.nix4
-rw-r--r--pkgs/development/interpreters/renpy/default.nix23
-rw-r--r--pkgs/development/interpreters/ruby/rubygems-src.nix4
-rw-r--r--pkgs/development/libraries/CGAL/default.nix18
-rw-r--r--pkgs/development/libraries/CoinMP/default.nix4
-rw-r--r--pkgs/development/libraries/SDL2_gfx/default.nix2
-rw-r--r--pkgs/development/libraries/SDL2_mixer/default.nix5
-rw-r--r--pkgs/development/libraries/ace/default.nix22
-rw-r--r--pkgs/development/libraries/appstream/default.nix24
-rw-r--r--pkgs/development/libraries/aqbanking/sources.nix12
-rwxr-xr-xpkgs/development/libraries/aqbanking/update.sh2
-rw-r--r--pkgs/development/libraries/armadillo/default.nix13
-rw-r--r--pkgs/development/libraries/assimp/default.nix10
-rw-r--r--pkgs/development/libraries/aubio/default.nix17
-rw-r--r--pkgs/development/libraries/audio/suil/default.nix4
-rw-r--r--pkgs/development/libraries/babl/default.nix10
-rw-r--r--pkgs/development/libraries/bobcat/default.nix7
-rw-r--r--pkgs/development/libraries/boost/generic.nix2
-rw-r--r--pkgs/development/libraries/caf/default.nix23
-rw-r--r--pkgs/development/libraries/cdk/default.nix17
-rw-r--r--pkgs/development/libraries/ceres-solver/default.nix16
-rw-r--r--pkgs/development/libraries/cfitsio/default.nix18
-rw-r--r--pkgs/development/libraries/chipmunk/default.nix7
-rw-r--r--pkgs/development/libraries/chromaprint/default.nix4
-rw-r--r--pkgs/development/libraries/cimg/default.nix6
-rw-r--r--pkgs/development/libraries/cl/default.nix22
-rw-r--r--pkgs/development/libraries/concurrencykit/default.nix19
-rw-r--r--pkgs/development/libraries/cre2/default.nix34
-rw-r--r--pkgs/development/libraries/dbus/make-session-conf.xsl3
-rw-r--r--pkgs/development/libraries/dlib/default.nix40
-rw-r--r--pkgs/development/libraries/drumstick/default.nix14
-rw-r--r--pkgs/development/libraries/eigen/default.nix2
-rw-r--r--pkgs/development/libraries/enginepkcs11/default.nix21
-rw-r--r--pkgs/development/libraries/exempi/default.nix4
-rw-r--r--pkgs/development/libraries/exosip/default.nix18
-rw-r--r--pkgs/development/libraries/fcppt/default.nix25
-rw-r--r--pkgs/development/libraries/ffmpegthumbnailer/default.nix15
-rw-r--r--pkgs/development/libraries/ffms/default.nix27
-rw-r--r--pkgs/development/libraries/filter-audio/default.nix14
-rw-r--r--pkgs/development/libraries/gdal/default.nix4
-rw-r--r--pkgs/development/libraries/gecode/default.nix5
-rw-r--r--pkgs/development/libraries/geis/default.nix4
-rw-r--r--pkgs/development/libraries/gloox/default.nix20
-rw-r--r--pkgs/development/libraries/gmm/default.nix15
-rw-r--r--pkgs/development/libraries/gnutls/3.5.nix4
-rw-r--r--pkgs/development/libraries/gnutls/generic.nix6
-rw-r--r--pkgs/development/libraries/google-gflags/default.nix15
-rw-r--r--pkgs/development/libraries/granite/default.nix12
-rw-r--r--pkgs/development/libraries/gssdp/default.nix15
-rw-r--r--pkgs/development/libraries/gtkspell/3.nix17
-rw-r--r--pkgs/development/libraries/htmlcxx/default.nix12
-rw-r--r--pkgs/development/libraries/hwloc/default.nix19
-rw-r--r--pkgs/development/libraries/icu/57.nix64
-rw-r--r--pkgs/development/libraries/icu/default.nix9
-rw-r--r--pkgs/development/libraries/iso-codes/default.nix18
-rw-r--r--pkgs/development/libraries/itk/default.nix9
-rw-r--r--pkgs/development/libraries/jemalloc/default.nix7
-rw-r--r--pkgs/development/libraries/ldns/default.nix2
-rw-r--r--pkgs/development/libraries/libbluray/default.nix22
-rw-r--r--pkgs/development/libraries/libbson/default.nix18
-rw-r--r--pkgs/development/libraries/libcouchbase/default.nix27
-rw-r--r--pkgs/development/libraries/libdap/default.nix15
-rw-r--r--pkgs/development/libraries/libdc1394/default.nix18
-rw-r--r--pkgs/development/libraries/libdiscid/default.nix10
-rw-r--r--pkgs/development/libraries/libevdev/default.nix6
-rw-r--r--pkgs/development/libraries/libextractor/default.nix4
-rw-r--r--pkgs/development/libraries/libfilezilla/default.nix4
-rw-r--r--pkgs/development/libraries/libfixposix/default.nix29
-rw-r--r--pkgs/development/libraries/libhttpseverywhere/default.nix7
-rw-r--r--pkgs/development/libraries/libibmad/default.nix4
-rw-r--r--pkgs/development/libraries/libircclient/default.nix2
-rw-r--r--pkgs/development/libraries/libmsgpack/generic.nix7
-rw-r--r--pkgs/development/libraries/libp11/default.nix14
-rw-r--r--pkgs/development/libraries/libseccomp/default.nix18
-rw-r--r--pkgs/development/libraries/libsodium/default.nix4
-rw-r--r--pkgs/development/libraries/libzip/default.nix4
-rw-r--r--pkgs/development/libraries/liquid-dsp/default.nix23
-rw-r--r--pkgs/development/libraries/msilbc/default.nix13
-rw-r--r--pkgs/development/libraries/nghttp2/default.nix16
-rw-r--r--pkgs/development/libraries/openssl/default.nix1
-rw-r--r--pkgs/development/libraries/openssl/nix-ssl-cert-file.patch14
-rw-r--r--pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch13
-rw-r--r--pkgs/development/libraries/phonon/backends/gstreamer.nix27
-rw-r--r--pkgs/development/libraries/qt-5/5.5/qtbase/default.nix2
-rw-r--r--pkgs/development/libraries/qt-5/5.6/default.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtbase/default.nix2
-rw-r--r--pkgs/development/libraries/qt-5/5.7/default.nix11
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths-darwin.patch384
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/default.nix110
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/series1
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtmultimedia.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/default.nix2
-rw-r--r--pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh5
-rw-r--r--pkgs/development/libraries/shapelib/default.nix19
-rw-r--r--pkgs/development/libraries/spice-gtk/default.nix4
-rw-r--r--pkgs/development/libraries/umockdev/default.nix29
-rw-r--r--pkgs/development/libraries/urt/default.nix61
-rw-r--r--pkgs/development/libraries/urt/gentoo-config52
-rw-r--r--pkgs/development/libraries/urt/urt-3.1b-build-fixes.patch151
-rw-r--r--pkgs/development/libraries/urt/urt-3.1b-compile-updates.patch141
-rw-r--r--pkgs/development/libraries/urt/urt-3.1b-make.patch75
-rw-r--r--pkgs/development/libraries/urt/urt-3.1b-rle-fixes.patch203
-rw-r--r--pkgs/development/libraries/urt/urt-3.1b-tempfile.patch19
-rw-r--r--pkgs/development/node-packages/node-env.nix2
-rw-r--r--pkgs/development/ocaml-modules/bos/default.nix27
-rw-r--r--pkgs/development/ocaml-modules/cpuid/default.nix24
-rw-r--r--pkgs/development/ocaml-modules/eliom/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/functoria/default.nix27
-rw-r--r--pkgs/development/ocaml-modules/llvm/default.nix24
-rw-r--r--pkgs/development/ocaml-modules/ocaml-migrate-parsetree/default.nix31
-rw-r--r--pkgs/development/ocaml-modules/ocsigen-server/default.nix3
-rw-r--r--pkgs/development/ocaml-modules/ocsigen-toolkit/default.nix33
-rw-r--r--pkgs/development/ocaml-modules/ppx_deriving_yojson/default.nix32
-rw-r--r--pkgs/development/ocaml-modules/rresult/default.nix24
-rw-r--r--pkgs/development/pure-modules/octave/default.nix8
-rw-r--r--pkgs/development/python-modules/configparser/0001-namespace-fix.patch42
-rw-r--r--pkgs/development/python-modules/dateutil/default.nix18
-rw-r--r--pkgs/development/python-modules/django-raster/default.nix25
-rw-r--r--pkgs/development/python-modules/django_guardian.nix4
-rw-r--r--pkgs/development/python-modules/ds4drv.nix27
-rw-r--r--pkgs/development/python-modules/edward/default.nix27
-rw-r--r--pkgs/development/python-modules/first/default.nix22
-rw-r--r--pkgs/development/python-modules/hypothesis.nix12
-rw-r--r--pkgs/development/python-modules/libais/default.nix25
-rw-r--r--pkgs/development/python-modules/libnacl/default.nix31
-rw-r--r--pkgs/development/python-modules/mnemonic.nix21
-rw-r--r--pkgs/development/python-modules/pep257.nix2
-rw-r--r--pkgs/development/python-modules/pip-tools/default.nix29
-rw-r--r--pkgs/development/python-modules/pyGithub/default.nix28
-rw-r--r--pkgs/development/python-modules/pyaes.nix18
-rw-r--r--pkgs/development/python-modules/pycassa/default.nix26
-rw-r--r--pkgs/development/python-modules/pygame/default.nix15
-rw-r--r--pkgs/development/python-modules/pylibmc/default.nix21
-rw-r--r--pkgs/development/python-modules/pytest-django/default.nix33
-rw-r--r--pkgs/development/python-modules/python-jose/default.nix29
-rw-r--r--pkgs/development/python-modules/python-jose/pycryptodome.patch37
-rw-r--r--pkgs/development/python-modules/pyudev.nix26
-rw-r--r--pkgs/development/python-modules/trezor.nix26
-rw-r--r--pkgs/development/python-modules/typed-ast/default.nix17
-rw-r--r--pkgs/development/python-modules/zeep/default.nix91
-rw-r--r--pkgs/development/ruby-modules/bundler/default.nix4
-rw-r--r--pkgs/development/tools/analysis/flow/default.nix4
-rw-r--r--pkgs/development/tools/analysis/radare2/default.nix10
-rw-r--r--pkgs/development/tools/analysis/valgrind/default.nix27
-rw-r--r--pkgs/development/tools/analysis/valgrind/valgrind-bzero.patch37
-rw-r--r--pkgs/development/tools/build-managers/gradle/default.nix4
-rw-r--r--pkgs/development/tools/build-managers/jam/default.nix37
-rw-r--r--pkgs/development/tools/build-managers/redo-sh/default.nix31
-rw-r--r--pkgs/development/tools/build-managers/sbt/0.12.4.nix29
-rw-r--r--pkgs/development/tools/clog-cli/default.nix8
-rw-r--r--pkgs/development/tools/continuous-integration/jenkins/default.nix4
-rw-r--r--pkgs/development/tools/github/cligh/default.nix32
-rw-r--r--pkgs/development/tools/go2nix/default.nix9
-rw-r--r--pkgs/development/tools/heroku/default.nix17
-rw-r--r--pkgs/development/tools/kube-aws/default.nix22
-rw-r--r--pkgs/development/tools/misc/autogen/default.nix6
-rw-r--r--pkgs/development/tools/misc/gede/build.patch11
-rw-r--r--pkgs/development/tools/misc/gede/default.nix31
-rw-r--r--pkgs/development/tools/misc/global/default.nix2
-rw-r--r--pkgs/development/tools/misc/lit/default.nix22
-rw-r--r--pkgs/development/tools/misc/objconv/default.nix39
-rw-r--r--pkgs/development/tools/misc/sipp/default.nix33
-rw-r--r--pkgs/development/tools/misc/travis/Gemfile.lock26
-rw-r--r--pkgs/development/tools/misc/travis/gemset.nix36
-rw-r--r--pkgs/development/tools/misc/xxdiff/tip.nix36
-rw-r--r--pkgs/development/tools/ocaml/jbuilder/default.nix23
-rw-r--r--pkgs/development/tools/ocaml/ocaml-top/default.nix17
-rw-r--r--pkgs/development/tools/parsing/jshon/default.nix15
-rw-r--r--pkgs/development/tools/scalafmt/default.nix4
-rw-r--r--pkgs/development/tools/simavr/default.nix4
-rw-r--r--pkgs/development/tools/slimerjs/default.nix20
-rw-r--r--pkgs/development/tools/vndr/default.nix2
-rw-r--r--pkgs/development/web/nodejs/v7.nix4
229 files changed, 3597 insertions, 1660 deletions
diff --git a/pkgs/development/compilers/closure/default.nix b/pkgs/development/compilers/closure/default.nix
index 949008d990f8..86e04b491e57 100644
--- a/pkgs/development/compilers/closure/default.nix
+++ b/pkgs/development/compilers/closure/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "closure-compiler-${version}";
-  version = "20160208";
+  version = "20170218";
 
   src = fetchurl {
     url = "http://dl.google.com/closure-compiler/compiler-${version}.tar.gz";
-    sha256 = "19v9z8lfxfmhc4cl9fys7vnaslqiznjy1jpk5mcv468p7vysg46p";
+    sha256 = "06snabmpy07x4xm8d1xgq5dfzbjli10xkxk3nx9jms39zkj493cd";
   };
 
   phases = [ "installPhase" ];
@@ -16,9 +16,9 @@ stdenv.mkDerivation rec {
   installPhase = ''
     mkdir -p $out/share/java $out/bin
     tar -xzf $src
-    cp -r compiler.jar $out/share/java/
+    cp -r closure-compiler-v${version}.jar $out/share/java/
     echo "#!${bash}/bin/bash" > $out/bin/closure-compiler
-    echo "${jre}/bin/java -jar $out/share/java/compiler.jar \"\$@\"" >> $out/bin/closure-compiler
+    echo "${jre}/bin/java -jar $out/share/java/closure-compiler-v${version}.jar \"\$@\"" >> $out/bin/closure-compiler
     chmod +x $out/bin/closure-compiler
   '';
 
diff --git a/pkgs/development/compilers/coreclr/default.nix b/pkgs/development/compilers/coreclr/default.nix
index 558cfa35adad..b619bf6ce208 100644
--- a/pkgs/development/compilers/coreclr/default.nix
+++ b/pkgs/development/compilers/coreclr/default.nix
@@ -102,5 +102,6 @@ stdenv.mkDerivation rec {
     platforms = [ "x86_64-linux" ];
     maintainers = with stdenv.lib.maintainers; [ obadz ];
     license = stdenv.lib.licenses.mit;
+    broken = true; # CoreCLR has proven to be very difficult to package. PRs welcome if someone wants to shave that yak.
   };
 }
diff --git a/pkgs/development/compilers/emscripten-fastcomp/default.nix b/pkgs/development/compilers/emscripten-fastcomp/default.nix
index c457ae158389..b5d2ba66e752 100644
--- a/pkgs/development/compilers/emscripten-fastcomp/default.nix
+++ b/pkgs/development/compilers/emscripten-fastcomp/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchFromGitHub, cmake, python, ... }:
 
 let
-  rev = "1.37.1";
+  rev = "1.37.3";
   gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
 in
 stdenv.mkDerivation rec {
@@ -10,14 +10,14 @@ stdenv.mkDerivation rec {
   src = fetchFromGitHub {
     owner = "kripken";
     repo = "emscripten-fastcomp";
-    sha256 = "08jci6h73j4pcd6iq5r4zn8c6qpd6qxc7xivxh3iama9hghmxyk9";
+    sha256 = "0s5156g6576hm31628c2wbqwl9r6vn10z5ry59psl565zz3lpg8x";
     inherit rev;
   };
 
   srcFL = fetchFromGitHub {
     owner = "kripken";
     repo = "emscripten-fastcomp-clang";
-    sha256 = "053svm8vnsma61jzzr8n1224brmjw4pzvklh572bm1p7yg32chaw";
+    sha256 = "0jhk20wb7275n5m9niqkzmvrr8hh5v26glkmsfmng4p66cs7jkil";
     inherit rev;
   };
 
diff --git a/pkgs/development/compilers/emscripten/default.nix b/pkgs/development/compilers/emscripten/default.nix
index f94e826defbb..05df6e9359a0 100644
--- a/pkgs/development/compilers/emscripten/default.nix
+++ b/pkgs/development/compilers/emscripten/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchFromGitHub, emscriptenfastcomp, python, nodejs, closurecompiler, jre }:
 
 let
-  rev = "1.37.1";
+  rev = "1.37.3";
   appdir = "share/emscripten";
 in
 
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
   src = fetchFromGitHub {
     owner = "kripken";
     repo = "emscripten";
-    sha256 = "0xl8lv0ihxsnwnhma3i34pkbz0v1yyc93ac6mdqmzv6fx2wczm04";
+    sha256 = "0pkxm8nd2zv57f2xm0c3n4xsdh2scliyy3zx04xk2bpkvskyzl7x";
     inherit rev;
   };
 
diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix
index 1721eba325bf..da4f7a606705 100644
--- a/pkgs/development/compilers/gcc/5/default.nix
+++ b/pkgs/development/compilers/gcc/5/default.nix
@@ -74,7 +74,10 @@ let version = "5.4.0";
       # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
       # target libraries and tools.
       ++ optional langAda ../gnat-cflags.patch
-      ++ optional langFortran ../gfortran-driving.patch;
+      ++ optional langFortran ../gfortran-driving.patch
+
+      # This could be applied unconditionally but I don't want to cause a full Linux rebuild.
+      ++ optional stdenv.cc.isClang ./libcxx38-and-above.patch;
 
     javaEcj = fetchurl {
       # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
diff --git a/pkgs/development/compilers/gcc/5/libcxx38-and-above.patch b/pkgs/development/compilers/gcc/5/libcxx38-and-above.patch
new file mode 100644
index 000000000000..ee48901a6d0c
--- /dev/null
+++ b/pkgs/development/compilers/gcc/5/libcxx38-and-above.patch
@@ -0,0 +1,46 @@
+This is a slightly modified version of https://svnweb.freebsd.org/ports/head/lang/gcc5/files/patch-libc%2B%2B?revision=432958&view=co&pathrev=432958,
+which doesn't apply cleanly due to them using a slightly different format of patch from us. I just replaced the .orig file references with a/b paths.
+
+--- a/gcc/auto-profile.c 2015-01-18 02:25:42 UTC
++++ b/gcc/auto-profile.c
+@@ -19,11 +19,9 @@ along with GCC; see the file COPYING3.  
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #include "config.h"
+-#include "system.h"
+-
+-#include <string.h>
+ #include <map>
+ #include <set>
++#include "system.h"
+ 
+ #include "coretypes.h"
+ #include "hash-set.h"
+--- a/gcc/graphite-isl-ast-to-gimple.c 2017-01-19 21:02:12 UTC
++++ b/gcc/graphite-isl-ast-to-gimple.c
+@@ -38,6 +38,7 @@ extern "C" {
+ #endif
+ #endif
+ 
++#include <map>
+ #include "system.h"
+ #include "coretypes.h"
+ #include "hash-set.h"
+@@ -75,7 +76,6 @@ extern "C" {
+ #include "tree-scalar-evolution.h"
+ #include "gimple-ssa.h"
+ #include "tree-into-ssa.h"
+-#include <map>
+ 
+ #ifdef HAVE_isl
+ #include "graphite-poly.h"
+--- a/gcc/system.h 2015-01-05 12:33:28 UTC
++++ b/gcc/system.h
+@@ -217,6 +217,7 @@ extern int errno;
+ #ifdef __cplusplus
+ # include <algorithm>
+ # include <cstring>
++# include <new>
+ # include <utility>
+ #endif
+ 
diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix
new file mode 100644
index 000000000000..81bed7119ea5
--- /dev/null
+++ b/pkgs/development/compilers/gcc/snapshot/default.nix
@@ -0,0 +1,552 @@
+{ stdenv, fetchurl, noSysDirs
+, langC ? true, langCC ? true, langFortran ? false
+, langObjC ? stdenv.isDarwin
+, langObjCpp ? stdenv.isDarwin
+, langJava ? false
+, langAda ? false
+, langVhdl ? false
+, langGo ? false
+, profiledCompiler ? false
+, staticCompiler ? false
+, enableShared ? true
+, texinfo ? null
+, perl ? null # optional, for texi2pod (then pod2man); required for Java
+, gmp, mpfr, libmpc, gettext, which
+, libelf                      # optional, for link-time optimizations (LTO)
+, isl ? null # optional, for the Graphite optimization framework.
+, zlib ? null, boehmgc ? null
+, zip ? null, unzip ? null, pkgconfig ? null
+, gtk2 ? null, libart_lgpl ? null
+, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
+, libXrender ? null, xproto ? null, renderproto ? null, xextproto ? null
+, libXrandr ? null, libXi ? null, inputproto ? null, randrproto ? null
+, x11Support ? langJava
+, gnatboot ? null
+, enableMultilib ? false
+, enablePlugin ? true             # whether to support user-supplied plug-ins
+, name ? "gcc"
+, cross ? null
+, binutilsCross ? null
+, libcCross ? null
+, crossStageStatic ? true
+, gnat ? null
+, libpthread ? null, libpthreadCross ? null  # required for GNU/Hurd
+, stripped ? true
+, gnused ? null
+, binutils ? null
+, cloog # unused; just for compat with gcc4, as we override the parameter on some places
+, darwin ? null
+, flex ? null
+}:
+
+assert langJava     -> zip != null && unzip != null
+                       && zlib != null && boehmgc != null
+                       && perl != null;  # for `--enable-java-home'
+assert langAda      -> gnatboot != null;
+assert langVhdl     -> gnat != null;
+
+# LTO needs libelf and zlib.
+assert libelf != null -> zlib != null;
+
+# Make sure we get GNU sed.
+assert stdenv.isDarwin -> gnused != null;
+
+# Need c++filt on darwin
+assert stdenv.isDarwin -> binutils != null;
+
+# The go frontend is written in c++
+assert langGo -> langCC;
+
+with stdenv.lib;
+with builtins;
+
+let version = "7-20161211";
+
+    # Whether building a cross-compiler for GNU/Hurd.
+    crossGNU = cross != null && cross.config == "i586-pc-gnu";
+
+    enableParallelBuilding = true;
+
+    patches =
+      [ ]
+      ++ optional (cross != null) ../libstdc++-target.patch
+      ++ optional noSysDirs ../no-sys-dirs.patch
+      # The GNAT Makefiles did not pay attention to CFLAGS_FOR_TARGET for its
+      # target libraries and tools.
+      ++ optional langAda ../gnat-cflags.patch
+      ++ optional langFortran ../gfortran-driving.patch;
+
+    javaEcj = fetchurl {
+      # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
+      # `configure' time.
+
+      # XXX: Eventually we might want to take it from upstream.
+      url = "ftp://sourceware.org/pub/java/ecj-4.3.jar";
+      sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx";
+    };
+
+    # Antlr (optional) allows the Java `gjdoc' tool to be built.  We want a
+    # binary distribution here to allow the whole chain to be bootstrapped.
+    javaAntlr = fetchurl {
+      url = http://www.antlr.org/download/antlr-4.4-complete.jar;
+      sha256 = "02lda2imivsvsis8rnzmbrbp8rh1kb8vmq4i67pqhkwz7lf8y6dz";
+    };
+
+    xlibs = [
+      libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
+      xproto renderproto xextproto inputproto randrproto
+    ];
+
+    javaAwtGtk = langJava && x11Support;
+
+    /* Platform flags */
+    platformFlags = let
+        gccArch = stdenv.platform.gcc.arch or null;
+        gccCpu = stdenv.platform.gcc.cpu or null;
+        gccAbi = stdenv.platform.gcc.abi or null;
+        gccFpu = stdenv.platform.gcc.fpu or null;
+        gccFloat = stdenv.platform.gcc.float or null;
+        gccMode = stdenv.platform.gcc.mode or null;
+        withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
+        withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
+        withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
+        withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
+        withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
+        withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
+      in
+        withArch +
+        withCpu +
+        withAbi +
+        withFpu +
+        withFloat +
+        withMode;
+
+    /* Cross-gcc settings */
+    crossMingw = cross != null && cross.libc == "msvcrt";
+    crossDarwin = cross != null && cross.libc == "libSystem";
+    crossConfigureFlags = let
+        gccArch = stdenv.cross.gcc.arch or null;
+        gccCpu = stdenv.cross.gcc.cpu or null;
+        gccAbi = stdenv.cross.gcc.abi or null;
+        gccFpu = stdenv.cross.gcc.fpu or null;
+        gccFloat = stdenv.cross.gcc.float or null;
+        gccMode = stdenv.cross.gcc.mode or null;
+        withArch = if gccArch != null then " --with-arch=${gccArch}" else "";
+        withCpu = if gccCpu != null then " --with-cpu=${gccCpu}" else "";
+        withAbi = if gccAbi != null then " --with-abi=${gccAbi}" else "";
+        withFpu = if gccFpu != null then " --with-fpu=${gccFpu}" else "";
+        withFloat = if gccFloat != null then " --with-float=${gccFloat}" else "";
+        withMode = if gccMode != null then " --with-mode=${gccMode}" else "";
+      in
+        "--target=${cross.config}" +
+        withArch +
+        withCpu +
+        withAbi +
+        withFpu +
+        withFloat +
+        withMode +
+        (if crossMingw && crossStageStatic then
+          " --with-headers=${libcCross}/include" +
+          " --with-gcc" +
+          " --with-gnu-as" +
+          " --with-gnu-ld" +
+          " --with-gnu-ld" +
+          " --disable-shared" +
+          " --disable-nls" +
+          " --disable-debug" +
+          " --enable-sjlj-exceptions" +
+          " --enable-threads=win32" +
+          " --disable-win32-registry"
+          else if crossStageStatic then
+          " --disable-libssp --disable-nls" +
+          " --without-headers" +
+          " --disable-threads " +
+          " --disable-libgomp " +
+          " --disable-libquadmath" +
+          " --disable-shared" +
+          " --disable-libatomic " +  # libatomic requires libc
+          " --disable-decimal-float" # libdecnumber requires libc
+          else
+          (if crossDarwin then " --with-sysroot=${getLib libcCross}/share/sysroot"
+           else                " --with-headers=${getDev libcCross}/include") +
+          # Ensure that -print-prog-name is able to find the correct programs.
+          (stdenv.lib.optionalString (crossMingw || crossDarwin) (
+            " --with-as=${binutilsCross}/bin/${cross.config}-as" +
+            " --with-ld=${binutilsCross}/bin/${cross.config}-ld"
+          )) +
+          " --enable-__cxa_atexit" +
+          " --enable-long-long" +
+          (if crossMingw then
+            " --enable-threads=win32" +
+            " --enable-sjlj-exceptions" +
+            " --enable-hash-synchronization" +
+            " --disable-libssp" +
+            " --disable-nls" +
+            " --with-dwarf2" +
+            # I think noone uses shared gcc libs in mingw, so we better do the same.
+            # In any case, mingw32 g++ linking is broken by default with shared libs,
+            # unless adding "-lsupc++" to any linking command. I don't know why.
+            " --disable-shared" +
+            # To keep ABI compatibility with upstream mingw-w64
+            " --enable-fully-dynamic-string"
+            else (if cross.libc == "uclibc" then
+              # libsanitizer requires netrom/netrom.h which is not
+              # available in uclibc.
+              " --disable-libsanitizer" +
+              # In uclibc cases, libgomp needs an additional '-ldl'
+              # and as I don't know how to pass it, I disable libgomp.
+              " --disable-libgomp" else "") +
+            " --enable-threads=posix" +
+            " --enable-nls" +
+            " --disable-decimal-float") # No final libdecnumber (it may work only in 386)
+          );
+    stageNameAddon = if crossStageStatic then "-stage-static" else "-stage-final";
+    crossNameAddon = if cross != null then "-${cross.config}" + stageNameAddon else "";
+
+  bootstrap = cross == null;
+
+in
+
+# We need all these X libraries when building AWT with GTK+.
+assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
+
+stdenv.mkDerivation ({
+  name = "${name}${if stripped then "" else "-debug"}-${version}" + crossNameAddon;
+
+  builder = ../builder.sh;
+
+  src = fetchurl {
+    url = "mirror://gcc/snapshots/${version}/gcc-${version}.tar.bz2";
+    sha256 = "114rrrm5d5cawmr3161d2wgjlzkb9l1imj1p7fnypwz7y85l1661";
+  };
+
+  inherit patches;
+
+  outputs = [ "out" "lib" "man" "info" ];
+  setOutputFlags = false;
+  NIX_NO_SELF_RPATH = true;
+
+  libc_dev = stdenv.cc.libc_dev;
+
+  hardeningDisable = [ "format" ];
+
+  postPatch =
+    if (stdenv.isGNU
+        || (libcCross != null                  # e.g., building `gcc.crossDrv'
+            && libcCross ? crossConfig
+            && libcCross.crossConfig == "i586-pc-gnu")
+        || (crossGNU && libcCross != null))
+    then
+      # On GNU/Hurd glibc refers to Hurd & Mach headers and libpthread is not
+      # in glibc, so add the right `-I' flags to the default spec string.
+      assert libcCross != null -> libpthreadCross != null;
+      let
+        libc = if libcCross != null then libcCross else stdenv.glibc;
+        gnu_h = "gcc/config/gnu.h";
+        extraCPPDeps =
+             libc.propagatedBuildInputs
+          ++ stdenv.lib.optional (libpthreadCross != null) libpthreadCross
+          ++ stdenv.lib.optional (libpthread != null) libpthread;
+        extraCPPSpec =
+          concatStrings (intersperse " "
+                          (map (x: "-I${x.dev or x}/include") extraCPPDeps));
+        extraLibSpec =
+          if libpthreadCross != null
+          then "-L${libpthreadCross}/lib ${libpthreadCross.TARGET_LDFLAGS}"
+          else "-L${libpthread}/lib";
+      in
+        '' echo "augmenting \`CPP_SPEC' in \`${gnu_h}' with \`${extraCPPSpec}'..."
+           sed -i "${gnu_h}" \
+               -es'|CPP_SPEC *"\(.*\)$|CPP_SPEC "${extraCPPSpec} \1|g'
+
+           echo "augmenting \`LIB_SPEC' in \`${gnu_h}' with \`${extraLibSpec}'..."
+           sed -i "${gnu_h}" \
+               -es'|LIB_SPEC *"\(.*\)$|LIB_SPEC "${extraLibSpec} \1|g'
+
+           echo "setting \`NATIVE_SYSTEM_HEADER_DIR' and \`STANDARD_INCLUDE_DIR' to \`${libc.dev}/include'..."
+           sed -i "${gnu_h}" \
+               -es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc.dev}/include"|g'
+        ''
+    else if cross != null || stdenv.cc.libc != null then
+      # On NixOS, use the right path to the dynamic linker instead of
+      # `/lib/ld*.so'.
+      let
+        libc = if libcCross != null then libcCross else stdenv.cc.libc;
+      in
+        '' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..."
+           for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
+           do
+             grep -q LIBC_DYNAMIC_LINKER "$header" || continue
+             echo "  fixing \`$header'..."
+             sed -i "$header" \
+                 -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'
+           done
+        ''
+    else null;
+
+  inherit noSysDirs staticCompiler langJava crossStageStatic
+    libcCross crossMingw;
+
+  nativeBuildInputs = [ texinfo which gettext ]
+    ++ (optional (perl != null) perl)
+    ++ (optional javaAwtGtk pkgconfig);
+
+  buildInputs = [ gmp mpfr libmpc libelf flex ]
+    ++ (optional (isl != null) isl)
+    ++ (optional (zlib != null) zlib)
+    ++ (optionals langJava [ boehmgc zip unzip ])
+    ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
+    ++ (optionals (cross != null) [binutilsCross])
+    ++ (optionals langAda [gnatboot])
+    ++ (optionals langVhdl [gnat])
+
+    # The builder relies on GNU sed (for instance, Darwin's `sed' fails with
+    # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
+    ++ (optional stdenv.isDarwin gnused)
+    ++ (optional stdenv.isDarwin binutils)
+    ;
+
+  NIX_LDFLAGS = stdenv.lib.optionalString  stdenv.isSunOS "-lm -ldl";
+
+  preConfigure = stdenv.lib.optionalString (stdenv.isSunOS && stdenv.is64bit) ''
+    export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
+    export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
+    export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"
+    export CFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CFLAGS_FOR_TARGET"
+  '';
+
+  dontDisableStatic = true;
+
+  configureFlags = "
+    ${if stdenv.isSunOS then
+      " --enable-long-long --enable-libssp --enable-threads=posix --disable-nls --enable-__cxa_atexit " +
+      # On Illumos/Solaris GNU as is preferred
+      " --with-gnu-as --without-gnu-ld "
+      else ""}
+    --enable-lto
+    ${if enableMultilib then "--enable-multilib --disable-libquadmath" else "--disable-multilib"}
+    ${if enableShared then "" else "--disable-shared"}
+    ${if enablePlugin then "--enable-plugin" else "--disable-plugin"}
+    ${optionalString (isl != null) "--with-isl=${isl}"}
+    ${if langJava then
+      "--with-ecj-jar=${javaEcj} " +
+
+      # Follow Sun's layout for the convenience of IcedTea/OpenJDK.  See
+      # <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2010-April/008888.html>.
+      "--enable-java-home --with-java-home=\${prefix}/lib/jvm/jre "
+      else ""}
+    ${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
+    ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr}" else ""}
+    --with-gmp-include=${gmp.dev}/include
+    --with-gmp-lib=${gmp.out}/lib
+    --with-mpfr-include=${mpfr.dev}/include
+    --with-mpfr-lib=${mpfr.out}/lib
+    --with-mpc=${libmpc}
+    ${if libelf != null then "--with-libelf=${libelf}" else ""}
+    --disable-libstdcxx-pch
+    --without-included-gettext
+    --with-system-zlib
+    --enable-static
+    --enable-languages=${
+      concatStrings (intersperse ","
+        (  optional langC        "c"
+        ++ optional langCC       "c++"
+        ++ optional langFortran  "fortran"
+        ++ optional langJava     "java"
+        ++ optional langAda      "ada"
+        ++ optional langVhdl     "vhdl"
+        ++ optional langGo       "go"
+        ++ optional langObjC     "objc"
+        ++ optional langObjCpp   "obj-c++"
+        ++ optionals crossDarwin [ "objc" "obj-c++" ]
+        )
+      )
+    }
+    ${if cross == null
+      then if stdenv.isDarwin
+        then " --with-native-system-header-dir=${darwin.usr-include}"
+        else " --with-native-system-header-dir=${getDev stdenv.cc.libc}/include"
+      else ""}
+    ${if langAda then " --enable-libada" else ""}
+    ${if cross == null && stdenv.isi686 then "--with-arch=i686" else ""}
+    ${if cross != null then crossConfigureFlags else ""}
+    ${if !bootstrap then "--disable-bootstrap" else ""}
+    ${if cross == null then platformFlags else ""}
+  ";
+
+  targetConfig = if cross != null then cross.config else null;
+
+  buildFlags = if bootstrap then
+    (if profiledCompiler then "profiledbootstrap" else "bootstrap")
+    else "";
+
+  installTargets =
+    if stripped
+    then "install-strip"
+    else "install";
+
+  crossAttrs = let
+    xgccArch = stdenv.cross.gcc.arch or null;
+    xgccCpu = stdenv.cross.gcc.cpu or null;
+    xgccAbi = stdenv.cross.gcc.abi or null;
+    xgccFpu = stdenv.cross.gcc.fpu or null;
+    xgccFloat = stdenv.cross.gcc.float or null;
+    xwithArch = if xgccArch != null then " --with-arch=${xgccArch}" else "";
+    xwithCpu = if xgccCpu != null then " --with-cpu=${xgccCpu}" else "";
+    xwithAbi = if xgccAbi != null then " --with-abi=${xgccAbi}" else "";
+    xwithFpu = if xgccFpu != null then " --with-fpu=${xgccFpu}" else "";
+    xwithFloat = if xgccFloat != null then " --with-float=${xgccFloat}" else "";
+  in {
+    AR = "${stdenv.cross.config}-ar";
+    LD = "${stdenv.cross.config}-ld";
+    CC = "${stdenv.cross.config}-gcc";
+    CXX = "${stdenv.cross.config}-gcc";
+    AR_FOR_TARGET = "${stdenv.cross.config}-ar";
+    LD_FOR_TARGET = "${stdenv.cross.config}-ld";
+    CC_FOR_TARGET = "${stdenv.cross.config}-gcc";
+    NM_FOR_TARGET = "${stdenv.cross.config}-nm";
+    CXX_FOR_TARGET = "${stdenv.cross.config}-g++";
+    # If we are making a cross compiler, cross != null
+    NIX_CC_CROSS = if cross == null then "${stdenv.ccCross}" else "";
+    dontStrip = true;
+    configureFlags = ''
+      ${if enableMultilib then "" else "--disable-multilib"}
+      ${if enableShared then "" else "--disable-shared"}
+      ${if langJava then "--with-ecj-jar=${javaEcj.crossDrv}" else ""}
+      ${if javaAwtGtk then "--enable-java-awt=gtk" else ""}
+      ${if langJava && javaAntlr != null then "--with-antlr-jar=${javaAntlr.crossDrv}" else ""}
+      --with-gmp=${gmp.crossDrv}
+      --with-mpfr=${mpfr.crossDrv}
+      --with-mpc=${libmpc.crossDrv}
+      --disable-libstdcxx-pch
+      --without-included-gettext
+      --with-system-zlib
+      --enable-languages=${
+        concatStrings (intersperse ","
+          (  optional langC        "c"
+          ++ optional langCC       "c++"
+          ++ optional langFortran  "fortran"
+          ++ optional langJava     "java"
+          ++ optional langAda      "ada"
+          ++ optional langVhdl     "vhdl"
+          ++ optional langGo       "go"
+          )
+        )
+      }
+      ${if langAda then " --enable-libada" else ""}
+      --target=${stdenv.cross.config}
+      ${xwithArch}
+      ${xwithCpu}
+      ${xwithAbi}
+      ${xwithFpu}
+      ${xwithFloat}
+    '';
+    buildFlags = "";
+  };
+
+
+  # Needed for the cross compilation to work
+  AR = "ar";
+  LD = "ld";
+  # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
+  CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
+
+  # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find
+  # the library headers and binaries, regarless of the language being
+  # compiled.
+
+  # Note: When building the Java AWT GTK+ peer, the build system doesn't
+  # honor `--with-gmp' et al., e.g., when building
+  # `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just
+  # add them to $CPATH and $LIBRARY_PATH in this case.
+  #
+  # Likewise, the LTO code doesn't find zlib.
+
+  CPATH = makeSearchPathOutput "dev" "include" ([]
+    ++ optional (zlib != null) zlib
+    ++ optional langJava boehmgc
+    ++ optionals javaAwtGtk xlibs
+    ++ optionals javaAwtGtk [ gmp mpfr ]
+    ++ optional (libpthread != null) libpthread
+    ++ optional (libpthreadCross != null) libpthreadCross
+
+    # On GNU/Hurd glibc refers to Mach & Hurd
+    # headers.
+    ++ optionals (libcCross != null && libcCross ? "propagatedBuildInputs")
+                 libcCross.propagatedBuildInputs);
+
+  LIBRARY_PATH = makeLibraryPath ([]
+    ++ optional (zlib != null) zlib
+    ++ optional langJava boehmgc
+    ++ optionals javaAwtGtk xlibs
+    ++ optionals javaAwtGtk [ gmp mpfr ]
+    ++ optional (libpthread != null) libpthread);
+
+  EXTRA_TARGET_CFLAGS =
+    if cross != null && libcCross != null then [
+        "-idirafter ${getDev libcCross}/include"
+      ]
+      ++ optionals (! crossStageStatic) [
+        "-B${libcCross.out}/lib"
+      ]
+    else null;
+
+  EXTRA_TARGET_LDFLAGS =
+    if cross != null && libcCross != null then [
+        "-Wl,-L${libcCross.out}/lib"
+      ]
+      ++ (if crossStageStatic then [
+        "-B${libcCross.out}/lib"
+      ] else [
+        "-Wl,-rpath,${libcCross.out}/lib"
+        "-Wl,-rpath-link,${libcCross.out}/lib"
+      ])
+      ++ optionals (libpthreadCross != null) [
+        "-L${libpthreadCross}/lib"
+        "-Wl,${libpthreadCross.TARGET_LDFLAGS}"
+      ]
+    else null;
+
+  passthru =
+    { inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
+
+  inherit enableParallelBuilding enableMultilib;
+
+  inherit (stdenv) is64bit;
+
+  meta = {
+    homepage = http://gcc.gnu.org/;
+    license = stdenv.lib.licenses.gpl3Plus;  # runtime support libraries are typically LGPLv3+
+    description = "GNU Compiler Collection, version ${version}"
+      + (if stripped then "" else " (with debugging info)");
+
+    longDescription = ''
+      The GNU Compiler Collection includes compiler front ends for C, C++,
+      Objective-C, Fortran, OpenMP for C/C++/Fortran, Java, and Ada, as well
+      as libraries for these languages (libstdc++, libgcj, libgomp,...).
+
+      GCC development is a part of the GNU Project, aiming to improve the
+      compiler used in the GNU system including the GNU/Linux variant.
+    '';
+
+    maintainers = with stdenv.lib.maintainers; [ ];
+
+    # gnatboot is not available out of linux platforms, so we disable the darwin build
+    # for the gnat (ada compiler).
+    platforms =
+      stdenv.lib.platforms.linux ++
+      stdenv.lib.platforms.freebsd ++
+      optionals (langAda == false) stdenv.lib.platforms.darwin;
+  };
+}
+
+// optionalAttrs (cross != null && cross.libc == "msvcrt" && crossStageStatic) {
+  makeFlags = [ "all-gcc" "all-target-libgcc" ];
+  installTargets = "install-gcc install-target-libgcc";
+}
+
+# Strip kills static libs of other archs (hence cross != null)
+// optionalAttrs (!stripped || cross != null) { dontStrip = true; NIX_STRIP_DEBUG = 0; }
+
+// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
+)
diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix
index d75f5df370f8..5c6b62bee6f1 100644
--- a/pkgs/development/compilers/ghc/7.10.3.nix
+++ b/pkgs/development/compilers/ghc/7.10.3.nix
@@ -82,5 +82,4 @@ stdenv.mkDerivation rec {
     maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
     inherit (ghc.meta) license platforms;
   };
-
 }
diff --git a/pkgs/development/compilers/ghcjs/shims.nix b/pkgs/development/compilers/ghcjs/shims.nix
index 0da50570bf59..fa706699449a 100644
--- a/pkgs/development/compilers/ghcjs/shims.nix
+++ b/pkgs/development/compilers/ghcjs/shims.nix
@@ -2,6 +2,6 @@
 fetchFromGitHub {
   owner = "ghcjs";
   repo = "shims";
-  rev = "dc034a035aa73db2c5be34145732090bd74c1b57";
-  sha256 = "18r8kf7g7d2n0rhwcgiz9gsgdmgln1nmwwyj347bpn4zh17qlkqa";
+  rev = "b97015229c58eeab7c1d0bb575794b14a9f6efca";
+  sha256 = "1p5adkqvmb1gsv9hnn3if0rdpnaq3v9a1zkfdy282yw05jaaaggz";
 }
diff --git a/pkgs/development/compilers/go/1.4.nix b/pkgs/development/compilers/go/1.4.nix
index b703a92f3ea5..f60077e89621 100644
--- a/pkgs/development/compilers/go/1.4.nix
+++ b/pkgs/development/compilers/go/1.4.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, tzdata, iana_etc, libcCross
+{ stdenv, lib, fetchurl, fetchpatch, tzdata, iana_etc, libcCross
 , pkgconfig
 , pcre
 , Security }:
@@ -114,6 +114,13 @@ stdenv.mkDerivation rec {
   patches = [
     ./remove-tools-1.4.patch
     ./creds-test-1.4.patch
+
+    # This test checks for the wrong thing with recent tzdata. It's been fixed in master but the patch
+    # actually works on old versions too.
+    (fetchpatch {
+      url    = "https://github.com/golang/go/commit/91563ced5897faf729a34be7081568efcfedda31.patch";
+      sha256 = "1ny5l3f8a9dpjjrnjnsplb66308a0x13sa0wwr4j6yrkc8j4qxqi";
+    })
   ];
 
   GOOS = if stdenv.isDarwin then "darwin" else "linux";
diff --git a/pkgs/development/compilers/go/1.6.nix b/pkgs/development/compilers/go/1.6.nix
index 7d78f5efd104..52ffbab6dcb8 100644
--- a/pkgs/development/compilers/go/1.6.nix
+++ b/pkgs/development/compilers/go/1.6.nix
@@ -113,6 +113,13 @@ stdenv.mkDerivation rec {
   patches = [
     ./remove-tools-1.5.patch
     ./creds-test.patch
+
+    # This test checks for the wrong thing with recent tzdata. It's been fixed in master but the patch
+    # actually works on old versions too.
+    (fetchpatch {
+      url    = "https://github.com/golang/go/commit/91563ced5897faf729a34be7081568efcfedda31.patch";
+      sha256 = "1ny5l3f8a9dpjjrnjnsplb66308a0x13sa0wwr4j6yrkc8j4qxqi";
+    })
   ];
 
   GOOS = if stdenv.isDarwin then "darwin" else "linux";
diff --git a/pkgs/development/compilers/go/1.7.nix b/pkgs/development/compilers/go/1.7.nix
index 0df2e8d6f7e9..7fa35e1fcacb 100644
--- a/pkgs/development/compilers/go/1.7.nix
+++ b/pkgs/development/compilers/go/1.7.nix
@@ -107,6 +107,13 @@ stdenv.mkDerivation rec {
     [ ./remove-tools-1.7.patch
       ./cacert-1.7.patch
       ./creds-test.patch
+
+      # This test checks for the wrong thing with recent tzdata. It's been fixed in master but the patch
+      # actually works on old versions too.
+      (fetchpatch {
+        url    = "https://github.com/golang/go/commit/91563ced5897faf729a34be7081568efcfedda31.patch";
+        sha256 = "1ny5l3f8a9dpjjrnjnsplb66308a0x13sa0wwr4j6yrkc8j4qxqi";
+      })
     ];
 
   SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
diff --git a/pkgs/development/compilers/go/1.8.nix b/pkgs/development/compilers/go/1.8.nix
index 00ec11abc47b..6d9ee3de5501 100644
--- a/pkgs/development/compilers/go/1.8.nix
+++ b/pkgs/development/compilers/go/1.8.nix
@@ -80,11 +80,6 @@ stdenv.mkDerivation rec {
   '' + optionalString stdenv.isLinux ''
     sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go
   '' + optionalString stdenv.isDarwin ''
-
-    # Disabling `format_test.go` because it fails on Darwin for an
-    # unknown reason see: https://github.com/NixOS/nixpkgs/pull/23122#issuecomment-282188727
-    rm src/time/format_test.go
-
     substituteInPlace src/race.bash --replace \
       "sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
     sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
@@ -115,6 +110,13 @@ stdenv.mkDerivation rec {
       ./cacert-1.8.patch
       ./creds-test.patch
       ./remove-test-pie-1.8.patch
+
+      # This test checks for the wrong thing with recent tzdata. It's been fixed in master but the patch
+      # works fine here for now.
+      (fetchpatch {
+        url    = "https://github.com/golang/go/commit/91563ced5897faf729a34be7081568efcfedda31.patch";
+        sha256 = "1ny5l3f8a9dpjjrnjnsplb66308a0x13sa0wwr4j6yrkc8j4qxqi";
+      })
     ];
 
   SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
diff --git a/pkgs/development/compilers/halvm/2.4.0.nix b/pkgs/development/compilers/halvm/2.4.0.nix
new file mode 100644
index 000000000000..c167f4bdd75a
--- /dev/null
+++ b/pkgs/development/compilers/halvm/2.4.0.nix
@@ -0,0 +1,48 @@
+{ stdenv, fetchgit, bootPkgs, perl, gmp, ncurses, binutils, autoconf, alex, happy, makeStaticLibraries
+, hscolour, xen, automake, gcc, git, zlib, libtool, enableIntegerSimple ? false
+}:
+
+stdenv.mkDerivation rec {
+  version = "2.4.0";
+  name = "HaLVM-${version}";
+  isHaLVM = true;
+  isGhcjs = false;
+  src = fetchgit {
+    rev = "6aa72c9b047fd8ddff857c994a5a895461fc3925";
+    url = "https://github.com/GaloisInc/HaLVM";
+    sha256 = "05cg4w6fw5ajmpmh8g2msprnygmr4isb3pphqhlddfqwyvqhl167";
+  };
+  prePatch = ''
+    sed -i '312 d' Makefile
+    sed -i '316,446 d' Makefile # Removes RPM packaging
+    sed -i '20 d' src/scripts/halvm-cabal.in
+    sed -ie 's|ld |${binutils}/bin/ld |g' src/scripts/ldkernel.in
+  '';
+  configureFlags = stdenv.lib.optional (!enableIntegerSimple) [ "--enable-gmp" ];
+  propagatedNativeBuildInputs = [ alex happy ];
+  buildInputs =
+   let haskellPkgs = [ alex happy bootPkgs.hscolour bootPkgs.cabal-install bootPkgs.haddock bootPkgs.hpc
+    ]; in [ bootPkgs.ghc
+            automake perl git binutils
+            autoconf xen zlib ncurses.dev
+            libtool gmp ] ++ haskellPkgs;
+  preConfigure = ''
+    autoconf
+    patchShebangs .
+  '';
+  hardeningDisable = ["all"];
+  postInstall = "$out/bin/halvm-ghc-pkg recache";
+  passthru = {
+    inherit bootPkgs;
+    cross.config = "halvm";
+    cc = "${gcc}/bin/gcc";
+    ld = "${binutils}/bin/ld";
+  };
+
+  meta = {
+    homepage = "http://github.com/GaloisInc/HaLVM";
+    description = "The Haskell Lightweight Virtual Machine (HaLVM): GHC running on Xen";
+    maintainers = with stdenv.lib.maintainers; [ dmjio ];
+    inherit (bootPkgs.ghc.meta) license platforms;
+  };
+}
diff --git a/pkgs/development/compilers/ispc/default.nix b/pkgs/development/compilers/ispc/default.nix
index 6bc7f66ca299..f8413075ac81 100644
--- a/pkgs/development/compilers/ispc/default.nix
+++ b/pkgs/development/compilers/ispc/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchFromGitHub, bash, which, m4, python, bison, flex, llvmPackages, clangWrapSelf,
+{stdenv, fetchFromGitHub, bash, which, m4, python, bison, flex_2_6_1, llvmPackages, clangWrapSelf,
 testedTargets ? ["sse2" "host"] # the default test target is sse4, but that is not supported by all Hydra agents
 }:
 
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     m4
     python
     bison
-    flex
+    flex_2_6_1
     llvm
     llvmPackages.clang-unwrapped # we need to link against libclang, so we need the unwrapped
   ];
diff --git a/pkgs/development/compilers/kotlin/default.nix b/pkgs/development/compilers/kotlin/default.nix
index 0f2f3d12a1ce..33921ef02cd7 100644
--- a/pkgs/development/compilers/kotlin/default.nix
+++ b/pkgs/development/compilers/kotlin/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, makeWrapper, jre, unzip }:
 
 stdenv.mkDerivation rec {
-  version = "1.0.6";
+  version = "1.1";
   name = "kotlin-${version}";
 
   src = fetchurl {
     url = "https://github.com/JetBrains/kotlin/releases/download/v${version}/kotlin-compiler-${version}.zip";
-    sha256 = "1dhliqd79hydd62xmrn2nwrcqy7lb5svkahkkpx9w3z9s5r0p8j2";
+    sha256 = "179m5y56fi50qvxsm075h0547swib7n2pfdn8a4axk9wpwldni5a";
   };
 
   propagatedBuildInputs = [ jre ] ;
diff --git a/pkgs/development/compilers/llvm/3.7/libc++abi.nix b/pkgs/development/compilers/llvm/3.7/libc++abi.nix
index 6a62a6256b4f..d2be57b1a5fa 100644
--- a/pkgs/development/compilers/llvm/3.7/libc++abi.nix
+++ b/pkgs/development/compilers/llvm/3.7/libc++abi.nix
@@ -1,6 +1,12 @@
-{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
+{ stdenv, cmake, fetch, fetchpatch, libcxx, libunwind, llvm, version }:
 
-stdenv.mkDerivation {
+let
+  # Newer LLVMs (3.8 onwards) have changed how some basic C++ stuff works, which breaks builds of this older version
+  llvm38-and-above = fetchpatch {
+    url    = "https://trac.macports.org/raw-attachment/ticket/50304/0005-string-Fix-exception-declaration.patch";
+    sha256 = "1lm38n7s0l5dbl7kp4i49pvzxz1mcvlr2vgsnj47agnwhhm63jvr";
+  };
+in stdenv.mkDerivation {
   name = "libc++abi-${version}";
 
   src = fetch "libcxxabi" "0ambfcmr2nh88hx000xb7yjm9lsqjjz49w5mlf6dlxzmj3nslzx4";
@@ -16,6 +22,13 @@ stdenv.mkDerivation {
     export TRIPLE=x86_64-apple-darwin
   '';
 
+  # I can't use patches directly because this is actually a patch for libc++'s source, which we manually extract
+  # into the libc++abi build environment above.
+  prePatch = ''(
+    cd ../libcxx-*
+    patch -p1 < ${llvm38-and-above}
+  )'';
+
   installPhase = if stdenv.isDarwin
     then ''
       for file in lib/*.dylib; do
diff --git a/pkgs/development/compilers/llvm/3.9/clang/default.nix b/pkgs/development/compilers/llvm/3.9/clang/default.nix
index 677c4a526ea4..55938ca016e6 100644
--- a/pkgs/development/compilers/llvm/3.9/clang/default.nix
+++ b/pkgs/development/compilers/llvm/3.9/clang/default.nix
@@ -29,12 +29,23 @@ let
       sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
     '';
 
+    outputs = [ "out" "python" ];
+
     # Clang expects to find LLVMgold in its own prefix
     # Clang expects to find sanitizer libraries in its own prefix
     postInstall = ''
       ln -sv ${llvm}/lib/LLVMgold.so $out/lib
       ln -sv ${llvm}/lib/clang/${version}/lib $out/lib/clang/${version}/
       ln -sv $out/bin/clang $out/bin/cpp
+
+      mkdir -p $python/bin $python/share/clang/
+      mv $out/bin/{git-clang-format,scan-view} $python/bin
+      if [ -e $out/bin/set-xcode-analyzer ]; then
+        mv $out/bin/set-xcode-analyzer $python/bin
+      fi
+      mv $out/share/clang/*.py $python/share/clang
+
+      rm $out/bin/c-index-test
     '';
 
     enableParallelBuilding = true;
diff --git a/pkgs/development/compilers/llvm/3.9/llvm.nix b/pkgs/development/compilers/llvm/3.9/llvm.nix
index 62f1514e2315..2c47ec5127f9 100644
--- a/pkgs/development/compilers/llvm/3.9/llvm.nix
+++ b/pkgs/development/compilers/llvm/3.9/llvm.nix
@@ -40,8 +40,7 @@ in stdenv.mkDerivation rec {
   outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
 
   buildInputs = [ perl groff cmake libxml2 python libffi ]
-    ++ stdenv.lib.optionals stdenv.isDarwin
-         [ libcxxabi darwin.cctools darwin.apple_sdk.libs.xpc ];
+    ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];
 
   propagatedBuildInputs = [ ncurses zlib ];
 
@@ -53,11 +52,15 @@ in stdenv.mkDerivation rec {
       sha256 = "11sq86spw41v72f676igksapdlsgh7fiqp5qkkmgfj0ndqcn9skf";
     }}
   ''
-  # hacky fix: New LLVM releases require a newer OS X SDK than
-  # 10.9. This is a temporary measure until nixpkgs darwin support is
-  # updated.
+  # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
+  # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
+  # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
+  # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
+  # a flag and turn the flag off during the stdenv build. I realize that this LLVM isn't used in the stdenv but I want to
+  # keep it consistent with 4.0. We really shouldn't be copying and pasting all this code around...
   + stdenv.lib.optionalString stdenv.isDarwin ''
-        sed -i 's/os_trace(\(.*\)");$/printf(\1\\n");/g' ./projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
+    substituteInPlace ./projects/compiler-rt/cmake/config-ix.cmake \
+      --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
   ''
   # Patch llvm-config to return correct library path based on --link-{shared,static}.
   + stdenv.lib.optionalString (enableSharedLibraries) ''
@@ -85,7 +88,6 @@ in stdenv.mkDerivation rec {
     ++ stdenv.lib.optionals (isDarwin) [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-    "-DCMAKE_LIBTOOL=${darwin.cctools}/bin/libtool"
   ];
 
   postBuild = ''
diff --git a/pkgs/development/compilers/llvm/4/clang/default.nix b/pkgs/development/compilers/llvm/4/clang/default.nix
index c0a33f03e0f2..6ce63209935c 100644
--- a/pkgs/development/compilers/llvm/4/clang/default.nix
+++ b/pkgs/development/compilers/llvm/4/clang/default.nix
@@ -6,7 +6,7 @@ let
     name = "clang-${version}";
 
     unpackPhase = ''
-      unpackFile ${fetch "cfe" "062n17mfsn85dx3qy1qvq8rfxi7hcbr2nj70v2dah3xmy28i3yaq"}
+      unpackFile ${fetch "cfe" "12n99m60aa680cir3ql56s1jsv6lp61hq4w9rabf4c6vpn7gi9ff"}
       mv cfe-${version}* clang
       sourceRoot=$PWD/clang
       unpackFile ${clang-tools-extra_src}
@@ -29,12 +29,23 @@ let
       sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
     '';
 
+    outputs = [ "out" "python" ];
+
     # Clang expects to find LLVMgold in its own prefix
     # Clang expects to find sanitizer libraries in its own prefix
     postInstall = ''
       ln -sv ${llvm}/lib/LLVMgold.so $out/lib
       ln -sv ${llvm}/lib/clang/${release_version}/lib $out/lib/clang/${release_version}/
       ln -sv $out/bin/clang $out/bin/cpp
+
+      mkdir -p $python/bin $python/share/clang/
+      mv $out/bin/{git-clang-format,scan-view} $python/bin
+      if [ -e $out/bin/set-xcode-analyzer ]; then
+        mv $out/bin/set-xcode-analyzer $python/bin
+      fi
+      mv $out/share/clang/*.py $python/share/clang
+
+      rm $out/bin/c-index-test
     '';
 
     enableParallelBuilding = true;
diff --git a/pkgs/development/compilers/llvm/4/default.nix b/pkgs/development/compilers/llvm/4/default.nix
index aed77b7513ad..999ff858d020 100644
--- a/pkgs/development/compilers/llvm/4/default.nix
+++ b/pkgs/development/compilers/llvm/4/default.nix
@@ -3,18 +3,15 @@ let
   callPackage = newScope (self // { inherit stdenv isl release_version version fetch; });
 
   release_version = "4.0.0";
-  rc = "rc4";
-  version = "${release_version}${rc}";
+  version = release_version; # differentiating these is important for rc's
 
   fetch = name: sha256: fetchurl {
-    url = "http://llvm.org/pre-releases/${release_version}/${rc}/${name}-${version}.src.tar.xz";
-    # Once 4 is released, use this instead:
-    # url = "http://llvm.org/releases/${release-version}/${name}-${version}.src.tar.xz";
+    url = "http://llvm.org/releases/${release_version}/${name}-${version}.src.tar.xz";
     inherit sha256;
   };
 
-  compiler-rt_src = fetch "compiler-rt" "1bxz2z9mxbx7211xfgsn5inwvpz53d1cqg76h8166dsli27xwkjm";
-  clang-tools-extra_src = fetch "clang-tools-extra" "0zkgnnv3srqxf44q4a5n3wpizf71mlq8w5rnwfwhdx777k94s5nx";
+  compiler-rt_src = fetch "compiler-rt" "059ipqq27gd928ay06f1ck3vw6y5h5z4zd766x8k0k7jpqimpwnk";
+  clang-tools-extra_src = fetch "clang-tools-extra" "16bwckgcxfn56mbqjlxi7fxja0zm9hjfa6s3ncm3dz98n5zd7ds1";
 
   self = {
     llvm = callPackage ./llvm.nix {
diff --git a/pkgs/development/compilers/llvm/4/libc++/default.nix b/pkgs/development/compilers/llvm/4/libc++/default.nix
index 753aded54ff7..ba8302919e1e 100644
--- a/pkgs/development/compilers/llvm/4/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/4/libc++/default.nix
@@ -3,7 +3,7 @@
 stdenv.mkDerivation rec {
   name = "libc++-${version}";
 
-  src = fetch "libcxx" "052fc91y8084830ajfm8nkc0vghafhnfl7l89b68qsyz3ra93i3l";
+  src = fetch "libcxx" "15ngfcjc3pjakpwfq7d4n546jj0rgfdv5rpb1qv9xgv9mp236kag";
 
   postUnpack = ''
     unpackFile ${libcxxabi.src}
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
   '';
 
-  buildInputs = [ cmake llvm libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
+  buildInputs = [ cmake libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
   cmakeFlags = [
       "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
diff --git a/pkgs/development/compilers/llvm/4/libc++abi.nix b/pkgs/development/compilers/llvm/4/libc++abi.nix
index 23269f605f09..559b6b26bc52 100644
--- a/pkgs/development/compilers/llvm/4/libc++abi.nix
+++ b/pkgs/development/compilers/llvm/4/libc++abi.nix
@@ -3,7 +3,7 @@
 stdenv.mkDerivation {
   name = "libc++abi-${version}";
 
-  src = fetch "libcxxabi" "02z8d0q42wfmnnd0rd1yg2x4y50rfrv1k9rq00a86b6803dc7p45";
+  src = fetch "libcxxabi" "1n416kv27anabg9jsw6331r28ic30xk46p381lx2vbb2jrhwpafw";
 
   buildInputs = [ cmake ] ++ stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
 
diff --git a/pkgs/development/compilers/llvm/4/lld.nix b/pkgs/development/compilers/llvm/4/lld.nix
index e62e50b2d316..549fa863c151 100644
--- a/pkgs/development/compilers/llvm/4/lld.nix
+++ b/pkgs/development/compilers/llvm/4/lld.nix
@@ -10,7 +10,7 @@
 stdenv.mkDerivation {
   name = "lld-${version}";
 
-  src = fetch "lld" "00wy4qczh4s6g49sbfmyk21845zx5qc2qpm39bznqz8ynpnh4phc";
+  src = fetch "lld" "00km1qawk146pyjqa6aphcdzgkzrmg6cgk0ikg4661ffp5bn9q1k";
 
   buildInputs = [ cmake llvm ];
 
diff --git a/pkgs/development/compilers/llvm/4/lldb.nix b/pkgs/development/compilers/llvm/4/lldb.nix
index 4fec3ad1a894..6e6fdf012dd6 100644
--- a/pkgs/development/compilers/llvm/4/lldb.nix
+++ b/pkgs/development/compilers/llvm/4/lldb.nix
@@ -17,7 +17,7 @@
 stdenv.mkDerivation {
   name = "lldb-${version}";
 
-  src = fetch "lldb" "14dy1j48nw10w8brkpmla2vjjwfr1mrsl9wfabjfx1j85ywp3h69";
+  src = fetch "lldb" "0g83hbw1r4gd0z8hlph9i34xs6dlcc69vz3h2bqwkhb2qq2qzg9d";
 
   patchPhase = ''
     # Fix up various paths that assume llvm and clang are installed in the same place
diff --git a/pkgs/development/compilers/llvm/4/llvm.nix b/pkgs/development/compilers/llvm/4/llvm.nix
index 1470e7d510fa..83a14b7fc4dd 100644
--- a/pkgs/development/compilers/llvm/4/llvm.nix
+++ b/pkgs/development/compilers/llvm/4/llvm.nix
@@ -21,7 +21,7 @@
 }:
 
 let
-  src = fetch "llvm" "1ljb5y5wgypk3sy8zcd5qdgsm5hw8vl7cy6874mbf4gnk9k809b1";
+  src = fetch "llvm" "1giklnw71wzsgbqg9wb5x7dxnbj39m6zpfvskvzvhwvfz4fm244d";
   shlib = if stdenv.isDarwin then "dylib" else "so";
 
   # Used when creating a version-suffixed symlink of libLLVM.dylib
@@ -41,16 +41,18 @@ in stdenv.mkDerivation rec {
   outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
 
   buildInputs = [ perl groff cmake libxml2 python libffi ]
-    ++ stdenv.lib.optionals stdenv.isDarwin
-         [ libcxxabi darwin.cctools darwin.apple_sdk.libs.xpc ];
+    ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];
 
   propagatedBuildInputs = [ ncurses zlib ];
 
-  # hacky fix: New LLVM releases require a newer OS X SDK than
-  # 10.9. This is a temporary measure until nixpkgs darwin support is
-  # updated.
+  # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
+  # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
+  # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
+  # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
+  # a flag and turn the flag off during the stdenv build.
   postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
-    sed -i 's/os_trace(\(.*\)");$/printf(\1\\n");/g' ./projects/compiler-rt/lib/sanitizer_common/sanitizer_mac.cc
+    substituteInPlace ./projects/compiler-rt/cmake/config-ix.cmake \
+      --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
   ''
   # Patch llvm-config to return correct library path based on --link-{shared,static}.
   + stdenv.lib.optionalString (enableSharedLibraries) ''
@@ -85,7 +87,6 @@ in stdenv.mkDerivation rec {
     ++ stdenv.lib.optionals (isDarwin) [
     "-DLLVM_ENABLE_LIBCXX=ON"
     "-DCAN_TARGET_i386=false"
-    "-DCMAKE_LIBTOOL=${darwin.cctools}/bin/libtool"
   ];
 
   postBuild = ''
diff --git a/pkgs/development/compilers/nasm/default.nix b/pkgs/development/compilers/nasm/default.nix
index a30a97ce9ce5..eb090e8b38ad 100644
--- a/pkgs/development/compilers/nasm/default.nix
+++ b/pkgs/development/compilers/nasm/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "nasm-${version}";
-  version = "2.11.08";
+  version = "2.12.02";
 
   src = fetchurl {
     url = "http://www.nasm.us/pub/nasm/releasebuilds/${version}/${name}.tar.bz2";
-    sha256 = "0ialkla6i63j8fpv840jy7k5mdf2wbqr98bvbcq0dp0b38ls18wx";
+    sha256 = "097318bjxvmffbjfd1k89parc04xf5jfxg2rr93581lccwf8kc00";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/compilers/openjdk-darwin/8.nix b/pkgs/development/compilers/openjdk-darwin/8.nix
index 1d12d59998a1..2f3391f70e0d 100644
--- a/pkgs/development/compilers/openjdk-darwin/8.nix
+++ b/pkgs/development/compilers/openjdk-darwin/8.nix
@@ -1,10 +1,16 @@
 { stdenv, fetchurl, unzip, setJavaClassPath, freetype }:
 let
+  jce-policies = fetchurl {
+    # Ugh, unversioned URLs... I hope this doesn't change often enough to cause pain before we move to a Darwin source build of OpenJDK!
+    url    = "http://cdn.azul.com/zcek/bin/ZuluJCEPolicies.zip";
+    sha256 = "0nk7m0lgcbsvldq2wbfni2pzq8h818523z912i7v8hdcij5s48c0";
+  };
+
   jdk = stdenv.mkDerivation {
     name = "zulu1.8.0_66-8.11.0.1";
 
     src = fetchurl {
-      url = http://cdn.azulsystems.com/zulu/bin/zulu1.8.0_66-8.11.0.1-macosx.zip;
+      url = "http://cdn.azulsystems.com/zulu/bin/zulu1.8.0_66-8.11.0.1-macosx.zip";
       sha256 = "0pvbpb3vf0509xm2x1rh0p0w4wmx50zf15604p28z1k8ai1a23sz";
       curlOpts = "-H Referer:https://www.azul.com/downloads/zulu/zulu-linux/";
     };
@@ -15,6 +21,9 @@ let
       mkdir -p $out
       mv * $out
 
+      unzip ${jce-policies}
+      mv -f ZuluJCEPolicies/*.jar $out/jre/lib/security/
+
       # jni.h expects jni_md.h to be in the header search path.
       ln -s $out/include/darwin/*_md.h $out/include/
     '';
diff --git a/pkgs/development/compilers/ponyc/default.nix b/pkgs/development/compilers/ponyc/default.nix
index 2c785d2a721d..e70fee3605b6 100644
--- a/pkgs/development/compilers/ponyc/default.nix
+++ b/pkgs/development/compilers/ponyc/default.nix
@@ -3,13 +3,13 @@
 
 stdenv.mkDerivation ( rec {
   name = "ponyc-${version}";
-  version = "0.10.0";
+  version = "0.11.3";
 
   src = fetchFromGitHub {
     owner = "ponylang";
     repo = "ponyc";
     rev = version;
-    sha256 = "1v314abmhlqsj8iyab61cf8nb4kbddv1ycnw29z53mpbmivk4gn0";
+    sha256 = "08wh8rh17bf043glvn7778bwpxyzpm95kgfll645hf2m65n5ncsh";
   };
 
   buildInputs = [ llvm makeWrapper which ];
diff --git a/pkgs/development/compilers/ponyc/pony-stable.nix b/pkgs/development/compilers/ponyc/pony-stable.nix
index cd4859acec21..6e669c97300c 100644
--- a/pkgs/development/compilers/ponyc/pony-stable.nix
+++ b/pkgs/development/compilers/ponyc/pony-stable.nix
@@ -1,13 +1,13 @@
 {stdenv, fetchFromGitHub, ponyc }:
 
 stdenv.mkDerivation {
-  name = "pony-stable-2016-10-10";
+  name = "pony-stable-unstable-2017-01-03";
 
   src = fetchFromGitHub {
     owner = "jemc";
     repo = "pony-stable";
-    rev = "fdefa26fed93f4ff81c323f29abd47813c515703";
-    sha256 = "16inavy697icgryyvn9gcylgh639xxs7lnbrqdzcryvh0ck15qxk";
+    rev = "0054b429a54818d187100ed40f5525ec7931b31b";
+    sha256 = "0libx8byzwqjjgxxyiiahiprzzp845xgbk09sx9bzban5cd5j0g5";
   };
 
   buildInputs = [ ponyc ];
diff --git a/pkgs/development/compilers/rust/nightlyBin.nix b/pkgs/development/compilers/rust/nightlyBin.nix
index 9916e4555c56..d8d0681a0c24 100644
--- a/pkgs/development/compilers/rust/nightlyBin.nix
+++ b/pkgs/development/compilers/rust/nightlyBin.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, makeWrapper, cacert, zlib, buildRustPackage }:
+{ stdenv, fetchurl, makeWrapper, cacert, zlib, buildRustPackage, curl }:
 
 let
   inherit (stdenv.lib) optionalString;
@@ -9,7 +9,7 @@ let
 
   bootstrapHash =
     if stdenv.system == "x86_64-linux"
-    then "1v7jvwigb29m15wilzcrk5jmlpaccpzbkhlzf7z5qw08320gvc91"
+    then "1d5h34dkm1r1ff562szygn9xk2qll1pjryvypl0lazzanxdh5gv5"
     else throw "missing bootstrap hash for platform ${stdenv.system}";
 
   needsPatchelf = stdenv.isLinux;
@@ -19,7 +19,7 @@ let
      sha256 = bootstrapHash;
   };
 
-  version = "2017-01-26";
+  version = "2017-03-16";
 in
 
 rec {
@@ -69,7 +69,7 @@ rec {
       license = [ licenses.mit licenses.asl20 ];
     };
 
-    buildInputs = [ makeWrapper ];
+    buildInputs = [ makeWrapper curl ];
     phases = ["unpackPhase" "installPhase"];
 
     installPhase = ''
@@ -78,6 +78,7 @@ rec {
 
       ${optionalString needsPatchelf ''
         patchelf \
+          --set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \
           --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
           "$out/bin/cargo"
       ''}
diff --git a/pkgs/development/compilers/scala/default.nix b/pkgs/development/compilers/scala/default.nix
index 8e1f8dd47220..7971d7a8b23d 100644
--- a/pkgs/development/compilers/scala/default.nix
+++ b/pkgs/development/compilers/scala/default.nix
@@ -16,6 +16,10 @@ stdenv.mkDerivation rec {
     rm "bin/"*.bat
     mv * $out
 
+    # put docs in correct subdirectory
+    mkdir -p $out/share/doc
+    mv $out/doc $out/share/doc/scala
+
     for p in $(ls $out/bin/) ; do
       wrapProgram $out/bin/$p \
         --prefix PATH ":" ${coreutils}/bin \
diff --git a/pkgs/development/compilers/souper/cmake-fix.patch b/pkgs/development/compilers/souper/cmake-fix.patch
new file mode 100644
index 000000000000..5ef289f53e93
--- /dev/null
+++ b/pkgs/development/compilers/souper/cmake-fix.patch
@@ -0,0 +1,14 @@
+--- souper-1be75fe6a96993b57dcba038798fe6d1c7d113eb-src/CMakeLists.txt.orig     2017-01-20 13:55:14.783632588 -0600
++++ souper-1be75fe6a96993b57dcba038798fe6d1c7d113eb-src/CMakeLists.txt  2017-01-20 13:55:20.505728456 -0600
+@@ -33,7 +33,10 @@
+   OUTPUT_VARIABLE LLVM_SYSTEM_LIBS
+   OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+-set(LLVM_LIBS "${LLVM_LIBS} ${LLVM_SYSTEM_LIBS}")
++
++if (LLVM_SYSTEM_LIBS)
++  set(LLVM_LIBS "${LLVM_LIBS} ${LLVM_SYSTEM_LIBS}")
++endif()
+
+ execute_process(
+   COMMAND ${LLVM_CONFIG_EXECUTABLE} --ldflags
diff --git a/pkgs/development/compilers/souper/default.nix b/pkgs/development/compilers/souper/default.nix
index 74e1cbf68d30..6ea135ea9906 100644
--- a/pkgs/development/compilers/souper/default.nix
+++ b/pkgs/development/compilers/souper/default.nix
@@ -1,22 +1,22 @@
 { stdenv, fetchFromGitHub, cmake, makeWrapper
-, llvmPackages_39, hiredis, z3_opt, gtest
+, llvmPackages_4, hiredis, z3_opt, gtest
 }:
 
 let
   klee = fetchFromGitHub {
-    owner = "klee";
+    owner = "rsas";
     repo  = "klee";
-    rev   = "a743d7072d9ccf11f96e3df45f25ad07da6ad9d6";
-    sha256 = "0qwzs029vlba8xz362n4b00hdm2z3lzhzmvix1r8kpbfrvs8vv91";
+    rev   = "57cd3d43056b029d9da3c6b3c666c4153554c04f";
+    sha256 = "197wb7nbirlfpx2jr3afpjjhcj7slc4dxxi02j3kmazz9kcqaygz";
   };
 in stdenv.mkDerivation {
-  name = "souper-unstable-2017-01-05";
+  name = "souper-unstable-2017-03-07";
 
   src = fetchFromGitHub {
     owner  = "google";
     repo   = "souper";
-    rev    = "1be75fe6a96993b57dcba038798fe6d1c7d113eb";
-    sha256 = "0r8mjb88lwz9a3syx7gwsxlwfg0krffaml04ggaf3ad0cza2mvm8";
+    rev    = "5faed54ddc4a0e0e12647a0eac1da455a1067a47";
+    sha256 = "1v8ml94ryw5wdls9syvicx4sc9l34yaq8r7cf7is6x7y1q677rps";
   };
 
   nativeBuildInputs = [
@@ -25,12 +25,14 @@ in stdenv.mkDerivation {
   ];
 
   buildInputs = [
-    llvmPackages_39.llvm
-    llvmPackages_39.clang-unwrapped
+    llvmPackages_4.llvm
+    llvmPackages_4.clang-unwrapped
     hiredis
     gtest
   ];
 
+  patches = [ ./cmake-fix.patch ];
+
   enableParallelBuilding = true;
 
   preConfigure = ''
diff --git a/pkgs/development/compilers/tinycc/default.nix b/pkgs/development/compilers/tinycc/default.nix
index 79745d45c2b3..dfbbaa4d4310 100644
--- a/pkgs/development/compilers/tinycc/default.nix
+++ b/pkgs/development/compilers/tinycc/default.nix
@@ -2,10 +2,10 @@
 with stdenv.lib;
 
 let
-  date = "20170220";
+  date = "20170225";
   version = "0.9.27pre-${date}";
-  rev = "e209b7dac463e228525499153103ec28173ca365";
-  sha256 = "1p8h999aqgy5rlkk47vc86c5lx8280761712nwkcgvydvixd0gd6";
+  rev = "bb93064d7857d887b674999c9b4152b44a628f9a";
+  sha256 = "12wcahj1x4qy9ia931i23lvwkqjmyhaks3wipnzvbnlnc2b03kpr";
 in
 
 stdenv.mkDerivation rec {
diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix
index c707592e4ae3..985b4c9b9db1 100644
--- a/pkgs/development/go-modules/generic/default.nix
+++ b/pkgs/development/go-modules/generic/default.nix
@@ -116,6 +116,7 @@ go.stdenv.mkDerivation (
       local d; local cmd;
       cmd="$1"
       d="$2"
+      . $TMPDIR/buildFlagsArray
       echo "$d" | grep -q "\(/_\|examples\|Godeps\)" && return 0
       [ -n "$excludedPackages" ] && echo "$d" | grep -q "$excludedPackages" && return 0
       local OUT
@@ -143,6 +144,11 @@ go.stdenv.mkDerivation (
       fi
     }
 
+    if [ ''${#buildFlagsArray[@]} -ne 0 ]; then
+      declare -p buildFlagsArray > $TMPDIR/buildFlagsArray
+    else
+      touch $TMPDIR/buildFlagsArray
+    fi
     export -f buildGoDir # parallel needs to see the function
     if [ -z "$enableParallelBuilding" ]; then
         export NIX_BUILD_CORES=1
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index f37d8b4c9c7f..85839b6492a2 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -877,4 +877,8 @@ self: super: {
 
   # https://github.com/danidiaz/streaming-eversion/issues/1
   streaming-eversion = dontCheck super.streaming-eversion;
+
+  # strict-io is too cautious with it's deepseq dependency
+  # strict-io doesn't have a working bug tracker, the author has been emailed however.
+  strict-io = doJailbreak super.strict-io;
 }
diff --git a/pkgs/development/haskell-modules/configuration-ghcjs.nix b/pkgs/development/haskell-modules/configuration-ghcjs.nix
index e4a4f74907a8..bea914354de0 100644
--- a/pkgs/development/haskell-modules/configuration-ghcjs.nix
+++ b/pkgs/development/haskell-modules/configuration-ghcjs.nix
@@ -126,7 +126,8 @@ self: super:
   });
 
   ghcjs-dom-jsffi = overrideCabal super.ghcjs-dom-jsffi (drv: {
-    libraryHaskellDepends = [ self.ghcjs-base self.text ];
+    setupHaskellDepends = (drv.setupHaskellDepends or []) ++ [ self.Cabal_1_24_2_0 ];
+    libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ [ self.ghcjs-base self.text ];
     isLibrary = true;
   });
 
diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
index cab70ea6f6d7..b693a55de55f 100644
--- a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
+++ b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
@@ -2248,7 +2248,6 @@ extra-packages:
   - QuickCheck < 2                      # required by test-framework-quickcheck and its users
   - seqid < 0.2                         # newer versions depend on transformers 0.4.x which we cannot provide in GHC 7.8.x
   - seqid-streams < 0.2                 # newer versions depend on transformers 0.4.x which we cannot provide in GHC 7.8.x
-  - servant-auth-server < 0.2.2.0       # https://github.com/plow-technologies/servant-auth/issues/25
   - split < 0.2                         # newer versions don't work with GHC 6.12.3
   - tar < 0.4.2.0                       # later versions don't work with GHC < 7.6.x
   - transformers == 0.4.3.*             # the latest version isn't supported by mtl yet
@@ -7302,8 +7301,6 @@ dont-distribute-packages:
   servant-smsc-ru:                              [ i686-linux, x86_64-linux, x86_64-darwin ]
   servant-snap:                                 [ i686-linux, x86_64-linux, x86_64-darwin ]
   servant-subscriber:                           [ i686-linux, x86_64-linux, x86_64-darwin ]
-  servant-swagger:                              [ i686-linux, x86_64-linux, x86_64-darwin ]
-  servant-swagger-ui:                           [ i686-linux, x86_64-linux, x86_64-darwin ]
   server-generic:                               [ i686-linux, x86_64-linux, x86_64-darwin ]
   serversession-backend-persistent:             [ i686-linux, x86_64-linux, x86_64-darwin ]
   serversession-backend-redis:                  [ i686-linux, x86_64-linux, x86_64-darwin ]
diff --git a/pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix b/pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix
new file mode 100644
index 000000000000..cd7857e23de9
--- /dev/null
+++ b/pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix
@@ -0,0 +1,59 @@
+{ pkgs }:
+
+with import ./lib.nix { inherit pkgs; };
+
+self: super: {
+
+  # Suitable LLVM version.
+  llvmPackages = pkgs.llvmPackages_35;
+
+  # Disable GHC 8.0.x core libraries.
+  array = null;
+  base = null;
+  binary = null;
+  bytestring = null;
+  Cabal = null;
+  containers = null;
+  deepseq = null;
+  directory = null;
+  filepath = null;
+  ghc-boot = null;
+  ghc-boot-th = null;
+  ghc-prim = null;
+  ghci = null;
+  haskeline = null;
+  hoopl = null;
+  hpc = null;
+  integer-gmp = null;
+  pretty = null;
+  process = null;
+  rts = null;
+  template-haskell = null;
+  terminfo = null;
+  time = null;
+  transformers = null;
+  unix = null;
+  xhtml = null;
+
+  # cabal-install can use the native Cabal library.
+  cabal-install = super.cabal-install.override { Cabal = null; };
+
+  # jailbreak-cabal can use the native Cabal library.
+  jailbreak-cabal = super.jailbreak-cabal.override { Cabal = null; };
+
+  # https://github.com/bmillwood/applicative-quoters/issues/6
+  applicative-quoters = appendPatch super.applicative-quoters (pkgs.fetchpatch {
+    url = "https://patch-diff.githubusercontent.com/raw/bmillwood/applicative-quoters/pull/7.patch";
+    sha256 = "026vv2k3ks73jngwifszv8l59clg88pcdr4mz0wr0gamivkfa1zy";
+  });
+
+  # https://github.com/christian-marie/xxhash/issues/3
+  xxhash = doJailbreak super.xxhash;
+
+  # https://github.com/Deewiant/glob/issues/8
+  Glob = doJailbreak super.Glob;
+
+  # http://hub.darcs.net/dolio/vector-algorithms/issue/9#comment-20170112T145715
+  vector-algorithms = dontCheck super.vector-algorithms;
+
+}
diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix
index 85421ba960e8..981a48055bcc 100644
--- a/pkgs/development/haskell-modules/configuration-nix.nix
+++ b/pkgs/development/haskell-modules/configuration-nix.nix
@@ -29,6 +29,17 @@
 
 with import ./lib.nix { inherit pkgs; };
 
+# All of the overrides in this set should look like:
+#
+#   foo = ... something involving super.foo ...
+#
+# but that means that we add `foo` attribute even if there is no `super.foo`! So if
+# you want to use this configuration for a package set that only contains a subset of
+# the packages that have overrides defined here, you'll end up with a set that contains
+# a bunch of attributes that trigger an evaluation error.
+#
+# To avoid this, we use `intersectAttrs` here so we never add packages that are not present
+# in the parent package set (`super`).
 self: super: builtins.intersectAttrs super {
 
   # Apply NixOS-specific patches.
@@ -216,20 +227,19 @@ self: super: builtins.intersectAttrs super {
   # Uses OpenGL in testing
   caramia = dontCheck super.caramia;
 
-  llvm-general-darwin = overrideCabal (super.llvm-general.override { llvm-config = pkgs.llvm_35; }) (drv: {
-      preConfigure = ''
-        sed -i llvm-general.cabal \
-            -e 's,extra-libraries: stdc++,extra-libraries: c++,'
-      '';
-      configureFlags = (drv.configureFlags or []) ++ ["--extra-include-dirs=${pkgs.libcxx}/include/c++/v1"];
-      librarySystemDepends = [ pkgs.libcxx ] ++ drv.librarySystemDepends or [];
-    });
-
-  # Supports only 3.5 for now, https://github.com/bscarlet/llvm-general/issues/142
   llvm-general =
-    if pkgs.stdenv.isDarwin
-    then self.llvm-general-darwin
-    else super.llvm-general.override { llvm-config = pkgs.llvm_35; };
+    # Supports only 3.5 for now, https://github.com/bscarlet/llvm-general/issues/142
+    let base = super.llvm-general.override { llvm-config = pkgs.llvm_35; };
+    in if !pkgs.stdenv.isDarwin then base else overrideCabal base (
+      drv: {
+        preConfigure = ''
+          sed -i llvm-general.cabal \
+              -e 's,extra-libraries: stdc++,extra-libraries: c++,'
+        '';
+        configureFlags = (drv.configureFlags or []) ++ ["--extra-include-dirs=${pkgs.libcxx}/include/c++/v1"];
+        librarySystemDepends = [ pkgs.libcxx ] ++ drv.librarySystemDepends or [];
+      }
+    );
 
   # Needs help finding LLVM.
   spaceprobe = addBuildTool super.spaceprobe self.llvmPackages.llvm;
diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix
index df17c769ea2d..7205f777bcf2 100644
--- a/pkgs/development/haskell-modules/default.nix
+++ b/pkgs/development/haskell-modules/default.nix
@@ -84,7 +84,14 @@ let
         callHackage = name: version: self.callPackage (hackage2nix name version);
 
         # Creates a Haskell package from a source package by calling cabal2nix on the source.
-        callCabal2nix = name: src: self.callPackage (haskellSrc2nix { inherit src name; });
+        callCabal2nix = name: src: args:
+          let
+            # Filter out files other than the cabal file. This ensures
+            # that we don't create new derivations even when the cabal
+            # file hasn't changed.
+            justCabal = builtins.filterSource (path: type: pkgs.lib.hasSuffix ".cabal" path) src;
+            drv = self.callPackage (haskellSrc2nix { inherit name; src = justCabal; }) args;
+          in overrideCabal drv (drv': { inherit src; }); # Restore the desired src.
 
         ghcWithPackages = selectFrom: withPackages (selectFrom self);
 
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index f580de51a35c..42678e342be4 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -66,7 +66,8 @@ let
                        concatStringsSep enableFeature optionalAttrs toUpper;
 
   isGhcjs = ghc.isGhcjs or false;
-  packageDbFlag = if isGhcjs || versionOlder "7.6" ghc.version
+  isHaLVM = ghc.isHaLVM or false;
+  packageDbFlag = if isGhcjs || isHaLVM || versionOlder "7.6" ghc.version
                   then "package-db"
                   else "package-conf";
 
@@ -99,16 +100,15 @@ let
     "--with-ghc-pkg=${ghc.cross.config}-ghc-pkg"
     "--with-gcc=${ghc.cc}"
     "--with-ld=${ghc.ld}"
-    "--hsc2hs-options=--cross-compile"
     "--with-hsc2hs=${nativeGhc}/bin/hsc2hs"
-  ];
+  ] ++ (if isHaLVM then [] else ["--hsc2hs-options=--cross-compile"]);
 
   crossCabalFlagsString =
     stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);
 
   defaultConfigureFlags = [
     "--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
-    "--with-gcc=$CC"            # Clang won't work without that extra information.
+    "--with-gcc=$CC" # Clang won't work without that extra information.
     "--package-db=$packageConfDir"
     (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
     (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
@@ -133,8 +133,9 @@ let
 
   setupCompileFlags = [
     (optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
-    (optionalString (isGhcjs || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
-    (optionalString (versionOlder "7.10" ghc.version) "-threaded") # https://github.com/haskell/cabal/issues/2398
+    (optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
+    # https://github.com/haskell/cabal/issues/2398
+    (optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
   ];
 
   isHaskellPkg = x: (x ? pname) && (x ? version) && (x ? env);
@@ -319,11 +320,10 @@ stdenv.mkDerivation ({
         export NIX_${ghcCommandCaps}="${ghcEnv}/bin/${ghcCommand}"
         export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg"
         export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html"
-        export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/${ghcCommand}-${ghc.version}"
-        ${shellHook}
-      '';
+        '' + (if isHaLVM
+	       then ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/HaLVM-${ghc.version}"''
+	       else ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/${ghcCommand}-${ghc.version}"'') + "${shellHook}";
     };
-
   };
 
   meta = { inherit homepage license platforms; }
diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix
index e04cbe08c2c7..15d66bbd6dc0 100644
--- a/pkgs/development/haskell-modules/with-packages-wrapper.nix
+++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix
@@ -8,7 +8,7 @@
 assert ghcLibdir != null -> (ghc.isGhcjs or false);
 
 # This wrapper works only with GHC 6.12 or later.
-assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs;
+assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs || ghc.isHaLVM;
 
 # It's probably a good idea to include the library "ghc-paths" in the
 # compiler environment, because we have a specially patched version of
@@ -33,13 +33,14 @@ assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs;
 
 let
   isGhcjs       = ghc.isGhcjs or false;
-  ghc761OrLater = isGhcjs || lib.versionOlder "7.6.1" ghc.version;
+  isHaLVM       = ghc.isHaLVM or false;
+  ghc761OrLater = isGhcjs || isHaLVM || lib.versionOlder "7.6.1" ghc.version;
   packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
-  ghcCommand'    = if isGhcjs then "ghcjs" else "ghc";
+  ghcCommand'   = if isGhcjs then "ghcjs" else "ghc";
   crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
   ghcCommand = "${crossPrefix}${ghcCommand'}";
   ghcCommandCaps= lib.toUpper ghcCommand';
-  libDir        = "$out/lib/${ghcCommand}-${ghc.version}";
+  libDir        = if isHaLVM then "$out/lib/HaLVM-${ghc.version}" else "$out/lib/${ghcCommand}-${ghc.version}";
   docDir        = "$out/share/doc/ghc/html";
   packageCfgDir = "${libDir}/package.conf.d";
   paths         = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);
diff --git a/pkgs/development/interpreters/clips/default.nix b/pkgs/development/interpreters/clips/default.nix
new file mode 100644
index 000000000000..cf923d409172
--- /dev/null
+++ b/pkgs/development/interpreters/clips/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "6.30";
+  name = "clips-${version}";
+  src = fetchurl {
+    url = "mirror://sourceforge/clipsrules/CLIPS/6.30/clips_core_source_630.tar.Z";
+    sha256 = "1r0m59l3mk9cwzq3nmyr5qxrlkzp3njls4hfv8ml85dmqh7n3ysy";
+  };
+  buildPhase = ''
+    make -C core -f ../makefiles/makefile.gcc
+  '';
+  installPhase = ''
+    install -D -t $out/bin core/clips
+  '';
+  meta = with stdenv.lib; {
+    description = "A Tool for Building Expert Systems";
+    homepage = "http://www.clipsrules.net/";
+    longDescription = ''
+      Developed at NASA's Johnson Space Center from 1985 to 1996,
+      CLIPS is a rule-based programming language useful for creating
+      expert systems and other programs where a heuristic solution is
+      easier to implement and maintain than an algorithmic solution.
+    '';
+    license = licenses.publicDomain;
+    maintainers = [maintainers.league];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/development/interpreters/clisp/hg.nix b/pkgs/development/interpreters/clisp/hg.nix
index b4930e7d57d6..597f75c46456 100644
--- a/pkgs/development/interpreters/clisp/hg.nix
+++ b/pkgs/development/interpreters/clisp/hg.nix
@@ -5,8 +5,7 @@
 # - full: contains base plus modules in withModules
 { stdenv, fetchhg, libsigsegv, gettext, ncurses, readline, libX11
 , libXau, libXt, pcre, zlib, libXpm, xproto, libXext, xextproto
-, libffi
-, libffcall
+, libffi, libffcall, automake
 , coreutils
 # build options
 , threadSupport ? (stdenv.isi686 || stdenv.isx86_64)
@@ -24,19 +23,20 @@ assert x11Support -> (libX11 != null && libXau != null && libXt != null
   && libXpm != null && xproto != null && libXext != null && xextproto != null);
 
 stdenv.mkDerivation rec {
-  v = "2.50pre20161201";
+  v = "2.50pre20170130";
   name = "clisp-${v}";
 
   src = fetchhg {
     url = "http://hg.code.sf.net/p/clisp/clisp";
-    rev = "536a48";
-    sha256 = "097igsfpn8xipnjapyf5hx6smzh04v4ncskxl747xxn6pgpq813z";
+    rev = "130e74c8ea17";
+    sha256 = "1aqaxskvghc4ipbs3m4syvzn6bzj165zqvjpw0xa696i07vkk19j";
   };
 
   inherit libsigsegv gettext coreutils;
 
   ffcallAvailable = stdenv.isLinux && (libffcall != null);
 
+  nativeBuildInputs = [ automake ]; # sometimes fails otherwise
   buildInputs = [libsigsegv]
   ++ stdenv.lib.optional (gettext != null) gettext
   ++ stdenv.lib.optional (ncurses != null) ncurses
diff --git a/pkgs/development/interpreters/erlang/R14.nix b/pkgs/development/interpreters/erlang/R14.nix
deleted file mode 100644
index 0a93726fc0af..000000000000
--- a/pkgs/development/interpreters/erlang/R14.nix
+++ /dev/null
@@ -1,64 +0,0 @@
-{ stdenv, fetchurl, perl, gnum4, ncurses, openssl
-, makeWrapper, gnused, gawk }:
-
-let version = "14B04"; in
-
-stdenv.mkDerivation {
-  name = "erlang-" + version;
-
-  src = fetchurl {
-    url = "http://www.erlang.org/download/otp_src_R${version}.tar.gz";
-    sha256 = "0vlvjlg8vzcy6inb4vj00bnj0aarvpchzxwhmi492nv31s8kb6q9";
-  };
-
-  buildInputs = [ perl gnum4 ncurses openssl makeWrapper ];
-
-  patchPhase = '' sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure '';
-
-  preConfigure = ''
-    export HOME=$PWD/../
-    sed -e s@/bin/pwd@pwd@g -i otp_build
-  '';
-
-  configureFlags = "--with-ssl=${openssl.dev}";
-
-  hardeningDisable = [ "format" ];
-
-  postInstall = let
-    manpages = fetchurl {
-      url = "http://www.erlang.org/download/otp_doc_man_R${version}.tar.gz";
-      sha256 = "1nh7l7wilyyaxvlwkjxgm3cq7wpd90sk6vxhgpvg7hwai8g52545";
-    };
-  in ''
-    tar xf "${manpages}" -C "$out/lib/erlang"
-    for i in "$out"/lib/erlang/man/man[0-9]/*.[0-9]; do
-      prefix="''${i%/*}"
-      ensureDir "$out/share/man/''${prefix##*/}"
-      ln -s "$i" "$out/share/man/''${prefix##*/}/''${i##*/}erl"
-    done
-  '';
-
-  # Some erlang bin/ scripts run sed and awk
-  postFixup = ''
-    wrapProgram $out/lib/erlang/bin/erl --prefix PATH ":" "${gnused}/bin/"
-    wrapProgram $out/lib/erlang/bin/start_erl --prefix PATH ":" "${gnused}/bin/:${gawk}/bin"
-  '';
-
-  setupHook = ./setup-hook.sh;
-
-  meta = {
-    homepage = "http://www.erlang.org/";
-    description = "Programming language used for massively scalable soft real-time systems";
-
-    longDescription = ''
-      Erlang is a programming language used to build massively scalable
-      soft real-time systems with requirements on high availability.
-      Some of its uses are in telecoms, banking, e-commerce, computer
-      telephony and instant messaging. Erlang's runtime system has
-      built-in support for concurrency, distribution and fault
-      tolerance.
-    '';
-
-    platforms = stdenv.lib.platforms.linux;
-  };
-}
diff --git a/pkgs/development/interpreters/erlang/R16.nix b/pkgs/development/interpreters/erlang/R16.nix
index ed30fe1522bf..e2e0151de371 100644
--- a/pkgs/development/interpreters/erlang/R16.nix
+++ b/pkgs/development/interpreters/erlang/R16.nix
@@ -27,6 +27,11 @@ stdenv.mkDerivation rec {
       ++ optional odbcSupport unixODBC
       ++ optionals stdenv.isDarwin [ Carbon Cocoa ];
 
+  # Clang 4 (rightfully) thinks signed comparisons of pointers with NULL are nonsense
+  prePatch = ''
+    substituteInPlace lib/wx/c_src/wxe_impl.cpp --replace 'temp > NULL' 'temp != NULL'
+  '';
+
   patchPhase = '' sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure '';
 
   preConfigure = ''
diff --git a/pkgs/development/interpreters/erlang/R16B02-8-basho.nix b/pkgs/development/interpreters/erlang/R16B02-8-basho.nix
index 5745ea5d98b3..80f524019df0 100644
--- a/pkgs/development/interpreters/erlang/R16B02-8-basho.nix
+++ b/pkgs/development/interpreters/erlang/R16B02-8-basho.nix
@@ -2,7 +2,7 @@
 , gnused, gawk, makeWrapper
 , odbcSupport ? false, unixODBC ? null
 , wxSupport ? false, mesa ? null, wxGTK ? null, xorg ? null
-, enableDebugInfo ? false 
+, enableDebugInfo ? false
 , Carbon ? null, Cocoa ? null }:
 
 assert wxSupport -> mesa != null && wxGTK != null && xorg != null;
@@ -24,11 +24,16 @@ stdenv.mkDerivation rec {
   debugInfo = enableDebugInfo;
 
   buildInputs =
-    [ perl gnum4 ncurses openssl makeWrapper autoconf264 gcc 
+    [ perl gnum4 ncurses openssl makeWrapper autoconf264 gcc
     ] ++ optional wxSupport [ mesa wxGTK xorg.libX11 ]
       ++ optional odbcSupport [ unixODBC ]
       ++ optionals stdenv.isDarwin [ Carbon Cocoa ];
 
+  # Clang 4 (rightfully) thinks signed comparisons of pointers with NULL are nonsense
+  prePatch = ''
+    substituteInPlace lib/wx/c_src/wxe_impl.cpp --replace 'temp > NULL' 'temp != NULL'
+  '';
+
   patchPhase = '' sed -i "s@/bin/rm@rm@" lib/odbc/configure.in erts/configure.in '';
 
   preConfigure = ''
@@ -36,22 +41,22 @@ stdenv.mkDerivation rec {
     export LANG=C
     export ERL_TOP=$(pwd)
     sed -e s@/bin/pwd@pwd@g -i otp_build
-    sed -e s@"/usr/bin/env escript"@${erlang}/bin/escript@g -i lib/diameter/bin/diameterc 
+    sed -e s@"/usr/bin/env escript"@${erlang}/bin/escript@g -i lib/diameter/bin/diameterc
   '';
 
   configureFlags= [
     "--with-ssl=${openssl.dev}"
-    "--enable-smp-support" 
-    "--enable-threads" 
-    "--enable-kernel-poll" 
-    "--disable-hipe" 
-    "${optionalString odbcSupport "--with-odbc=${unixODBC}"}" 
-    "${optionalString stdenv.isDarwin "--enable-darwin-64bit"}" 
+    "--enable-smp-support"
+    "--enable-threads"
+    "--enable-kernel-poll"
+    "--disable-hipe"
+    "${optionalString odbcSupport "--with-odbc=${unixODBC}"}"
+    "${optionalString stdenv.isDarwin "--enable-darwin-64bit"}"
     "${optionalString stdenv.isLinux "--enable-m64-build"}"
   ];
 
   buildPhase = ''
-    ./otp_build autoconf 
+    ./otp_build autoconf
     ./otp_build setup -a --prefix=$out $configureFlags
   '';
 
@@ -89,7 +94,7 @@ stdenv.mkDerivation rec {
       telephony and instant messaging. Erlang's runtime system has
       built-in support for concurrency, distribution and fault
       tolerance.
-      This version of Erlang is Basho's version, forked from Ericsson's 
+      This version of Erlang is Basho's version, forked from Ericsson's
       repository.
     '';
 
diff --git a/pkgs/development/interpreters/erlang/R17.nix b/pkgs/development/interpreters/erlang/R17.nix
index 57323a587f81..0869285d4965 100644
--- a/pkgs/development/interpreters/erlang/R17.nix
+++ b/pkgs/development/interpreters/erlang/R17.nix
@@ -35,7 +35,12 @@ stdenv.mkDerivation rec {
       ++ optional javacSupport openjdk
       ++ stdenv.lib.optionals stdenv.isDarwin [ Carbon Cocoa ];
 
-  patchPhase = '' sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure '';
+  patchPhase = ''
+    # Clang 4 (rightfully) thinks signed comparisons of pointers with NULL are nonsense
+    substituteInPlace lib/wx/c_src/wxe_impl.cpp --replace 'temp > NULL' 'temp != NULL'
+
+    sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure
+  '';
 
   debugInfo = enableDebugInfo;
 
diff --git a/pkgs/development/interpreters/erlang/R18.nix b/pkgs/development/interpreters/erlang/R18.nix
index f9b6edc3fa4b..1ed9bfbd70a2 100644
--- a/pkgs/development/interpreters/erlang/R18.nix
+++ b/pkgs/development/interpreters/erlang/R18.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchFromGitHub, perl, gnum4, ncurses, openssl
+{ stdenv, fetchurl, fetchpatch, fetchFromGitHub, perl, gnum4, ncurses, openssl
 , gnused, gawk, autoconf, libxslt, libxml2, makeWrapper
 , Carbon, Cocoa
 , odbcSupport ? false, unixODBC ? null
@@ -53,6 +53,11 @@ stdenv.mkDerivation rec {
      sha256 = "10h5348p6g279b4q01i5jdqlljww5chcvrx5b4b0dv79pk0p0m9f";
   };
 
+  # Clang 4 (rightfully) thinks signed comparisons of pointers with NULL are nonsense
+  prePatch = ''
+    substituteInPlace lib/wx/c_src/wxe_impl.cpp --replace 'temp > NULL' 'temp != NULL'
+  '';
+
   patches = [
     rmAndPwdPatch
     envAndCpPatch
diff --git a/pkgs/development/interpreters/erlang/R19.nix b/pkgs/development/interpreters/erlang/R19.nix
index fc9db7d9bfb6..4b1e3f4cb2f9 100644
--- a/pkgs/development/interpreters/erlang/R19.nix
+++ b/pkgs/development/interpreters/erlang/R19.nix
@@ -21,7 +21,7 @@ with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "erlang-" + version + "${optionalString odbcSupport "-odbc"}"
   + "${optionalString javacSupport "-javac"}";
-  version = "19.2.3";
+  version = "19.3";
 
   # Minor OTP releases are not always released as tarbals at
   # http://erlang.org/download/ So we have to download from
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     owner = "erlang";
     repo = "otp";
     rev = "OTP-${version}";
-    sha256 = "1lsmjpz2g4hj44fz95w7sswzj40iv7jq5jk64x0095lhvxmlf57c";
+    sha256 = "0pp2hl8jf4iafpnsmf0q7jbm313daqzif6ajqcmjyl87m5pssr86";
   };
 
   buildInputs =
@@ -46,6 +46,9 @@ stdenv.mkDerivation rec {
   prePatch = ''
     substituteInPlace configure.in \
       --replace '`sw_vers -productVersion`' '10.10'
+
+    # Clang 4 (rightfully) thinks signed comparisons of pointers with NULL are nonsense
+    substituteInPlace lib/wx/c_src/wxe_impl.cpp --replace 'temp > NULL' 'temp != NULL'
   '';
 
   preConfigure = ''
@@ -92,7 +95,7 @@ stdenv.mkDerivation rec {
     '';
 
     platforms = platforms.unix;
-    maintainers = with maintainers; [ the-kenny sjmackenzie couchemar ];
+    maintainers = with maintainers; [ yurrriq couchemar DerTim1 mdaiter ];
     license = licenses.asl20;
   };
 }
diff --git a/pkgs/development/interpreters/guile/2.0.nix b/pkgs/development/interpreters/guile/2.0.nix
new file mode 100644
index 000000000000..04f31dda26a0
--- /dev/null
+++ b/pkgs/development/interpreters/guile/2.0.nix
@@ -0,0 +1,120 @@
+{ fetchurl, stdenv, libtool, readline, gmp, pkgconfig, boehmgc, libunistring
+, libffi, gawk, makeWrapper, fetchpatch, coverageAnalysis ? null, gnu ? null }:
+
+# Do either a coverage analysis build or a standard build.
+(if coverageAnalysis != null
+ then coverageAnalysis
+ else stdenv.mkDerivation)
+
+(rec {
+  name = "guile-2.0.13";
+
+  src = fetchurl {
+    url = "mirror://gnu/guile/${name}.tar.xz";
+    sha256 = "12yqkr974y91ylgw6jnmci2v90i90s7h9vxa4zk0sai8vjnz4i1p";
+  };
+
+  outputs = [ "out" "dev" "info" ];
+  setOutputFlags = false; # $dev gets into the library otherwise
+
+  nativeBuildInputs = [ makeWrapper gawk pkgconfig ];
+  buildInputs = [ readline libtool libunistring libffi ];
+  propagatedBuildInputs = [ gmp boehmgc ]
+
+    # XXX: These ones aren't normally needed here, but since
+    # `libguile-2.0.la' reads `-lltdl -lunistring', adding them here will add
+    # the needed `-L' flags.  As for why the `.la' file lacks the `-L' flags,
+    # see below.
+    ++ [ libtool libunistring ];
+
+  # A native Guile 2.0 is needed to cross-build Guile.
+  selfNativeBuildInput = true;
+
+  enableParallelBuilding = true;
+
+  patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ./clang.patch
+    (fetchpatch {
+      # Fixes stability issues with 00-repl-server.test
+      url = "http://git.savannah.gnu.org/cgit/guile.git/patch/?id=2fbde7f02adb8c6585e9baf6e293ee49cd23d4c4";
+      sha256 = "0p6c1lmw1iniq03z7x5m65kg3lq543kgvdb4nrxsaxjqf3zhl77v";
+    })
+  ] ++
+    (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch);
+
+  # Explicitly link against libgcc_s, to work around the infamous
+  # "libgcc_s.so.1 must be installed for pthread_cancel to work".
+
+  # don't have "libgcc_s.so.1" on darwin
+  LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
+
+  configureFlags = [ "--with-libreadline-prefix" ]
+    ++ stdenv.lib.optionals stdenv.isSunOS [
+      # Make sure the right <gmp.h> is found, and not the incompatible
+      # /usr/include/mp.h from OpenSolaris.  See
+      # <https://lists.gnu.org/archive/html/hydra-users/2012-08/msg00000.html>
+      # for details.
+      "--with-libgmp-prefix=${gmp.dev}"
+
+      # Same for these (?).
+      "--with-libreadline-prefix=${readline.dev}"
+      "--with-libunistring-prefix=${libunistring}"
+
+      # See below.
+      "--without-threads"
+    ];
+
+  postInstall = ''
+    wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"
+
+    # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for
+    # why `--with-libunistring-prefix' and similar options coming from
+    # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64.
+    sed -i "$out/lib/pkgconfig/guile-2.0.pc"    \
+        -e "s|-lunistring|-L${libunistring}/lib -lunistring|g ;
+            s|^Cflags:\(.*\)$|Cflags: -I${libunistring}/include \1|g ;
+            s|-lltdl|-L${libtool.lib}/lib -lltdl|g ;
+            s|includedir=$out|includedir=$dev|g
+            "
+  '';
+
+  # make check doesn't work on darwin
+  # On Linuxes+Hydra the tests are flaky; feel free to investigate deeper.
+  doCheck = false;
+
+  setupHook = ./setup-hook-2.0.sh;
+
+  crossAttrs.preConfigure =
+    stdenv.lib.optionalString (stdenv.cross.config == "i586-pc-gnu")
+       # On GNU, libgc depends on libpthread, but the cross linker doesn't
+       # know where to find libpthread, which leads to erroneous test failures
+       # in `configure', where `-pthread' and `-lpthread' aren't explicitly
+       # passed.  So it needs some help (XXX).
+       "export LDFLAGS=-Wl,-rpath-link=${gnu.libpthreadCross}/lib";
+
+
+  meta = {
+    description = "Embeddable Scheme implementation";
+    homepage    = http://www.gnu.org/software/guile/;
+    license     = stdenv.lib.licenses.lgpl3Plus;
+    maintainers = with stdenv.lib.maintainers; [ ludo lovek323 ];
+    platforms   = stdenv.lib.platforms.all;
+
+    longDescription = ''
+      GNU Guile is an implementation of the Scheme programming language, with
+      support for many SRFIs, packaged for use in a wide variety of
+      environments.  In addition to implementing the R5RS Scheme standard
+      and a large subset of R6RS, Guile includes a module system, full access
+      to POSIX system calls, networking support, multiple threads, dynamic
+      linking, a foreign function call interface, and powerful string
+      processing.
+    '';
+  };
+})
+
+//
+
+(stdenv.lib.optionalAttrs (!stdenv.isLinux) {
+  # Work around <http://bugs.gnu.org/14201>.
+  SHELL = "/bin/sh";
+  CONFIG_SHELL = "/bin/sh";
+})
diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix
index 6b4e6c2a7288..8a2deeddff60 100644
--- a/pkgs/development/interpreters/guile/default.nix
+++ b/pkgs/development/interpreters/guile/default.nix
@@ -7,11 +7,12 @@
  else stdenv.mkDerivation)
 
 (rec {
-  name = "guile-2.0.13";
+  name = "guile-${version}";
+  version = "2.2.0";
 
   src = fetchurl {
     url = "mirror://gnu/guile/${name}.tar.xz";
-    sha256 = "12yqkr974y91ylgw6jnmci2v90i90s7h9vxa4zk0sai8vjnz4i1p";
+    sha256 = "05dmvhd1y135x7w5qfw4my42cfp6l8bbhjfxvchcc1cbdvzri0f1";
   };
 
   outputs = [ "out" "dev" "info" ];
@@ -30,16 +31,10 @@
   # A native Guile 2.0 is needed to cross-build Guile.
   selfNativeBuildInput = true;
 
-  # Guile 2.0.11 repeatable fails with 8-core parallel building because
-  # libguile/vm-i-system.i is not created in time
-  enableParallelBuilding = false;
+  enableParallelBuilding = true;
 
-  patches = [ ./disable-gc-sensitive-tests.patch ./eai_system.patch ./clang.patch
-    (fetchpatch {
-      # Fixes stability issues with 00-repl-server.test
-      url = "http://git.savannah.gnu.org/cgit/guile.git/patch/?id=2fbde7f02adb8c6585e9baf6e293ee49cd23d4c4";
-      sha256 = "0p6c1lmw1iniq03z7x5m65kg3lq543kgvdb4nrxsaxjqf3zhl77v";
-    })
+  patches = [
+    ./eai_system.patch
   ] ++
     (stdenv.lib.optional (coverageAnalysis != null) ./gcov-file-name.patch);
 
@@ -49,7 +44,7 @@
   # don't have "libgcc_s.so.1" on darwin
   LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
 
-  configureFlags = [ "--with-libreadline-prefix" ]
+  configureFlags = [ "--with-libreadline-prefix=${readline.dev}" ]
     ++ stdenv.lib.optionals stdenv.isSunOS [
       # Make sure the right <gmp.h> is found, and not the incompatible
       # /usr/include/mp.h from OpenSolaris.  See
@@ -58,7 +53,6 @@
       "--with-libgmp-prefix=${gmp.dev}"
 
       # Same for these (?).
-      "--with-libreadline-prefix=${readline.dev}"
       "--with-libunistring-prefix=${libunistring}"
 
       # See below.
@@ -71,7 +65,7 @@
     # XXX: See http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903 for
     # why `--with-libunistring-prefix' and similar options coming from
     # `AC_LIB_LINKFLAGS_BODY' don't work on NixOS/x86_64.
-    sed -i "$out/lib/pkgconfig/guile-2.0.pc"    \
+    sed -i "$out/lib/pkgconfig/guile-2.2.pc"    \
         -e "s|-lunistring|-L${libunistring}/lib -lunistring|g ;
             s|^Cflags:\(.*\)$|Cflags: -I${libunistring}/include \1|g ;
             s|-lltdl|-L${libtool.lib}/lib -lltdl|g ;
@@ -83,7 +77,7 @@
   # On Linuxes+Hydra the tests are flaky; feel free to investigate deeper.
   doCheck = false;
 
-  setupHook = ./setup-hook-2.0.sh;
+  setupHook = ./setup-hook-2.2.sh;
 
   crossAttrs.preConfigure =
     stdenv.lib.optionalString (stdenv.cross.config == "i586-pc-gnu")
@@ -98,7 +92,7 @@
     description = "Embeddable Scheme implementation";
     homepage    = http://www.gnu.org/software/guile/;
     license     = stdenv.lib.licenses.lgpl3Plus;
-    maintainers = with stdenv.lib.maintainers; [ ludo lovek323 ];
+    maintainers = with stdenv.lib.maintainers; [ ludo lovek323 vrthra ];
     platforms   = stdenv.lib.platforms.all;
 
     longDescription = ''
@@ -113,10 +107,3 @@
   };
 })
 
-//
-
-(stdenv.lib.optionalAttrs (!stdenv.isLinux) {
-  # Work around <http://bugs.gnu.org/14201>.
-  SHELL = "/bin/sh";
-  CONFIG_SHELL = "/bin/sh";
-})
diff --git a/pkgs/development/interpreters/guile/setup-hook-2.2.sh b/pkgs/development/interpreters/guile/setup-hook-2.2.sh
new file mode 100644
index 000000000000..86c1e0d3e4a9
--- /dev/null
+++ b/pkgs/development/interpreters/guile/setup-hook-2.2.sh
@@ -0,0 +1,13 @@
+addGuileLibPath () {
+    if test -d "$1/share/guile/site/2.2"
+    then
+        export GUILE_LOAD_PATH="${GUILE_LOAD_PATH}${GUILE_LOAD_PATH:+:}$1/share/guile/site/2.2"
+        export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH}${GUILE_LOAD_COMPILED_PATH:+:}$1/share/guile/site/2.2"
+    elif test -d "$1/share/guile/site"
+    then
+        export GUILE_LOAD_PATH="${GUILE_LOAD_PATH}${GUILE_LOAD_PATH:+:}$1/share/guile/site"
+        export GUILE_LOAD_COMPILED_PATH="${GUILE_LOAD_COMPILED_PATH}${GUILE_LOAD_COMPILED_PATH:+:}$1/share/guile/site"
+    fi
+}
+
+envHooks+=(addGuileLibPath)
diff --git a/pkgs/development/interpreters/lua-5/5.2.darwin.patch b/pkgs/development/interpreters/lua-5/5.2.darwin.patch
index b314bd2abac3..be0e206bbfc7 100644
--- a/pkgs/development/interpreters/lua-5/5.2.darwin.patch
+++ b/pkgs/development/interpreters/lua-5/5.2.darwin.patch
@@ -15,8 +15,8 @@ index d2c7db4..dc107b3 100644
  	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
  	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
  	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
-+	ln -s -f liblua.${version}.dylib $(INSTALL_LIB)/liblua.${majorVersion}.dylib
-+	ln -s -f liblua.${majorVersion}.dylib $(INSTALL_LIB)/liblua.dylib
++	ln -s -f liblua.${version}.dylib $(INSTALL_LIB)/liblua.${luaversion}.dylib
++	ln -s -f liblua.${luaversion}.dylib $(INSTALL_LIB)/liblua.dylib
  
  uninstall:
  	cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
diff --git a/pkgs/development/interpreters/pure/default.nix b/pkgs/development/interpreters/pure/default.nix
index c471a3cdc0fb..133329f4f203 100644
--- a/pkgs/development/interpreters/pure/default.nix
+++ b/pkgs/development/interpreters/pure/default.nix
@@ -4,13 +4,13 @@
 stdenv.mkDerivation rec {
   baseName="pure";
   project="pure-lang";
-  version="0.64";
+  version="0.66";
   name="${baseName}-${version}";
   extension="tar.gz";
 
   src = fetchurl {
     url="https://bitbucket.org/purelang/${project}/downloads/${name}.${extension}";
-    sha256="01vvix302gh5vsmnjf2g0rrif3hl1yik4izsx1wrvv1a6hlm5mgg";
+    sha256="42df6832476e8bee3a7ca179671284c1edd7bc82b71062fa0de62fd2117ee676";
   };
 
   buildInputs = [ bison flex makeWrapper ];
diff --git a/pkgs/development/interpreters/renpy/default.nix b/pkgs/development/interpreters/renpy/default.nix
index 57051bb951fc..0d0cbbab2b52 100644
--- a/pkgs/development/interpreters/renpy/default.nix
+++ b/pkgs/development/interpreters/renpy/default.nix
@@ -1,33 +1,37 @@
-{ stdenv, fetchurl, pythonPackages, pkgconfig, SDL
+{ stdenv, fetchurl, pythonPackages, pkgconfig, SDL2
 , libpng, ffmpeg, freetype, glew, mesa, fribidi, zlib
+, glib
 }:
 
 with pythonPackages;
 
 stdenv.mkDerivation {
-  name = "renpy-6.17.6";
+  name = "renpy-6.99.12.4";
 
   meta = {
     description = "Ren'Py Visual Novel Engine";
     homepage = "http://renpy.org/";
     license = stdenv.lib.licenses.mit;
     platforms = stdenv.lib.platforms.linux;
+    # This is an ancient version, last updated in 2014 (3d59f42ce); it fails to
+    # build with the most recent pygame version, and fails to run with 1.9.1.
+    broken = true;
   };
 
   src = fetchurl {
-    url = "http://www.renpy.org/dl/6.17.6/renpy-6.17.6-source.tar.bz2";
-    sha256 = "0rkynw9cnr1zqdinz037d9zig6grhp2ca2pyxk80vhdpjb0xrkic";
+    url = "http://www.renpy.org/dl/6.99.12.4/renpy-6.99.12.4-source.tar.bz2";
+    sha256 = "035342rr39zp7krp08z0xhcl73gqbqyilshgmljq0ynfrxxckn35";
   };
 
   buildInputs = [
     python cython pkgconfig wrapPython
-    SDL libpng ffmpeg freetype glew mesa fribidi zlib pygame
+    SDL2 libpng ffmpeg freetype glew mesa fribidi zlib pygame_sdl2 glib
   ];
 
-  pythonPath = [ pygame ];
+  pythonPath = [ pygame_sdl2 ];
 
   RENPY_DEPS_INSTALL = stdenv.lib.concatStringsSep "::" (map (path: "${path}") [
-    SDL SDL.dev libpng ffmpeg ffmpeg.out freetype glew.dev glew.out mesa fribidi zlib
+    SDL2 SDL2.dev libpng ffmpeg ffmpeg.out freetype glew.dev glew.out mesa fribidi zlib
   ]);
 
   buildPhase = ''
@@ -39,12 +43,11 @@ stdenv.mkDerivation {
     cp -r renpy renpy.py $out/share/renpy
     python module/setup.py install --prefix=$out --install-lib=$out/share/renpy/module
 
-    wrapPythonPrograms
     makeWrapper ${python}/bin/python $out/bin/renpy \
-      --set PYTHONPATH $program_PYTHONPATH \
+      --set PYTHONPATH $PYTHONPATH \
       --set RENPY_BASE $out/share/renpy \
       --add-flags "-O $out/share/renpy/renpy.py"
   '';
 
-  NIX_CFLAGS_COMPILE = "-I${pygame}/include/${python.libPrefix}";
+  NIX_CFLAGS_COMPILE = "-I${pygame_sdl2}/include/${python.libPrefix}";
 }
diff --git a/pkgs/development/interpreters/ruby/rubygems-src.nix b/pkgs/development/interpreters/ruby/rubygems-src.nix
index 7ea52185d77b..7658c303a1e9 100644
--- a/pkgs/development/interpreters/ruby/rubygems-src.nix
+++ b/pkgs/development/interpreters/ruby/rubygems-src.nix
@@ -1,6 +1,6 @@
 { fetchurl
-, version ? "2.6.8"
-, sha256 ? "1v6n6s8cq5l0xyf1fbm1w4752b9vdk3p130ar59ig72p9vqvkbl1"
+, version ? "2.6.10"
+, sha256 ? "364c0eee8e0c9e8ab4879c5035832e5a27f0c97292d2264af5ae0020585280f0"
 }:
 fetchurl {
   url = "http://production.cf.rubygems.org/rubygems/rubygems-${version}.tgz";
diff --git a/pkgs/development/libraries/CGAL/default.nix b/pkgs/development/libraries/CGAL/default.nix
index b8fd4af812ab..e4eb8d3ab2ec 100644
--- a/pkgs/development/libraries/CGAL/default.nix
+++ b/pkgs/development/libraries/CGAL/default.nix
@@ -1,25 +1,27 @@
-{ stdenv, fetchurl, cmake, boost, gmp, mpfr, mesa_glu }:
+{ stdenv, fetchFromGitHub, cmake, boost, gmp, mpfr }:
 
 stdenv.mkDerivation rec {
-  version = "4.7";
+  version = "4.9";
   name = "cgal-" + version;
 
-  src = fetchurl {
-    url = "https://github.com/CGAL/releases/archive/CGAL-${version}.tar.gz";
-    sha256 = "1hbp4qpfqvpggvv79yxr6z3w7y0nwd31zavb1s57y55yl9z3zfxy";
+  src = fetchFromGitHub {
+    owner = "CGAL";
+    repo = "releases";
+    rev = "CGAL-${version}";
+    sha256 = "044amgml1x5h17rpkck2azmxrmjvlzzykv71cjh5hlajsi88cid5";
   };
 
   # note: optional component libCGAL_ImageIO would need zlib and opengl;
   #   there are also libCGAL_Qt{3,4} omitted ATM
-  buildInputs = [ cmake boost gmp mpfr ];
-  #propagatedBuildInputs = [ mesa_glu ];
+  buildInputs = [ boost gmp mpfr ];
+  nativeBuildInputs = [ cmake ];
 
   doCheck = false;
 
   meta = with stdenv.lib; {
     description = "Computational Geometry Algorithms Library";
     homepage = http://cgal.org;
-    license = licenses.gpl3Plus; # some parts are GPLv3+, some are LGPLv3+
+    license = with licenses; [ gpl3Plus lgpl3Plus];
     platforms = platforms.all;
     maintainers = [ maintainers.raskin ];
   };
diff --git a/pkgs/development/libraries/CoinMP/default.nix b/pkgs/development/libraries/CoinMP/default.nix
index 079c0a5cf6f7..ea72bfb434b8 100644
--- a/pkgs/development/libraries/CoinMP/default.nix
+++ b/pkgs/development/libraries/CoinMP/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "CoinMP-${version}";
-  version = "1.7.6";
+  version = "1.8.3";
 
   src = fetchurl {
     url = "http://www.coin-or.org/download/source/CoinMP/${name}.tgz";
-    sha256 = "0gqi2vqkg35gazzzv8asnhihchnbjcd6bzjfzqhmj7wy1dw9iiw6";
+    sha256 = "1xr2iwbbhm6l9hwiry5c10pz46xfih8bvzrzwp0nkzf76vdnb9m1";
   };
 
   hardeningDisable = [ "format" ];
diff --git a/pkgs/development/libraries/SDL2_gfx/default.nix b/pkgs/development/libraries/SDL2_gfx/default.nix
index 1d26fed805eb..cee0a81ccfbd 100644
--- a/pkgs/development/libraries/SDL2_gfx/default.nix
+++ b/pkgs/development/libraries/SDL2_gfx/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ SDL2 ];
 
-  configureFlags = [ "--enable-mmx" ];
+  configureFlags = if stdenv.isi686 || stdenv.isx86_64 then "--enable-mmx" else "--disable-mmx";
 
   meta = with stdenv.lib; {
     description = "SDL graphics drawing primitives and support functions";
diff --git a/pkgs/development/libraries/SDL2_mixer/default.nix b/pkgs/development/libraries/SDL2_mixer/default.nix
index 0919970543c5..9fef76c799b9 100644
--- a/pkgs/development/libraries/SDL2_mixer/default.nix
+++ b/pkgs/development/libraries/SDL2_mixer/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, SDL2, libogg, libvorbis, enableNativeMidi ? false }:
+{ stdenv, lib, fetchurl, SDL2, libogg, libvorbis, smpeg, flac, enableNativeMidi ? false, fluidsynth ? null }:
 
 stdenv.mkDerivation rec {
   name = "SDL2_mixer-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "0pv9jzjpcjlbiaybvwrb4avmv46qk7iqxlnqrd2dfj82c4mgc92s";
   };
 
-  propagatedBuildInputs = [ SDL2 libogg libvorbis ];
+  propagatedBuildInputs = [ SDL2 libogg libvorbis fluidsynth smpeg flac ];
 
   configureFlags = [ "--disable-music-ogg-shared" ] ++ lib.optional enableNativeMidi "--enable-music-native-midi-gpl";
 
@@ -17,6 +17,7 @@ stdenv.mkDerivation rec {
     description = "SDL multi-channel audio mixer library";
     platforms = platforms.linux;
     homepage = "https://www.libsdl.org/projects/SDL_mixer/";
+    maintainers = with maintainers; [ MP2E ];
     license = licenses.zlib;
   };
 }
diff --git a/pkgs/development/libraries/ace/default.nix b/pkgs/development/libraries/ace/default.nix
index 10ba217175c3..9bc714c5538b 100644
--- a/pkgs/development/libraries/ace/default.nix
+++ b/pkgs/development/libraries/ace/default.nix
@@ -1,17 +1,18 @@
-{ stdenv, fetchurl, pkgconfig, libtool, perl
-}:
+{ stdenv, fetchurl, pkgconfig, libtool, perl }:
 
 stdenv.mkDerivation rec {
   name = "ace-${version}";
-  version = "6.3.3";
+  version = "6.4.2";
+
   src = fetchurl {
-    url=http://download.dre.vanderbilt.edu/previous_versions/ACE-6.3.3.tar.bz2;
-    sha256 = "124qk205v8rx8p7rfigsargrpxjx3mh4nr99nlyk9csdc9gy8qpk";
+    url = "http://download.dre.vanderbilt.edu/previous_versions/ACE-${version}.tar.bz2";
+    sha256 = "0dscvlgxy0fwma63azjkdbc85mh8k751ik67s88w6w75j0psld73";
   };
 
   enableParallelBuilding = true;
 
-  buildInputs = [ pkgconfig libtool perl ];
+  nativeBuildInputs = [ pkgconfig libtool ];
+  buildInputs = [ perl ];
 
   patchPhase = ''substituteInPlace ./MPC/prj_install.pl \
     --replace /usr/bin/perl "${perl}/bin/perl"'';
@@ -25,12 +26,11 @@ stdenv.mkDerivation rec {
     > include/makeinclude/platform_macros.GNU
   '';
 
-meta = {
+  meta = with stdenv.lib; {
     description = "ADAPTIVE Communication Environment";
     homepage = http://www.dre.vanderbilt.edu/~schmidt/ACE.html;
-    license = stdenv.lib.licenses.doc;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.nico202 ];
+    license = licenses.doc;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.nico202 ];
   };
 }
-
diff --git a/pkgs/development/libraries/appstream/default.nix b/pkgs/development/libraries/appstream/default.nix
index 302d63aa7596..d2b605c4f19c 100644
--- a/pkgs/development/libraries/appstream/default.nix
+++ b/pkgs/development/libraries/appstream/default.nix
@@ -1,24 +1,32 @@
-{ stdenv, fetchurl, cmake, pkgconfig, gettext, intltool
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, gettext, intltool
 , xmlto, docbook_xsl, docbook_xml_dtd_45
 , glib, xapian, libxml2, libyaml, gobjectIntrospection
+, pcre, itstool
 }:
 
-stdenv.mkDerivation {
-  name = "appstream-0.9.5";
+stdenv.mkDerivation rec {
+  name = "appstream-${version}";
+  version = "0.10.6";
 
-  src = fetchurl {
-    url = "https://github.com/ximion/appstream/archive/APPSTREAM_0_8_0.tar.gz";
-    sha256 = "16a3b38avrwyl1pp8jdgfjv6cd5mccbmk4asni92l40y5r0xfycr";
+  src = fetchFromGitHub {
+    owner = "ximion";
+    repo = "appstream";
+    rev = "APPSTREAM_0_10_6";
+    sha256 = "1fg7zxx2qhkyj7fmcpwbf80b72d16kyi8dadi111kf00sgzfbiyy";
   };
 
   nativeBuildInputs = [
     cmake pkgconfig gettext intltool
     xmlto docbook_xsl docbook_xml_dtd_45
-    gobjectIntrospection
+    gobjectIntrospection itstool
   ];
 
-  buildInputs = [ glib xapian libxml2 libyaml ];
+  buildInputs = [ pcre glib xapian libxml2 libyaml ];
 
+  cmakeFlags = ''
+    -DSTEMMING=off
+    '';
+      
   meta = with stdenv.lib; {
     description = "Software metadata handling library";
     homepage    = "http://www.freedesktop.org/wiki/Distributions/AppStream/Software/";
diff --git a/pkgs/development/libraries/aqbanking/sources.nix b/pkgs/development/libraries/aqbanking/sources.nix
index f53d9a9e26f1..1638c72e95f5 100644
--- a/pkgs/development/libraries/aqbanking/sources.nix
+++ b/pkgs/development/libraries/aqbanking/sources.nix
@@ -1,12 +1,12 @@
 # This file is autogenerated from update.sh in the same directory.
 {
-  gwenhywfar.version = "4.15.3";
-  gwenhywfar.sha256 = "0fp67s932x66xfljb26zbrn8ambbc5y5c3hllr6l284nr63qf3ka";
-  gwenhywfar.releaseId = "201";
+  gwenhywfar.version = "4.17.0";
+  gwenhywfar.sha256 = "1z9bm2r407x8vxk2nk6pndx0zhlk32j65z472ljkgjbh56mgzz8i";
+  gwenhywfar.releaseId = "205";
   libchipcard.version = "5.0.4";
   libchipcard.sha256 = "0fj2h39ll4kiv28ch8qgzdbdbnzs8gl812qnm660bw89rynpjnnj";
   libchipcard.releaseId = "200";
-  aqbanking.version = "5.6.10";
-  aqbanking.sha256 = "1x0isvpk43rq2zlyyb9p0kgjmqv7yq07vgkiprw3f5sjkykvxw6d";
-  aqbanking.releaseId = "206";
+  aqbanking.version = "5.6.12";
+  aqbanking.sha256 = "08jbwmiv6f3v8iqdr44x4szna496fqcjfi6mlx04cnbx91m70lh6";
+  aqbanking.releaseId = "208";
 }
diff --git a/pkgs/development/libraries/aqbanking/update.sh b/pkgs/development/libraries/aqbanking/update.sh
index 2ba0192cbb64..8929e8bc6eb4 100755
--- a/pkgs/development/libraries/aqbanking/update.sh
+++ b/pkgs/development/libraries/aqbanking/update.sh
@@ -13,7 +13,7 @@ getCurrentVersions() {
 currentVersions="$(getCurrentVersions)"
 
 getLastestVersion() {
-    local baseurl="http://www.aquamaniac.de"
+    local baseurl="https://www.aquamaniac.de"
     local pkglist="sites/download/packages.php?package=$1&showall=1"
     local url="$baseurl/$pkglist"
     local reVersion='[0-9]+(\.[0-9]+)+' # Only release versions, no betas!
diff --git a/pkgs/development/libraries/armadillo/default.nix b/pkgs/development/libraries/armadillo/default.nix
index 7f173b211565..d5a601f09ba0 100644
--- a/pkgs/development/libraries/armadillo/default.nix
+++ b/pkgs/development/libraries/armadillo/default.nix
@@ -1,24 +1,25 @@
 { stdenv, fetchurl, cmake, openblasCompat, superlu, hdf5 }:
 
 stdenv.mkDerivation rec {
-  version = "7.700.0";
+  version = "7.800.1";
   name = "armadillo-${version}";
 
   src = fetchurl {
     url = "mirror://sourceforge/arma/armadillo-${version}.tar.xz";
-    sha256 = "152x274hd3f59xgd27k9d3ikwb3w62v1v5hpw4lp1yzdyy8980pr";
+    sha256 = "1nxq2jp4jlvinynv0l04rpdzpnkzdsng0d5vi3hilc0hlsjnbnjs";
   };
 
-  buildInputs = [ cmake openblasCompat superlu hdf5 ];
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ openblasCompat superlu hdf5 ];
 
   cmakeFlags = [ "-DDETECT_HDF5=ON" ];
 
-  patches = [ ./use-unix-config-on-OS-X.patch ];
-  
+ patches = [ ./use-unix-config-on-OS-X.patch ];
+
   meta = with stdenv.lib; {
     description = "C++ linear algebra library";
     homepage = http://arma.sourceforge.net;
-    license = licenses.mpl20;
+    license = licenses.asl20;
     platforms = platforms.unix;
     maintainers = with maintainers; [ juliendehos knedlsepp ];
   };
diff --git a/pkgs/development/libraries/assimp/default.nix b/pkgs/development/libraries/assimp/default.nix
index 5fbc45a7c08b..e342d8ab6c09 100644
--- a/pkgs/development/libraries/assimp/default.nix
+++ b/pkgs/development/libraries/assimp/default.nix
@@ -1,19 +1,17 @@
 { stdenv, fetchFromGitHub, unzip, cmake, boost, zlib }:
 
-let
-  version = "3.2";
-in
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   name = "assimp-${version}";
+  version = "3.3.1";
 
   src = fetchFromGitHub{
     owner = "assimp";
     repo = "assimp";
     rev = "v${version}";
-    sha256 = "09fsksbq9a8gykwmw6gaicwh2ladrln1jc1xc5yk7w6x180cbb1x";
+    sha256 = "13y44fymj13h6alig0nqab91j2qch0yh9gq8yql2zz744ch2s5vc";
   };
 
-  buildInputs = [ unzip cmake boost zlib ];
+  buildInputs = [ cmake boost zlib ];
 
   meta = with stdenv.lib; {
     description = "A library to import various 3D model formats";
diff --git a/pkgs/development/libraries/aubio/default.nix b/pkgs/development/libraries/aubio/default.nix
index a14de67d7f39..3ea86b36a306 100644
--- a/pkgs/development/libraries/aubio/default.nix
+++ b/pkgs/development/libraries/aubio/default.nix
@@ -1,24 +1,23 @@
 { stdenv, fetchurl, alsaLib, fftw, libjack2, libsamplerate
-, libsndfile, pkgconfig, python2
+, libsndfile, pkgconfig, python3
 }:
 
 stdenv.mkDerivation rec {
-  name = "aubio-0.4.3";
+  name = "aubio-0.4.4";
 
   src = fetchurl {
     url = "http://aubio.org/pub/${name}.tar.bz2";
-    sha256 = "1azarklqggch8kkz3gbqwi2vlb6ld4lidyhp34qawr0c7h3xnb5n";
+    sha256 = "1y5zzwv9xjc649g4xrlqnim4q7pcwgzn0xrq3ijbmm5r4ckbkk9a";
   };
 
-  buildInputs = [
-    alsaLib fftw libjack2 libsamplerate libsndfile pkgconfig python2
-  ];
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ alsaLib fftw libjack2 libsamplerate libsndfile python3 ];
 
-  configurePhase = "${python2.interpreter} waf configure --prefix=$out";
+  configurePhase = "${python3.interpreter} waf configure --prefix=$out";
 
-  buildPhase = "${python2.interpreter} waf";
+  buildPhase = "${python3.interpreter} waf";
 
-  installPhase = "${python2.interpreter} waf install";
+  installPhase = "${python3.interpreter} waf install";
 
   meta = with stdenv.lib; {
     description = "Library for audio labelling";
diff --git a/pkgs/development/libraries/audio/suil/default.nix b/pkgs/development/libraries/audio/suil/default.nix
index 8864d710174a..f0dbdcc7daf6 100644
--- a/pkgs/development/libraries/audio/suil/default.nix
+++ b/pkgs/development/libraries/audio/suil/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, gtk2, lv2, pkgconfig, python, serd, sord, sratom
+{ stdenv, lib, fetchurl, gtk2, lv2, pkgconfig, python, serd, sord, sratom, gcc6
 , withQt4 ? true, qt4 ? null
 , withQt5 ? false, qt5 ? null }:
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     sha256 = "1kji3lhha26qr6xm9j8ic5c40zbrrb5qnwm2qxzmsfxgmrz29wkf";
   };
 
-  buildInputs = [ gtk2 lv2 pkgconfig python serd sord sratom ]
+  buildInputs = [ gtk2 lv2 pkgconfig python serd sord sratom gcc6 ]
     ++ (lib.optionals withQt4 [ qt4 ])
     ++ (lib.optionals withQt5 (with qt5; [ qtbase qttools ]));
 
diff --git a/pkgs/development/libraries/babl/default.nix b/pkgs/development/libraries/babl/default.nix
index 02b1af5ab521..545612d5c155 100644
--- a/pkgs/development/libraries/babl/default.nix
+++ b/pkgs/development/libraries/babl/default.nix
@@ -1,17 +1,17 @@
 { stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "babl-0.1.12";
+  name = "babl-0.1.24";
 
   src = fetchurl {
     url = "http://ftp.gtk.org/pub/babl/0.1/${name}.tar.bz2";
-    sha256 = "01x4an6zixrhn0vibkxpcb7gg348gadydq8gpw82rdqp39zjp01g";
+    sha256 = "02wxyaa9kjfypmg31avp2dxh16sfx9701ww6dmp0ggz5vnng2as7";
   };
 
-  meta = { 
+  meta = with stdenv.lib; { 
     description = "Image pixel format conversion library";
     homepage = http://gegl.org/babl/;
-    license = stdenv.lib.licenses.gpl3;
-    platforms = stdenv.lib.platforms.unix;
+    license = licenses.gpl3;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/bobcat/default.nix b/pkgs/development/libraries/bobcat/default.nix
index dcd35613d545..c5a6f55681ab 100644
--- a/pkgs/development/libraries/bobcat/default.nix
+++ b/pkgs/development/libraries/bobcat/default.nix
@@ -1,12 +1,13 @@
-{ stdenv, fetchFromGitHub, icmake, libmilter, libX11, openssl, readline
+{ stdenv, fetchFromGitHub, icmake
+, libmilter, libX11, openssl, readline
 , utillinux, yodl }:
 
 stdenv.mkDerivation rec {
   name = "bobcat-${version}";
-  version = "4.03.00";
+  version = "4.07.00";
 
   src = fetchFromGitHub {
-    sha256 = "0jkwq3f6g3vbim2jg5wfzhin89r4crnypqggp8cqimjmpkyfqnv0";
+    sha256 = "0ja6rgdw4ng10acp2c0cv9k72i5sgng03i3xi2yshlm2811lgxcs";
     rev = version;
     repo = "bobcat";
     owner = "fbb-git";
diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix
index 6adcce45d808..174e9fe47769 100644
--- a/pkgs/development/libraries/boost/generic.nix
+++ b/pkgs/development/libraries/boost/generic.nix
@@ -126,7 +126,7 @@ stdenv.mkDerivation {
     description = "Collection of C++ libraries";
     license = stdenv.lib.licenses.boost;
 
-    platforms = platforms.unix;
+    platforms = (if versionOlder version "1.59" then remove "aarch64-linux" else id) platforms.unix;
     maintainers = with maintainers; [ peti wkennington ];
   };
 
diff --git a/pkgs/development/libraries/caf/default.nix b/pkgs/development/libraries/caf/default.nix
new file mode 100644
index 000000000000..d3e655676e64
--- /dev/null
+++ b/pkgs/development/libraries/caf/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "actor-framework-${version}";
+  version = "0.15.3";
+
+  src = fetchFromGitHub {
+    owner = "actor-framework";
+    repo = "actor-framework";
+    rev = "${version}";
+    sha256 = "0202nsdriigdh6sxi1k3hddvmf1x54qpykbvf2ghfhzyh0m1q7j2";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "An open source implementation of the actor model in C++";
+    homepage = http://actor-framework.org/;
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ bobakker ];
+  };
+}
diff --git a/pkgs/development/libraries/cdk/default.nix b/pkgs/development/libraries/cdk/default.nix
index 614d57002cd2..a97ca5cc6980 100644
--- a/pkgs/development/libraries/cdk/default.nix
+++ b/pkgs/development/libraries/cdk/default.nix
@@ -1,11 +1,8 @@
 { stdenv, fetchurl, ncurses }:
 
-let
-  version = "5.0-20160131";
-in
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   name = "cdk-${version}";
-  inherit version;
+  version ="5.0-20161210";
 
   buildInputs = [
     ncurses
@@ -13,13 +10,13 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "ftp://invisible-island.net/cdk/cdk-${version}.tgz";
-    sha256 = "08ic2f5rmi8niaxwxwr6l6lhpan7690x52vpldnbjcf20rc0fbf3";
+    sha256 = "1bazwcwz4qhxyc8jaahdd2nlm30f5dhy0f6cnix5rjjhi35mhxcy";
   };
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Curses development kit";
-    license = stdenv.lib.licenses.bsdOriginal ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.bsdOriginal ;
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/ceres-solver/default.nix b/pkgs/development/libraries/ceres-solver/default.nix
index 7cd848e602aa..673fb77f01aa 100644
--- a/pkgs/development/libraries/ceres-solver/default.nix
+++ b/pkgs/development/libraries/ceres-solver/default.nix
@@ -10,18 +10,17 @@
 # google-gflags is required to run tests
 assert runTests -> google-gflags != null;
 
-let
-  version = "1.10.0";
-in
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   name = "ceres-solver-${version}";
+  version = "1.12.0";
 
   src = fetchurl {
     url = "http://ceres-solver.org/ceres-solver-${version}.tar.gz";
-    sha256 = "20bb5db05c3e3e14a4062e2cf2b0742d2653359549ecded3e0653104ef3deb17";
+    sha256 = "15f8mwhcy9f5qggcc9dqwl5y687ykvmlidr686aqdq0ia7azwnvl";
   };
 
-  buildInputs = [ cmake glog ]
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ glog ]
     ++ stdenv.lib.optional (google-gflags != null) google-gflags;
 
   inherit eigen;
@@ -38,8 +37,7 @@ stdenv.mkDerivation {
     description = "C++ library for modeling and solving large, complicated optimization problems";
     license = licenses.bsd3;
     homepage = "http://ceres-solver.org";
-    maintainers = with stdenv.lib.maintainers; [ giogadi ];
-    inherit version;
-    platforms = with stdenv.lib.platforms; unix;
+    maintainers = with maintainers; [ giogadi ];
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/cfitsio/default.nix b/pkgs/development/libraries/cfitsio/default.nix
index a3d1a46e818c..d49bd7eac1bc 100644
--- a/pkgs/development/libraries/cfitsio/default.nix
+++ b/pkgs/development/libraries/cfitsio/default.nix
@@ -1,24 +1,21 @@
 { fetchurl, stdenv }:
 
-stdenv.mkDerivation {
-  name = "cfitsio-3.21";
+ stdenv.mkDerivation {
+  name = "cfitsio-3.41";
 
   src = fetchurl {
-    url = ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3210.tar.gz;
-    sha256 = "1ffr3p5dy2b1vj9j4li5zf22naavi9wcxsvqy236fc0ykfyip96i";
+    url = "ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3410.tar.gz";
+    sha256 = "0k3knn5hz1vhzzvm46xa1y6fnpliwkwgw76lnkf4amcnl5zaqmm5";
   };
 
   # Shared-only build
   buildFlags = "shared";
-  patchPhase =
-   '' sed -e '/^install:/s/libcfitsio.a //' -e 's@/bin/@@g' -i Makefile.in
+  patchPhase = '' sed -e '/^install:/s/libcfitsio.a //' -e 's@/bin/@@g' -i Makefile.in
    '';
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = http://heasarc.gsfc.nasa.gov/fitsio/;
-
     description = "Library for reading and writing FITS data files";
-
     longDescription =
       '' CFITSIO is a library of C and Fortran subroutines for reading and
          writing data files in FITS (Flexible Image Transport System) data
@@ -28,9 +25,8 @@ stdenv.mkDerivation {
          advanced features for manipulating and filtering the information in
          FITS files.
       '';
-
     # Permissive BSD-style license.
     license = "permissive";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/chipmunk/default.nix b/pkgs/development/libraries/chipmunk/default.nix
index 52990097a230..2c50d8138057 100644
--- a/pkgs/development/libraries/chipmunk/default.nix
+++ b/pkgs/development/libraries/chipmunk/default.nix
@@ -5,15 +5,16 @@
 stdenv.mkDerivation rec {
   name = "chipmunk-${version}";
   majorVersion = "7";
-  version = "${majorVersion}.0.0";
+  version = "${majorVersion}.0.1";
 
   src = fetchurl {
     url = "https://chipmunk-physics.net/release/Chipmunk-${majorVersion}.x/Chipmunk-${version}.tgz";
-    sha256 = "1kaii8wgvp0kgn2p22jm9smyqlws4p5dg8j23jaiasx9jq1kiaql";
+    sha256 = "0q4jwv1icz8spcjkp0v3bnygi6hq2zmnsgcxkwm8i2bxfxjb8m7y";
   };
 
+  nativeBuildInputs = [ cmake ];
   buildInputs =
-    [ cmake freeglut mesa glfw2 glew libX11 xproto inputproto libXi libXmu ];
+    [ freeglut mesa glfw2 glew libX11 xproto inputproto libXi libXmu ];
 
   postInstall = ''
     mkdir -p $out/bin
diff --git a/pkgs/development/libraries/chromaprint/default.nix b/pkgs/development/libraries/chromaprint/default.nix
index 7c3c776e81b0..09c5eeb611ba 100644
--- a/pkgs/development/libraries/chromaprint/default.nix
+++ b/pkgs/development/libraries/chromaprint/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "chromaprint-${version}";
-  version = "1.3.1";
+  version = "1.3.2";
 
   src = fetchurl {
     url = "http://bitbucket.org/acoustid/chromaprint/downloads/${name}.tar.gz";
-    sha256 = "10dm9cfqb77g12pyjnqaw80860kzdcvskni02ll7afpywq8s15cg";
+    sha256 = "0lln8dh33gslb9cbmd1hcv33pr6jxdwipd8m8gbsyhksiq6r1by3";
   };
 
   nativeBuildInputs = [ cmake ];
diff --git a/pkgs/development/libraries/cimg/default.nix b/pkgs/development/libraries/cimg/default.nix
index 722852f12700..a9470ee3f41b 100644
--- a/pkgs/development/libraries/cimg/default.nix
+++ b/pkgs/development/libraries/cimg/default.nix
@@ -4,14 +4,14 @@
 stdenv.mkDerivation rec {
 
   name = "cimg-${version}";
-  version = "1.7.0";
+  version = "1.7.9";
 
   src = fetchurl {
     url = "http://cimg.eu/files/CImg_${version}.zip";
-    sha256 = "06j3n7gvgxzvprqwf56nnca195y38dcbdlszrxyn5p9w9al437zj";
+    sha256 = "07g81jn25y2wksg9ycf9a7f5bfpcdl3xbrkp1xy3czl043a00y7s";
   };
 
-  buildInputs = [ unzip ];
+  nativeBuildInputs = [ unzip ];
 
   builder = ./builder.sh;
 
diff --git a/pkgs/development/libraries/cl/default.nix b/pkgs/development/libraries/cl/default.nix
index 1fa45992aeee..b26327dd7754 100644
--- a/pkgs/development/libraries/cl/default.nix
+++ b/pkgs/development/libraries/cl/default.nix
@@ -1,19 +1,19 @@
-{stdenv, fetchurl, SDL, mesa, rebar, erlang, opencl-headers, ocl-icd }:
+{stdenv, fetchFromGitHub, SDL, mesa, rebar, erlang, opencl-headers, ocl-icd }:
 
 stdenv.mkDerivation rec {
-  version = "1.2.1";
+  version = "1.2.3";
   name = "cl-${version}";
 
-  src = fetchurl {
-    url = "https://github.com/tonyrog/cl/archive/${name}.tar.gz";
-    sha256 = "03jv280h9gqqqkm0mmkjr53srd2mzhvyy1biss77wpjrzq2z12c8";
+  src = fetchFromGitHub {
+    owner = "tonyrog";
+    repo = "cl";
+    rev = "cl-${version}";
+    sha256 = "1dk0k03z0ipxvrnn0kihph135hriw96jpnd31lbq44k6ckh6bm03";
   };
 
   buildInputs = [ erlang rebar opencl-headers ocl-icd ];
-  #propagatedBuildInputs = [ SDL mesa ];
-
+  
   buildPhase = ''
-    sed 's/git/"${version}"/' -i src/cl.app.src
     rebar compile
   '';
 
@@ -25,10 +25,10 @@ stdenv.mkDerivation rec {
     cp -ruv c_src doc ebin include priv src $DIR
   '';
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = https://github.com/tonyrog/cl;
     description = "OpenCL binding for Erlang";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.mit;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/concurrencykit/default.nix b/pkgs/development/libraries/concurrencykit/default.nix
index 3fad256e5728..29ce216cadf1 100644
--- a/pkgs/development/libraries/concurrencykit/default.nix
+++ b/pkgs/development/libraries/concurrencykit/default.nix
@@ -2,22 +2,23 @@
 
 stdenv.mkDerivation rec {
   name    = "concurrencykit-${version}";
-  version = "0.4.5";
+  version = "0.6.0";
 
   src = fetchurl {
     url    = "http://concurrencykit.org/releases/ck-${version}.tar.gz";
-    sha256 = "0mh3z8ibiwidc6qvrv8bx9slgcycxwy06kfngfzfza6nihrymzl9";
+    sha256 = "1pv21p7sjwwmbs2xblpy1lqk53r2i212yrqyjlr5dr3rlv87vqnp";
   };
+  
+  #Deleting this line causes "Unknown option --disable-static"
+  configurePhase = "./configure --prefix=$out";
 
   enableParallelBuilding = true;
 
-  configurePhase = "./configure --prefix=$out";
-
-  meta = {
+  meta = with stdenv.lib; {
     description = "A library of safe, high-performance concurrent data structures";
-    homepage    = "http://concurrencykit.org";
-    license     = stdenv.lib.licenses.bsd2;
-    platforms   = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+    homepage    = http://concurrencykit.org;
+    license     = licenses.bsd2;
+    platforms   = platforms.unix;
+    maintainers = [ maintainers.thoughtpolice ];
   };
 }
diff --git a/pkgs/development/libraries/cre2/default.nix b/pkgs/development/libraries/cre2/default.nix
new file mode 100644
index 000000000000..74619cbaaaed
--- /dev/null
+++ b/pkgs/development/libraries/cre2/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, autoreconfHook,
+  libtool, pkgconfig, re2, texinfo }:
+
+stdenv.mkDerivation rec {
+  name = "cre2-${version}";
+  version = "0.3.0";
+    
+  src = fetchFromGitHub {
+    owner = "marcomaggi";
+    repo = "cre2";
+    rev = version;
+    sha256 = "12yrdad87jjqrhbqm02hzsayan2402vf61a9x1b2iabv6d1c1bnj";
+  };
+
+  nativeBuildInputs = [
+    autoreconfHook
+    libtool
+    pkgconfig
+  ];
+  buildInputs = [ re2 texinfo ];
+
+  NIX_LDFLAGS="-lre2 -lpthread";
+
+  configureFlags = [
+    "--enable-maintainer-mode"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = http://marcomaggi.github.io/docs/cre2.html;
+    description = "C Wrapper for RE2";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/development/libraries/dbus/make-session-conf.xsl b/pkgs/development/libraries/dbus/make-session-conf.xsl
index bc73369af944..9544aa13db56 100644
--- a/pkgs/development/libraries/dbus/make-session-conf.xsl
+++ b/pkgs/development/libraries/dbus/make-session-conf.xsl
@@ -18,7 +18,8 @@
 
   <xsl:template match="/busconfig">
     <busconfig>
-      <xsl:copy-of select="child::node()[name() != 'include' and name() != 'standard_session_servicedirs' and name() != 'servicedir' and name() != 'includedir']" />
+      <!-- We leave <standard_session_servicedirs/> because it includes XDG dirs and therefore user Nix profile. -->
+      <xsl:copy-of select="child::node()[name() != 'include' and name() != 'servicedir' and name() != 'includedir']" />
 
       <xsl:for-each select="str:tokenize($serviceDirectories)">
         <servicedir><xsl:value-of select="." />/share/dbus-1/services</servicedir>
diff --git a/pkgs/development/libraries/dlib/default.nix b/pkgs/development/libraries/dlib/default.nix
index 8a24445dcca7..fe4e7907c9fe 100644
--- a/pkgs/development/libraries/dlib/default.nix
+++ b/pkgs/development/libraries/dlib/default.nix
@@ -1,45 +1,25 @@
-{ stdenv, fetchurl, cmake, xlibsWrapper }:
+{ stdenv, fetchFromGitHub, cmake, xlibsWrapper }:
 
 stdenv.mkDerivation rec {
-  version = "18.10";
+  version = "19.4";
   name = "dlib-${version}";
 
-  src = fetchurl {
-    url = "mirror://sourceforge/dclib/dlib/${name}.tar.bz2";
-    sha256 = "1g3v13azc29m5r7zqs3x0g731hny6spb66cxnra7f167z31ka3s7";
+  src = fetchFromGitHub {
+    owner = "davisking";
+    repo = "dlib";
+    rev ="v${version}";
+    sha256 = "0zqa36i4s5i7n6284sp22qrhm3k37n9vqmpz068nm02vj9h0a2j4";
   };
 
-  # The supplied CMakeLists.txt does not have any install targets.
-  sources_var = "\$\{sources\}";
-  headers_var = "\$\{hearders\}";
-  preConfigure = ''
-    cat << EOF > CMakeLists.txt
-    cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
-    project(dlib)
-
-    include_directories(./)
-
-    file(GLOB sources ./dlib/all/*.cpp)
-    file(GLOB headers ./dlib/*.h)
-
-    SET(LIBRARY_OUTPUT_PATH ".")
-    add_library(dlib "SHARED" dlib/all/source.cpp ${sources_var} ${headers_var})
-
-    install(TARGETS dlib DESTINATION lib)
-    install(DIRECTORY dlib/ DESTINATION include/dlib FILES_MATCHING PATTERN "*.h")
-    EOF
-  '';   
-
   enableParallelBuilding = true;
-  buildInputs = [ cmake xlibsWrapper ];
-  propagatedBuildInputs = [ xlibsWrapper ];
+  nativeBuildInputs = [ cmake ];
 
   meta = with stdenv.lib; {
     description = "A general purpose cross-platform C++ machine learning library";
     homepage = http://www.dlib.net;
-    license = stdenv.lib.licenses.boost;
+    license = licenses.boost;
     maintainers = with maintainers; [ christopherpoole ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = platforms.all;
   };
 }
 
diff --git a/pkgs/development/libraries/drumstick/default.nix b/pkgs/development/libraries/drumstick/default.nix
index 809037bb5edf..7ec72afc2bff 100644
--- a/pkgs/development/libraries/drumstick/default.nix
+++ b/pkgs/development/libraries/drumstick/default.nix
@@ -4,11 +4,11 @@
 
 stdenv.mkDerivation rec {
   name = "drumstick-${version}";
-  version = "1.0.2";
+  version = "1.1.0";
 
   src = fetchurl {
     url = "mirror://sourceforge/drumstick/${version}/${name}.tar.bz2";
-    sha256 = "0l47gy9yywrc860db5g3wdqg8yc8qdb2lqq6wvw1dfim5j0vbail";
+    sha256 = "13pkfqrav30bbcddgf1imd7jk6lpqbxkz1qv31718pdl446jq7df";
   };
 
   outputs = [ "out" "dev" "man" ];
@@ -28,8 +28,14 @@ stdenv.mkDerivation rec {
     done
   '';
 
+  #Temporarily remove drumstick-piano; Gives segment fault. Submitted ticket
+  postInstall = ''
+    rm $out/bin/drumstick-vpiano
+    '';
+
+  nativeBuildInputs = [ cmake pkgconfig ];
   buildInputs = [
-    alsaLib cmake doxygen fluidsynth pkgconfig qt5.qtbase qt5.qtsvg
+    alsaLib doxygen fluidsynth qt5.qtbase qt5.qtsvg
   ];
 
   meta = with stdenv.lib; {
@@ -37,6 +43,6 @@ stdenv.mkDerivation rec {
     description = "MIDI libraries for Qt5/C++";
     homepage = http://drumstick.sourceforge.net/;
     license = licenses.gpl2Plus;
-    platforms = [ "x86_64-linux" ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/eigen/default.nix b/pkgs/development/libraries/eigen/default.nix
index c38759e0c757..374f52c9cb06 100644
--- a/pkgs/development/libraries/eigen/default.nix
+++ b/pkgs/development/libraries/eigen/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ cmake ];
 
   postInstall = ''
-    sed -e '/Cflags:/s@''${prefix}@@' -i "$out"/share/pkgconfig/eigen3.pc
+    sed -e '/Cflags:/s@''${prefix}/@@' -i "$out"/share/pkgconfig/eigen3.pc
   '';
   
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/enginepkcs11/default.nix b/pkgs/development/libraries/enginepkcs11/default.nix
deleted file mode 100644
index ff40a110a33e..000000000000
--- a/pkgs/development/libraries/enginepkcs11/default.nix
+++ /dev/null
@@ -1,21 +0,0 @@
-{stdenv, fetchurl, libp11, pkgconfig, openssl}:
-
-stdenv.mkDerivation rec {
-  name = "engine_pkcs11-0.1.8";
-  
-  src = fetchurl {
-    urls = [
-      "http://www.opensc-project.org/files/engine_pkcs11/${name}.tar.gz"
-      "http://www.openadk.org/distfiles/${name}.tar.gz"
-    ];
-    sha256 = "1rd20rxy12rfx3kwwvk5sqvc1ll87z60rqak1ksfwbf4wx0pwzfy";
-  };
-  
-  buildInputs = [ libp11 pkgconfig openssl ];
-
-  meta = {
-    homepage = http://www.opensc-project.org/engine_pkcs11/;
-    license = stdenv.lib.licenses.bsdOriginal;
-    description = "Engine for OpenSSL to use smart cards in PKCS#11 format";
-  };
-}
diff --git a/pkgs/development/libraries/exempi/default.nix b/pkgs/development/libraries/exempi/default.nix
index e7a3bd495132..1453db8563f5 100644
--- a/pkgs/development/libraries/exempi/default.nix
+++ b/pkgs/development/libraries/exempi/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, expat, zlib, boost }:
 
 stdenv.mkDerivation rec {
-  name = "exempi-2.2.2";
+  name = "exempi-2.4.2";
 
   src = fetchurl {
     url = "http://libopenraw.freedesktop.org/download/${name}.tar.bz2";
-    sha256 = "01vcd1mfn2s0iiq2cjyzgvnxx6kcq9cwra1iipijhs0vwvjx0yhf";
+    sha256 = "1v665fc7x0yi7x6lzskvd8bd2anf7951svn2vd5384dblmgv43av";
   };
 
   configureFlags = [
diff --git a/pkgs/development/libraries/exosip/default.nix b/pkgs/development/libraries/exosip/default.nix
index 9cf49b3c2c09..a5dba0c94f12 100644
--- a/pkgs/development/libraries/exosip/default.nix
+++ b/pkgs/development/libraries/exosip/default.nix
@@ -1,18 +1,20 @@
 {stdenv, fetchurl, libosip, openssl, pkgconfig }:
 
 stdenv.mkDerivation rec {
-  version = "4.0.0";
-  src = fetchurl {
+ name = "libexosip2-${version}";
+ version = "4.1.0";
+ 
+ src = fetchurl {
     url = "mirror://savannah/exosip/libeXosip2-${version}.tar.gz";
-    sha256 = "1rdjr3x7s992w004cqf4xji1522an9rpzsr9wvyhp685khmahrsj";
+    sha256 = "17cna8kpc8nk1si419vgr6r42k2lda0rdk50vlxrw8rzg0xp2xrw";
   };
-  name = "libexosip2-${version}";
-
+ 
+  nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ libosip openssl pkgconfig ];
       
-  meta = {
-    license = stdenv.lib.licenses.gpl2Plus;
+  meta = with stdenv.lib; {
+    license = licenses.gpl2Plus;
     description = "Library that hides the complexity of using the SIP protocol";
-    platforms = stdenv.lib.platforms.linux;
+    platforms =platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/fcppt/default.nix b/pkgs/development/libraries/fcppt/default.nix
index ac785d65c4ee..c4332df5a3db 100644
--- a/pkgs/development/libraries/fcppt/default.nix
+++ b/pkgs/development/libraries/fcppt/default.nix
@@ -1,21 +1,24 @@
-{ stdenv, fetchgit, cmake, boost }:
+{ stdenv, fetchFromGitHub, cmake, boost }:
 
 stdenv.mkDerivation rec {
-  name = "fcppt-1.3.0";
+  name = "fcppt-${version}";
+  version = "2.5.0";
 
-  src = fetchgit {
-    url = https://github.com/freundlich/fcppt.git;
-    rev = "7787733afc7a6278c0de8c0435b3d312e0c0c851";
-    sha256 = "1vy6nhk6nymbp4yihvw75qn67q9fgmfc518f8dn3h2pq2gfjqrpy";
+  src = fetchFromGitHub {
+    owner = "freundlich";
+    repo = "fcppt";
+    rev = version;
+    sha256 = "0pjldwwxgnzjfd04cy29a9mn2szq4v2mjnw0367kxd141q2iglqi";
   };
 
-  buildInputs = [ cmake boost ];
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ boost ];
 
   cmakeFlags = [ "-DENABLE_EXAMPLES=false" "-DENABLE_TEST=false" ];
 
   enableParallelBuilding = true;
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Freundlich's C++ toolkit";
     longDescription = ''
       Freundlich's C++ Toolkit (fcppt) is a collection of libraries focusing on
@@ -25,8 +28,8 @@ stdenv.mkDerivation rec {
       C++11).
     '';
     homepage = http://fcppt.org;
-    license = stdenv.lib.licenses.boost;
-    maintainers = with stdenv.lib.maintainers; [ pmiddend ];
-    platforms = with stdenv.lib.platforms; linux;
+    license = licenses.boost;
+    maintainers = with maintainers; [ pmiddend ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/ffmpegthumbnailer/default.nix b/pkgs/development/libraries/ffmpegthumbnailer/default.nix
index df1c532f6330..c6167252866a 100644
--- a/pkgs/development/libraries/ffmpegthumbnailer/default.nix
+++ b/pkgs/development/libraries/ffmpegthumbnailer/default.nix
@@ -1,16 +1,19 @@
-{ pkgs, fetchurl, stdenv, ffmpeg, cmake, libpng, pkgconfig
+{ pkgs, fetchFromGitHub, stdenv, ffmpeg, cmake, libpng, pkgconfig
 }:
 
 stdenv.mkDerivation rec {
   name = "ffmpegthumbnailer-${version}";
-  version = "2.0.10";
+  version = "2.2.0";
 
-  src = fetchurl {
-    url = "https://github.com/dirkvdb/ffmpegthumbnailer/releases/download/${version}/${name}.tar.bz2";
-    sha256 = "0q7ws7ysw2rwr6ja8rhdjcc7x1hrlga7n514wi4lhw1yma32q0m3";
+  src = fetchFromGitHub {
+    owner = "dirkvdb";
+    repo = "ffmpegthumbnailer";
+    rev = version;
+    sha256 = "0kl8aa547icy9b05njps02a8sw4yn4f8fzs228kig247sn09s4cp";
   };
 
-  buildInputs = [ ffmpeg cmake libpng pkgconfig ];
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ ffmpeg libpng ];
 
   meta = with stdenv.lib;  {
     homepage = https://github.com/dirkvdb/ffmpegthumbnailer;
diff --git a/pkgs/development/libraries/ffms/default.nix b/pkgs/development/libraries/ffms/default.nix
index 3fc3f37d2aad..5aa62a638fe8 100644
--- a/pkgs/development/libraries/ffms/default.nix
+++ b/pkgs/development/libraries/ffms/default.nix
@@ -1,23 +1,26 @@
-{ stdenv, fetchurl, zlib, ffmpeg, pkgconfig }:
+{ stdenv, fetchFromGitHub, zlib, ffmpeg, pkgconfig }:
 
 stdenv.mkDerivation rec {
-  name = "ffms-2.21";
+  name = "ffms-${version}";
+  version = "2.22";
 
-  src = fetchurl {
-    url = https://codeload.github.com/FFMS/ffms2/tar.gz/2.21;
-    name = "${name}.tar.gz";
-    sha256 = "00h2a5yhvr1qzbrzwbjv1ybxrx25lchgral6yxv36aaf4pi3rhn2";
+  src = fetchFromGitHub {
+    owner = "FFMS";
+    repo = "ffms2";
+    rev = version;
+    sha256 = "1ywcx1f3q533qfrbck5qhik3l617qhm062l8zixv02gnla7w6rkm";
   };
 
   NIX_CFLAGS_COMPILE = "-fPIC";
 
-  buildInputs = [ zlib ffmpeg pkgconfig ];
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ zlib ffmpeg ];
 
-  meta = {
-    homepage = http://code.google.com/p/ffmpegsource/;
+  meta = with stdenv.lib; {
+    homepage = http://github.com/FFMS/ffms2/;
     description = "Libav/ffmpeg based source library for easy frame accurate access";
-    license = stdenv.lib.licenses.mit;
-    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
-    platforms = with stdenv.lib.platforms; unix;
+    license = licenses.mit;
+    maintainers = with maintainers; [ fuuzetsu ];
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/filter-audio/default.nix b/pkgs/development/libraries/filter-audio/default.nix
index 989d9518a0eb..3faba45714a0 100644
--- a/pkgs/development/libraries/filter-audio/default.nix
+++ b/pkgs/development/libraries/filter-audio/default.nix
@@ -1,12 +1,14 @@
-{ stdenv, fetchgit }:
+{ stdenv, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
-  name = "filter-audio-20150624";
+  name = "filter-audio-${version}";
+  version = "0.0.1";
 
-  src = fetchgit {
-    url = "https://github.com/irungentoo/filter_audio.git";
-    rev = "612c5a102550c614e4c8f859e753ea64c0b7250c";
-    sha256 = "0bmf8dxnr4vb6y36lvlwqd5x68r4cbsd625kbw3pypm5yqp0n5na";
+  src = fetchFromGitHub {
+    owner = "irungentoo";
+    repo ="filter_audio";
+    rev = "v${version}";
+    sha256 = "1dv4pram317c1w97cjsv9f6r8cdxhgri7ib0v364z08pk7r2avfn";
   };
 
   doCheck = false;
diff --git a/pkgs/development/libraries/gdal/default.nix b/pkgs/development/libraries/gdal/default.nix
index 173e6411182d..9805bc17c443 100644
--- a/pkgs/development/libraries/gdal/default.nix
+++ b/pkgs/development/libraries/gdal/default.nix
@@ -6,12 +6,12 @@
  }:
 
 composableDerivation.composableDerivation {} (fixed: rec {
-  version = "2.1.1";
+  version = "2.1.3";
   name = "gdal-${version}";
 
   src = fetchurl {
     url = "http://download.osgeo.org/gdal/${version}/${name}.tar.gz";
-    sha256 = "55fc6ffbe76e9d2e7e6cf637010e5d4bba6a966d065f40194ff798544198236b";
+    sha256 = "0jh7filpf5dk5iz5acj7y3y49ihnzqypxckdlj0sjigbqq6hlsmf";
   };
 
   buildInputs = [ unzip libjpeg libtiff libpng proj openssl ]
diff --git a/pkgs/development/libraries/gecode/default.nix b/pkgs/development/libraries/gecode/default.nix
index ee7b12de5027..5d683de404d9 100644
--- a/pkgs/development/libraries/gecode/default.nix
+++ b/pkgs/development/libraries/gecode/default.nix
@@ -2,13 +2,14 @@
 
 stdenv.mkDerivation rec {
   name = "gecode-${version}";
-  version = "4.4.0";
+  version = "5.0.0";
 
   src = fetchurl {
     url = "http://www.gecode.org/download/${name}.tar.gz";
-    sha256 = "0akqjzy6pd229mn0lhpdbyc4wbazhprkd5ijqs99z68bj3b9h0s3";
+    sha256 = "0yz7m4msp7g2jzsn216q74d9n7rv6qh8abcv0jdc1n7y2nhjzzzl";
   };
 
+  enableParallelBuilding = true;
   buildInputs = [ perl ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/geis/default.nix b/pkgs/development/libraries/geis/default.nix
index e8f4001c1b59..5a7bff7459e3 100644
--- a/pkgs/development/libraries/geis/default.nix
+++ b/pkgs/development/libraries/geis/default.nix
@@ -16,11 +16,11 @@ with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "geis-${version}";
-  version = "2.2.16";
+  version = "2.2.17";
 
   src = fetchurl {
     url = "https://launchpad.net/geis/trunk/${version}/+download/${name}.tar.xz";
-    sha256 = "40a694092c79f325a2fbf8a9f301177bc91c364f4e637c2aa8963ad2a5aabbcf";
+    sha256 = "1svhbjibm448ybq6gnjjzj0ak42srhihssafj0w402aj71lgaq4a";
   };
 
   NIX_CFLAGS_COMPILE = "-Wno-error=pedantic";
diff --git a/pkgs/development/libraries/gloox/default.nix b/pkgs/development/libraries/gloox/default.nix
index 12460f4f2d29..9ce47ec2f1a2 100644
--- a/pkgs/development/libraries/gloox/default.nix
+++ b/pkgs/development/libraries/gloox/default.nix
@@ -8,27 +8,29 @@ assert zlibSupport -> zlib != null;
 assert sslSupport -> openssl != null;
 assert idnSupport -> libidn != null;
 
+with stdenv.lib;
+
 let
-  version = "1.0.14";
+  version = "1.0.20";
 in
 stdenv.mkDerivation rec {
   name = "gloox-${version}";
 
   src = fetchurl {
     url = "http://camaya.net/download/gloox-${version}.tar.bz2";
-    sha256 = "0h9r4382qv0vqc91x1qz1nivxw1r2l874s1kl0bskzm9dyk742sj";
+    sha256 = "1a6yhs42wcdm8az3983m3lx4d9296bw0amz5v3b4012g1xn0hhq2";
   };
 
   buildInputs = [ ]
-    ++ stdenv.lib.optional zlibSupport zlib
-    ++ stdenv.lib.optional sslSupport openssl
-    ++ stdenv.lib.optional idnSupport libidn;
+    ++ optional zlibSupport zlib
+    ++ optional sslSupport openssl
+    ++ optional idnSupport libidn;
 
   meta = {
     description = "A portable high-level Jabber/XMPP library for C++";
-    homepage = "http://camaya.net/gloox";
-    license = stdenv.lib.licenses.gpl3;
-    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
-    platforms = with stdenv.lib.platforms; unix;
+    homepage = http://camaya.net/gloox;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ fuuzetsu ];
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/gmm/default.nix b/pkgs/development/libraries/gmm/default.nix
index 47345e2a22c7..7f8a2276ef25 100644
--- a/pkgs/development/libraries/gmm/default.nix
+++ b/pkgs/development/libraries/gmm/default.nix
@@ -1,17 +1,18 @@
 { stdenv, fetchurl }:
 
-stdenv.mkDerivation {
-  name = "gmm-4.3";
+stdenv.mkDerivation rec {
+  name = "gmm-${version}";
+  version = "5.1";
 
   src = fetchurl {
-    url = http://download.gna.org/getfem/stable/gmm-4.3.tar.gz;
-    sha256 = "0wpp3k73wd3rblsrwxl6djq6m11fx3q5wgw0pl41m9liswsw6din";
+    url ="http://download.gna.org/getfem/stable/${name}.tar.gz";
+    sha256 = "0di68vdn34kznf96rnwrpb3bbm3ahaczwxd306s9dx41kcqbzrlh";
   };
 
-  meta = { 
+  meta = with stdenv.lib; {
     description = "Generic C++ template library for sparse, dense and skyline matrices";
     homepage = http://home.gna.org/getfem/gmm_intro.html;
-    license = stdenv.lib.licenses.lgpl21Plus;
-    platforms = stdenv.lib.platforms.unix;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/gnutls/3.5.nix b/pkgs/development/libraries/gnutls/3.5.nix
index 8bb1a2d97f76..a1eab1a84c11 100644
--- a/pkgs/development/libraries/gnutls/3.5.nix
+++ b/pkgs/development/libraries/gnutls/3.5.nix
@@ -1,10 +1,10 @@
 { callPackage, fetchurl, libunistring, ... } @ args:
 
 callPackage ./generic.nix (args // rec {
-  version = "3.5.9";
+  version = "3.5.10";
 
   src = fetchurl {
     url = "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5/gnutls-${version}.tar.xz";
-    sha256 = "0l9971841jsfdcvcyhas17sk5rsby6x5vvwcmmj4x3zi9q60zcc2";
+    sha256 = "17apwvdkkazh5w8z8mbanpj2yj8s2002qwy46wz4v3akpa33wi5g";
   };
 })
diff --git a/pkgs/development/libraries/gnutls/generic.nix b/pkgs/development/libraries/gnutls/generic.nix
index cf298baf48a3..3aef10df33ed 100644
--- a/pkgs/development/libraries/gnutls/generic.nix
+++ b/pkgs/development/libraries/gnutls/generic.nix
@@ -1,6 +1,6 @@
 { lib, fetchurl, stdenv, zlib, lzo, libtasn1, nettle, pkgconfig, lzip
 , guileBindings, guile, perl, gmp, autogen, libidn, p11_kit, unbound, libiconv
-, tpmSupport ? false, trousers, nettools, libunistring
+, tpmSupport ? false, trousers, which, nettools, libunistring
 
 # Version dependent args
 , version, src, patches ? [], postPatch ? "", nativeBuildInputs ? []
@@ -38,14 +38,14 @@ stdenv.mkDerivation {
   enableParallelBuilding = true;
 
   buildInputs = [ lzo lzip libtasn1 libidn p11_kit zlib gmp autogen libunistring ]
-    ++ lib.optional doCheck nettools
     ++ lib.optional (stdenv.isFreeBSD || stdenv.isDarwin) libiconv
     ++ lib.optional (tpmSupport && stdenv.isLinux) trousers
     ++ [ unbound ]
     ++ lib.optional guileBindings guile
     ++ buildInputs;
 
-  nativeBuildInputs = [ perl pkgconfig ] ++ nativeBuildInputs;
+  nativeBuildInputs = [ perl pkgconfig ] ++ nativeBuildInputs
+    ++ lib.optionals doCheck [ which nettools ];
 
   propagatedBuildInputs = [ nettle ];
 
diff --git a/pkgs/development/libraries/google-gflags/default.nix b/pkgs/development/libraries/google-gflags/default.nix
index 1423a5a9efcf..0f089d16eadd 100644
--- a/pkgs/development/libraries/google-gflags/default.nix
+++ b/pkgs/development/libraries/google-gflags/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "google-gflags-${version}";
-  version = "2.1.2";
+  version = "2.2.0";
 
   src = fetchFromGitHub {
     owner = "gflags";
     repo = "gflags";
     rev = "v${version}";
-    sha256 = "0qxvr9cyxq3px60jglkm94pq5bil8dkjjdb99l3ypqcds7iypx9w";
+    sha256 = "1y5808ky8qhjwv1nf134czz0h2p2faqvjhxa9zxf8mg8hn4ns9wp";
   };
 
   nativeBuildInputs = [ cmake ];
@@ -21,17 +21,16 @@ stdenv.mkDerivation rec {
 
   doCheck = false;
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "A C++ library that implements commandline flags processing";
     longDescription = ''
       The gflags package contains a C++ library that implements commandline flags processing.
       As such it's a replacement for getopt().
       It was owned by Google. google-gflags project has been renamed to gflags and maintained by new community.
     '';
-    homepage = https://code.google.com/p/gflags/;
-    license = stdenv.lib.licenses.bsd3;
-
-    maintainers = [ stdenv.lib.maintainers.linquize ];
-    platforms = stdenv.lib.platforms.all;
+    homepage = https://gflags.github.io/gflags/;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.linquize ];
+    platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/granite/default.nix b/pkgs/development/libraries/granite/default.nix
index 4d011ddd4638..ee453963376f 100644
--- a/pkgs/development/libraries/granite/default.nix
+++ b/pkgs/development/libraries/granite/default.nix
@@ -1,15 +1,15 @@
-{ stdenv, fetchurl, perl, cmake, vala_0_23, pkgconfig, gobjectIntrospection, glib, gtk3, gnome3, gettext }:
+{ stdenv, fetchurl, perl, cmake, vala, pkgconfig, gobjectIntrospection, glib, gtk3, gnome3, gettext }:
 
 stdenv.mkDerivation rec {
-  majorVersion = "0.3";
-  minorVersion = "0";
+  majorVersion = "0.4";
+  minorVersion = "0.1";
   name = "granite-${majorVersion}.${minorVersion}";
   src = fetchurl {
-    url = "https://code.launchpad.net/granite/${majorVersion}/${majorVersion}/+download/${name}.tar.gz";
-    sha256 = "1laa109dz7kbd8zxddqw2p1b67yzva7cc5h3smqkj8a9jzbhv5fz";
+    url = "https://launchpad.net/granite/${majorVersion}/${majorVersion}.${minorVersion}/+download/${name}.tar.xz";
+    sha256 = "1pf4jkz3xyn1sqv70063im80ayb5kdsqwqwx11dc7vgypsl458cm";
   };
   cmakeFlags = "-DINTROSPECTION_GIRDIR=share/gir-1.0/ -DINTROSPECTION_TYPELIBDIR=lib/girepository-1.0";
-  buildInputs = [perl cmake vala_0_23 pkgconfig gobjectIntrospection glib gtk3 gnome3.libgee gettext];
+  buildInputs = [perl cmake vala pkgconfig gobjectIntrospection glib gtk3 gnome3.libgee gettext];
   meta = {
     description = "An extension to GTK+ used by elementary OS";
     longDescription = "An extension to GTK+ that provides several useful widgets and classes to ease application development. Designed for elementary OS.";
diff --git a/pkgs/development/libraries/gssdp/default.nix b/pkgs/development/libraries/gssdp/default.nix
index 1a8cb233b77a..55e20065732c 100644
--- a/pkgs/development/libraries/gssdp/default.nix
+++ b/pkgs/development/libraries/gssdp/default.nix
@@ -1,21 +1,22 @@
 { stdenv, fetchurl, pkgconfig, libsoup, glib }:
 
-stdenv.mkDerivation {
-  name = "gssdp-0.14.11";
+stdenv.mkDerivation rec {
+  name = "gssdp-${version}";
+  version = "1.0.1";
 
   src = fetchurl {
-    url = mirror://gnome/sources/gssdp/0.14/gssdp-0.14.11.tar.xz;
-    sha256 = "0njkqr2y7c6linnw4wkc4y2vq5dfkpryqcinbzn0pzhr46psxxbv";
+    url = "mirror://gnome/sources/gssdp/1.0/${name}.tar.xz";
+    sha256 = "1qfj4gir1qf6v86z70ryzmjb75ns30q6zi5p89vhd3621gs6f7b0";
   };
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ libsoup ];
   propagatedBuildInputs = [ glib ];
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "GObject-based API for handling resource discovery and announcement over SSDP";
     homepage = http://www.gupnp.org/;
-    license = stdenv.lib.licenses.lgpl2;
-    platforms = stdenv.lib.platforms.all;
+    license = licenses.lgpl2;
+    platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/gtkspell/3.nix b/pkgs/development/libraries/gtkspell/3.nix
index 1b28477f1e0c..c6cc51b1e1f8 100644
--- a/pkgs/development/libraries/gtkspell/3.nix
+++ b/pkgs/development/libraries/gtkspell/3.nix
@@ -2,21 +2,22 @@
 
 stdenv.mkDerivation rec {
   name = "gtkspell-${version}";
-  version = "3.0.8";
+  version = "3.0.9";
 
   src = fetchurl {
-    url = "mirror://sourceforge/gtkspell/gtkspell3-${version}.tar.gz";
-    sha256 = "1zrz5pz4ryvcssk898liynmy2wyxgj95ak7mp2jv7x62yzihq6h1";
+    url = "mirror://sourceforge/gtkspell/gtkspell3-${version}.tar.xz";
+    sha256 = "09jdicmpipmj4v84gnkqwbmj4lh8v0i6pn967rb9jx4zg2ia9x54";
   };
 
-  buildInputs = [ aspell pkgconfig gtk3 enchant intltool ];
+  nativeBuildInputs = [ pkgconfig intltool ];
+  buildInputs = [ aspell gtk3 enchant ];
   propagatedBuildInputs = [ enchant ];
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = "http://gtkspell.sourceforge.net/";
     description = "Word-processor-style highlighting GtkTextView widget";
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = with stdenv.lib.maintainers; [ fuuzetsu ];
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ fuuzetsu ];
   };
 }
diff --git a/pkgs/development/libraries/htmlcxx/default.nix b/pkgs/development/libraries/htmlcxx/default.nix
index 6557d8f80410..1537f9cc480b 100644
--- a/pkgs/development/libraries/htmlcxx/default.nix
+++ b/pkgs/development/libraries/htmlcxx/default.nix
@@ -2,19 +2,19 @@
 
 stdenv.mkDerivation rec {
   name = "htmlcxx-${version}";
-  version = "0.85";
+  version = "0.86";
 
   src = fetchurl {
     url = "mirror://sourceforge/htmlcxx/htmlcxx/${version}/${name}.tar.gz";
-    sha256 = "1rdsjrcjkf7mi3182lq4v5wn2wncw0ziczagaqnzi0nwmp2a00mb";
+    sha256 = "1hgmyiad3qgbpf2dvv2jygzj6jpz4dl3n8ds4nql68a4l9g2nm07";
   };
 
   patches = [ ./ptrdiff.patch ];
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = http://htmlcxx.sourceforge.net/;
-    description = "htmlcxx is a simple non-validating css1 and html parser for C++";
-    license = stdenv.lib.licenses.lgpl2;
-    platforms = stdenv.lib.platforms.linux;
+    description = "A simple non-validating css1 and html parser for C++";
+    license = licenses.lgpl2;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/hwloc/default.nix b/pkgs/development/libraries/hwloc/default.nix
index 5d07cfe3a2bb..e1acacc328cc 100644
--- a/pkgs/development/libraries/hwloc/default.nix
+++ b/pkgs/development/libraries/hwloc/default.nix
@@ -1,12 +1,14 @@
 { stdenv, fetchurl, pkgconfig, cairo, expat, ncurses, libX11
 , pciutils, numactl }:
 
+with stdenv.lib;
+
 stdenv.mkDerivation rec {
-  name = "hwloc-1.11.2";
+  name = "hwloc-1.11.6";
 
   src = fetchurl {
     url = "http://www.open-mpi.org/software/hwloc/v1.11/downloads/${name}.tar.bz2";
-    sha1 = "3d68de060808f04349538be4e63cde501cd53b0a";
+    sha256 = "1yl7dm2qplwmnidd712zy12qfvxk28k8ccs694n42ybwdjwzg1bn";
   };
 
   # XXX: libX11 is not directly needed, but needed as a propagated dep of Cairo.
@@ -16,17 +18,17 @@ stdenv.mkDerivation rec {
   # derivation and set optional dependencies to `null'.
   buildInputs = stdenv.lib.filter (x: x != null)
    ([ expat ncurses ]
-     ++  (stdenv.lib.optionals (!stdenv.isCygwin) [ cairo libX11 ])
-     ++  (stdenv.lib.optionals stdenv.isLinux [ numactl ]));
+     ++  (optionals (!stdenv.isCygwin) [ cairo libX11 ])
+     ++  (optionals stdenv.isLinux [ numactl ]));
 
   propagatedBuildInputs =
     # Since `libpci' appears in `hwloc.pc', it must be propagated.
-    stdenv.lib.optional stdenv.isLinux pciutils;
+    optional stdenv.isLinux pciutils;
 
   enableParallelBuilding = true;
 
   postInstall =
-    stdenv.lib.optionalString (stdenv.isLinux && numactl != null)
+    optionalString (stdenv.isLinux && numactl != null)
       '' if [ -d "${numactl}/lib64" ]
          then
              numalibdir="${numactl}/lib64"
@@ -43,9 +45,8 @@ stdenv.mkDerivation rec {
   # fail on some build machines.
   doCheck = false;
 
-  meta = with stdenv.lib; {
+  meta = {
     description = "Portable abstraction of hierarchical architectures for high-performance computing";
-
     longDescription = ''
        hwloc provides a portable abstraction (across OS,
        versions, architectures, ...) of the hierarchical topology of
@@ -64,9 +65,7 @@ stdenv.mkDerivation rec {
 
     # http://www.open-mpi.org/projects/hwloc/license.php
     license = licenses.bsd3;
-
     homepage = http://www.open-mpi.org/projects/hwloc/;
-
     maintainers = [ ];
     platforms = platforms.all;
   };
diff --git a/pkgs/development/libraries/icu/57.nix b/pkgs/development/libraries/icu/57.nix
deleted file mode 100644
index fbd5f512aee7..000000000000
--- a/pkgs/development/libraries/icu/57.nix
+++ /dev/null
@@ -1,64 +0,0 @@
-{ stdenv, fetchurl, fetchpatch, fixDarwinDylibNames }:
-
-let
-  pname = "icu4c";
-  version = "57.1";
-in
-stdenv.mkDerivation ({
-  name = pname + "-" + version;
-
-  src = fetchurl {
-    url = "http://download.icu-project.org/files/${pname}/${version}/${pname}-"
-      + (stdenv.lib.replaceChars ["."] ["_"] version) + "-src.tgz";
-    sha256 = "10cmkqigxh9f73y7q3p991q6j8pph0mrydgj11w1x6wlcp5ng37z";
-  };
-
-  outputs = [ "out" "dev" ];
-  outputBin = "dev";
-
-  # FIXME: This fixes dylib references in the dylibs themselves, but
-  # not in the programs in $out/bin.
-  buildInputs = stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
-
-  postUnpack = ''
-    sourceRoot=''${sourceRoot}/source
-    echo Source root reset to ''${sourceRoot}
-  '';
-
-  # This pre/postPatch shenanigans is to handle that the patches expect
-  # to be outside of `source`.
-  prePatch = ''
-    pushd ..
-  '';
-  postPatch = ''
-    popd
-  '';
-
-  patches = [
-  ];
-
-  preConfigure = ''
-    sed -i -e "s|/bin/sh|${stdenv.shell}|" configure
-  '';
-
-  configureFlags = "--disable-debug" +
-    stdenv.lib.optionalString (stdenv.isFreeBSD || stdenv.isDarwin) " --enable-rpath";
-
-  # remove dependency on bootstrap-tools in early stdenv build
-  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
-    sed -i 's/INSTALL_CMD=.*install/INSTALL_CMD=install/' $out/lib/icu/${version}/pkgdata.inc
-  '';
-
-  postFixup = ''moveToOutput lib/icu "$dev" '';
-
-  enableParallelBuilding = true;
-
-  meta = with stdenv.lib; {
-    description = "Unicode and globalization support library";
-    homepage = http://site.icu-project.org/;
-    maintainers = with maintainers; [ raskin urkud ];
-    platforms = platforms.all;
-  };
-} // (if stdenv.isArm then {
-  patches = [ ./0001-Disable-LDFLAGSICUDT-for-Linux.patch ];
-} else {}))
diff --git a/pkgs/development/libraries/icu/default.nix b/pkgs/development/libraries/icu/default.nix
index 1508f05db8b6..ea0919caa31f 100644
--- a/pkgs/development/libraries/icu/default.nix
+++ b/pkgs/development/libraries/icu/default.nix
@@ -3,6 +3,14 @@
 let
   pname = "icu4c";
   version = "58.2";
+
+  # this patch should no longer be needed in 58.3
+  # https://bugs.gentoo.org/show_bug.cgi?id=599142#c14
+  keywordFix = fetchurl {
+    url = "http://bugs.icu-project.org/trac/changeset/39484?format=diff";
+    name = "icu-changeset-39484.diff";
+    sha256 = "0hxhpgydalyxacaaxlmaddc1sjwh65rsnpmg0j414mnblq74vmm8";
+  };
 in
 stdenv.mkDerivation ({
   name = pname + "-" + version;
@@ -32,6 +40,7 @@ stdenv.mkDerivation ({
   '';
   postPatch = ''
     popd
+    patch -p4 < ${keywordFix}
   '';
 
   patches = [
diff --git a/pkgs/development/libraries/iso-codes/default.nix b/pkgs/development/libraries/iso-codes/default.nix
index 9477aca59733..ed742888a0ef 100644
--- a/pkgs/development/libraries/iso-codes/default.nix
+++ b/pkgs/development/libraries/iso-codes/default.nix
@@ -1,24 +1,24 @@
-{stdenv, fetchurl, gettext, python, xz}:
+{stdenv, fetchurl, gettext, python3, xz}:
 
 stdenv.mkDerivation rec {
-  name = "iso-codes-3.56";
+  name = "iso-codes-3.74";
+
   src = fetchurl {
     url = "http://pkg-isocodes.alioth.debian.org/downloads/${name}.tar.xz";
-    sha256 = "0vnfygd03jg21i7r238n450wy2hp354f3ank0v3k34zchbjydl2m";
+    sha256 = "1vkaxkcx8h8lbg3z3jjfjs1x1rz1l01j6ll46ysza2gym37g7x11";
   };
   patchPhase = ''
     for i in `find . -name \*.py`
     do
-        sed -i -e "s|#!/usr/bin/env python|#!${python}/bin/python|" $i
+        sed -i -e "s|#!/usr/bin/env python|#!${python3}/bin/python|" $i
     done
   '';
-  buildInputs = [ gettext ];
-  nativeBuildInputs = [ xz ];
+  buildInputs = [ gettext python3 ];
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = http://pkg-isocodes.alioth.debian.org/;
     description = "Various ISO codes packaged as XML files";
-    maintainers = [ stdenv.lib.maintainers.urkud ];
-    platforms = stdenv.lib.platforms.all;
+    maintainers = [ maintainers.urkud ];
+    platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/itk/default.nix b/pkgs/development/libraries/itk/default.nix
index ae1f9996b78a..7e3220d8a37c 100644
--- a/pkgs/development/libraries/itk/default.nix
+++ b/pkgs/development/libraries/itk/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, cmake, libX11, libuuid, xz}:
+{ stdenv, fetchurl, cmake, libX11, libuuid, xz, vtk }:
 
 stdenv.mkDerivation rec {
   name = "itk-4.10.0";
@@ -12,18 +12,21 @@ stdenv.mkDerivation rec {
     "-DBUILD_TESTING=OFF"
     "-DBUILD_EXAMPLES=OFF"
     "-DBUILD_SHARED_LIBS=ON"
+    "-DModule_ITKIOMINC=ON"
+    "-DModule_ITKVtkGlue=ON"
+    "-DModule_ITKReview=ON"
   ];
 
   enableParallelBuilding = true;
 
   nativeBuildInputs = [ cmake xz ];
-  buildInputs = [ libX11 libuuid ];
+  buildInputs = [ libX11 libuuid vtk ];
 
   meta = {
     description = "Insight Segmentation and Registration Toolkit";
     homepage = http://www.itk.org/;
     license = stdenv.lib.licenses.asl20;
     maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    platforms = with stdenv.lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix
index 84638bc01ea6..8c8c181409d4 100644
--- a/pkgs/development/libraries/jemalloc/default.nix
+++ b/pkgs/development/libraries/jemalloc/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "jemalloc-${version}";
-  version = "4.3.1";
+  version = "4.5.0";
 
   src = fetchurl {
     url = "https://github.com/jemalloc/jemalloc/releases/download/${version}/${name}.tar.bz2";
-    sha256 = "12r71i8nm3vwz21fc16rwbb0pwcg5s05n1qg3rwl2s85v0x1ifzp";
+    sha256 = "9409d85664b4f135b77518b0b118c549009dc10f6cba14557d170476611f6780";
   };
 
   # By default, jemalloc puts a je_ prefix onto all its symbols on OSX, which
@@ -14,6 +14,9 @@ stdenv.mkDerivation rec {
   # option should remove the prefix and give us a working jemalloc.
   configureFlags = stdenv.lib.optional stdenv.isDarwin "--with-jemalloc-prefix=";
 
+  doCheck = true;
+
+
   meta = with stdenv.lib; {
     homepage = http://jemalloc.net;
     description = "General purpose malloc(3) implementation";
diff --git a/pkgs/development/libraries/ldns/default.nix b/pkgs/development/libraries/ldns/default.nix
index c35cc5883146..91eb7aecea90 100644
--- a/pkgs/development/libraries/ldns/default.nix
+++ b/pkgs/development/libraries/ldns/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     patchShebangs doc/doxyparse.pl
   '';
 
-  outputs = [ "out" "dev" ];
+  outputs = [ "out" "dev" "man" ];
 
   nativeBuildInputs = [ perl ];
   buildInputs = [ openssl ];
diff --git a/pkgs/development/libraries/libbluray/default.nix b/pkgs/development/libraries/libbluray/default.nix
index c5bf7fd7f982..8b67d52b875e 100644
--- a/pkgs/development/libraries/libbluray/default.nix
+++ b/pkgs/development/libraries/libbluray/default.nix
@@ -19,13 +19,15 @@ assert withFonts -> freetype != null;
 
 stdenv.mkDerivation rec {
   name = "libbluray-${version}";
-  version  = "0.9.2";
+  version  = "1.0.0";
 
   src = fetchurl {
     url = "http://get.videolan.org/libbluray/${version}/${name}.tar.bz2";
-    sha256 = "1sp71j4agcsg17g6b85cqz78pn5vknl5pl39rvr6mkib5ps99jgg";
+    sha256 = "1k3lag4lxi2jjd3zh4wcb5l3hadzm54j5kagh92yzfy76p9svqzp";
   };
 
+  patches = optional withJava ./BDJ-JARFILE-path.patch;
+
   nativeBuildInputs = [ pkgconfig autoreconfHook ]
                       ++ optionals withJava [ ant ]
                       ;
@@ -36,12 +38,15 @@ stdenv.mkDerivation rec {
                 ++ optional withFonts freetype
                 ;
 
-  propagatedBuildInputs = stdenv.lib.optional withAACS libaacs;
+  propagatedBuildInputs = optional withAACS libaacs;
+
+  NIX_LDFLAGS = [
+    (optionalString withAACS   "-L${libaacs}/lib -laacs")
+    (optionalString withBDplus "-L${libbdplus}/lib -lbdplus")
+  ];
 
   preConfigure = ''
     ${optionalString withJava ''export JDK_HOME="${jdk.home}"''}
-    ${optionalString withAACS ''export NIX_LDFLAGS="$NIX_LDFLAGS -L${libaacs}/lib -laacs"''}
-    ${optionalString withBDplus ''export NIX_LDFLAGS="$NIX_LDFLAGS -L${libbdplus}/lib -lbdplus"''}
   '';
 
   configureFlags =  with stdenv.lib;
@@ -50,14 +55,11 @@ stdenv.mkDerivation rec {
                  ++ optional (! withFonts) "--without-freetype"
                  ;
 
-  # Fix search path for BDJ jarfile
-  patches = stdenv.lib.optional withJava ./BDJ-JARFILE-path.patch;
-
   meta = with stdenv.lib; {
-    homepage = "http://www.videolan.org/developers/libbluray.html";
+    homepage = http://www.videolan.org/developers/libbluray.html;
     description = "Library to access Blu-Ray disks for video playback";
     license = licenses.lgpl21;
-    maintainers = [ maintainers.abbradar ];
+    maintainers = with maintainers; [ abbradar ];
     platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libbson/default.nix b/pkgs/development/libraries/libbson/default.nix
index 6d64df88d3f1..02e4529b759e 100644
--- a/pkgs/development/libraries/libbson/default.nix
+++ b/pkgs/development/libraries/libbson/default.nix
@@ -1,18 +1,18 @@
-{ autoconf, automake114x, fetchzip, libtool, perl, stdenv, which }:
-
-let
-  version = "1.1.10";
-in
+{ fetchFromGitHub, perl, stdenv, cmake }:
 
 stdenv.mkDerivation rec {
   name = "libbson-${version}";
+  version = "1.6.1";
 
-  src = fetchzip {
-    url = "https://github.com/mongodb/libbson/releases/download/${version}/libbson-${version}.tar.gz";
-    sha256 = "0zzca7zqvxf89fq7ji9626q8nnqyyh0dnmbk4xijzr9sq485xz0s";
+  src = fetchFromGitHub {
+    owner = "mongodb";
+    repo = "libbson";
+    rev = version;
+    sha256 = "1ilxbv4yjgf0vfzaa8lzn40hv5x1737ny2g2q1wmm8bl39m0viiw";
   };
 
-  buildInputs = [ autoconf automake114x libtool perl which ];
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ perl ];
 
   meta = with stdenv.lib; {
     description = "A C Library for parsing, editing, and creating BSON documents";
diff --git a/pkgs/development/libraries/libcouchbase/default.nix b/pkgs/development/libraries/libcouchbase/default.nix
index 2784cd90a5c6..24ec3d74d36f 100644
--- a/pkgs/development/libraries/libcouchbase/default.nix
+++ b/pkgs/development/libraries/libcouchbase/default.nix
@@ -1,21 +1,28 @@
-{ stdenv, fetchurl, cmake, pkgconfig, libevent, openssl}:
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, libevent, openssl}:
 
-stdenv.mkDerivation {
-  name = "libcouchbase-2.5.2";
-  src = fetchurl {
-    url = "https://github.com/couchbase/libcouchbase/archive/2.5.2.tar.gz";
-    sha256 = "0ka1hix38a2kdhxz6n8frssyznf78ra0irga9d8lr5683y73xw24";
+stdenv.mkDerivation rec {
+  name = "libcouchbase-${version}";
+  version = "2.7.2";
+
+  src = fetchFromGitHub {
+    owner = "couchbase";
+    repo ="libcouchbase";
+    rev = version;
+    sha256 = "1182r9z3cykkgx1vn36l0a50wvh5mr3yj89x0ynyjhfi3iwalrar";
   };
 
   cmakeFlags = "-DLCB_NO_MOCK=ON";
 
   nativeBuildInputs = [ cmake pkgconfig ];
-  buildInputs = [ libevent openssl];
+  buildInputs = [ libevent openssl ];
+
+  doCheck = true;
+  checkPhase = "ctest";
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "C client library for Couchbase";
     homepage = "https://github.com/couchbase/libcouchbase";
-    license = stdenv.lib.licenses.asl20;
-    platforms = stdenv.lib.platforms.unix;
+    license = licenses.asl20;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libdap/default.nix b/pkgs/development/libraries/libdap/default.nix
index 2e76c510bdda..e20b1c95a199 100644
--- a/pkgs/development/libraries/libdap/default.nix
+++ b/pkgs/development/libraries/libdap/default.nix
@@ -1,21 +1,22 @@
 { stdenv, fetchurl, bison, libuuid, curl, libxml2, flex }:
 
 stdenv.mkDerivation rec {
-  version = "3.15.1";
+  version = "3.18.3";
   name = "libdap-${version}";
 
-  buildInputs = [ bison libuuid curl libxml2 flex ];
+  nativeBuildInputs = [ bison flex ];
+  buildInputs = [ libuuid curl libxml2 ];
 
   src = fetchurl {
     url = "http://www.opendap.org/pub/source/${name}.tar.gz";
-    sha256 = "6ee13cc69ae0b5e7552ddfd17013ebb385859bba66f42a2cfba3b3be7aa4ef0f";
+    sha256 = "0azjf4gjqvp1fdf1wb3s98x52zfy4viq1m3j9lggaidldfinmv8c";
   };
 
-  meta = { 
+  meta = with stdenv.lib; {
     description = "A C++ SDK which contains an implementation of DAP";
     homepage = http://www.opendap.org/download/libdap;
-    license = stdenv.lib.licenses.lgpl2;
-    maintainers = [ stdenv.lib.maintainers.bzizou ];
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.lgpl2;
+    maintainers = [ maintainers.bzizou ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libdc1394/default.nix b/pkgs/development/libraries/libdc1394/default.nix
index c96a2b7f051a..c1d11ce87ee5 100644
--- a/pkgs/development/libraries/libdc1394/default.nix
+++ b/pkgs/development/libraries/libdc1394/default.nix
@@ -1,24 +1,24 @@
-{ stdenv, fetchurl, libraw1394, libusb1
-, CoreServices
-}:
+{ stdenv, fetchurl, libraw1394,
+libusb1, CoreServices }:
 
 stdenv.mkDerivation rec {
-  name = "libdc1394-2.2.3";
+  name = "libdc1394-${version}";
+  version = "2.2.5";
 
   src = fetchurl {
     url = "mirror://sourceforge/libdc1394/${name}.tar.gz";
-    sha256 = "1p9b4ciy97s04gmp7656cybr1zfd79hlw0ffhfb52m3zcn07h6aa";
+    sha256 = "0drk4sqvaym9glaraia25mj60rmwqbhy4j9h3x7gqpzfib8ch31m";
   };
 
   buildInputs = [ libusb1 ]
     ++ stdenv.lib.optional stdenv.isLinux libraw1394
     ++ stdenv.lib.optional stdenv.isDarwin CoreServices;
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = http://sourceforge.net/projects/libdc1394/;
     description = "Capture and control API for IIDC compliant cameras";
-    license = stdenv.lib.licenses.lgpl21Plus;
-    maintainers = [ stdenv.lib.maintainers.viric ];
-    platforms = stdenv.lib.platforms.unix;
+    license = licenses.lgpl21Plus;
+    maintainers = [ maintainers.viric ];
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libdiscid/default.nix b/pkgs/development/libraries/libdiscid/default.nix
index d0122d0283c5..c5da3816c41c 100644
--- a/pkgs/development/libraries/libdiscid/default.nix
+++ b/pkgs/development/libraries/libdiscid/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchurl, cmake, pkgconfig }:
 
 stdenv.mkDerivation rec {
-  name = "libdiscid-0.6.1";
-
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ cmake ];
+  name = "libdiscid-${version}";
+  version = "0.6.2";
 
+  nativeBuildInputs = [ cmake pkgconfig ];
+  
   src = fetchurl {
     url = "http://ftp.musicbrainz.org/pub/musicbrainz/libdiscid/${name}.tar.gz";
-    sha256 = "1mbd5y9056638cffpfwc6772xwrsk18prv1djsr6jpfim38jpsxc";
+    sha256 = "1f9irlj3dpb5gyfdnb1m4skbjvx4d4hwiz2152f83m0d9jn47r7r";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/libevdev/default.nix b/pkgs/development/libraries/libevdev/default.nix
index 3ff40141b164..a91acb230525 100644
--- a/pkgs/development/libraries/libevdev/default.nix
+++ b/pkgs/development/libraries/libevdev/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, python }:
 
 stdenv.mkDerivation rec {
-  name = "libevdev-1.4.6";
+  name = "libevdev-1.5.6";
 
   src = fetchurl {
-    url = "http://www.freedesktop.org/software/libevdev/${name}.tar.xz";
-    sha256 = "1lrja526iyg48yw6i0dxdhyj63q9gwbgvj6xk1hskxzrqyhf2akv";
+    url = "https://www.freedesktop.org/software/libevdev/${name}.tar.xz";
+    sha256 = "1256ypz93039n6km4macg158fpmjgylhmcmk20pnklxicsfpxv7c";
   };
 
   buildInputs = [ python ];
diff --git a/pkgs/development/libraries/libextractor/default.nix b/pkgs/development/libraries/libextractor/default.nix
index 6f1981d0ece7..0f21180f691c 100644
--- a/pkgs/development/libraries/libextractor/default.nix
+++ b/pkgs/development/libraries/libextractor/default.nix
@@ -7,11 +7,11 @@ assert gtkSupport -> glib != null && gtk3 != null;
 assert videoSupport -> ffmpeg != null && libmpeg2 != null;
 
 stdenv.mkDerivation rec {
-  name = "libextractor-1.2";
+  name = "libextractor-1.3";
 
   src = fetchurl {
     url = "mirror://gnu/libextractor/${name}.tar.gz";
-    sha256 = "1n7z6s5ils6xmf6b0z1xda41maxj94c1n6wlyyxmacs5lrkh2a96";
+    sha256 = "0zvv7wd011npcx7yphw9bpgivyxz6mlp87a57n96nv85k96dd2l6";
   };
 
   preConfigure =
diff --git a/pkgs/development/libraries/libfilezilla/default.nix b/pkgs/development/libraries/libfilezilla/default.nix
index 4df326e278cc..d6c0c538a8fe 100644
--- a/pkgs/development/libraries/libfilezilla/default.nix
+++ b/pkgs/development/libraries/libfilezilla/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "libfilezilla-${version}";
-  version = "0.9.0";
+  version = "0.9.1";
 
   src = fetchurl {
     url = "http://download.filezilla-project.org/libfilezilla/${name}.tar.bz2";
-    sha256 = "0340v5xs48f28q2d16ldb9359dkzlhl4l449mgyv3qabnlz2pl21";
+    sha256 = "06ivj40bk5b76a36zwhnwqvg564hgccncnn5nb5cqc7kf4bkkchq";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/libfixposix/default.nix b/pkgs/development/libraries/libfixposix/default.nix
index a0b03c4c0057..f56dc60771d6 100644
--- a/pkgs/development/libraries/libfixposix/default.nix
+++ b/pkgs/development/libraries/libfixposix/default.nix
@@ -1,28 +1,23 @@
-{ stdenv, fetchurl, fetchgit, autoreconfHook, libtool }:
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig }:
 
 stdenv.mkDerivation rec {
   name="libfixposix-${version}";
-  version="git-${src.rev}";
+  version="0.4.1";
 
-  src = fetchgit {
-    url = "https://github.com/sionescu/libfixposix";
-    rev = "30b75609d858588ea00b427015940351896867e9";
-    sha256 = "17spjz9vbgqllzlkws2abvqi0a71smhi4vgq3913aw0kq206mfxz";
+  src = fetchFromGitHub {
+    owner = "sionescu";
+    repo = "libfixposix";
+    rev = "v${version}";
+    sha256 = "19wjb43mn16f4lin5a2dfi3ym2hy7kqibs0z631d205b16vxas15";
   };
 
-  buildInputs = [ autoreconfHook libtool ];
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
 
   meta = with stdenv.lib; {
-    description = "A set of workarounds for places in POSIX that get implemented differently";
-    maintainers = with maintainers;
-    [
-      raskin
-    ];
+    homepage = https://github.com/sionescu/libfixposix;
+    description = "Thin wrapper over POSIX syscalls and some replacement functionality";
+    license = licenses.boost;
+    maintainers = with maintainers; [ orivej raskin ];
     platforms = platforms.linux;
   };
-  passthru = {
-    updateInfo = {
-      downloadPage = "http://gitorious.org/libfixposix/libfixposix";
-    };
-  };
 }
diff --git a/pkgs/development/libraries/libhttpseverywhere/default.nix b/pkgs/development/libraries/libhttpseverywhere/default.nix
index cf38f117bb8c..1e60a63fe06b 100644
--- a/pkgs/development/libraries/libhttpseverywhere/default.nix
+++ b/pkgs/development/libraries/libhttpseverywhere/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   major = "0.2";
-  minor = "3";
+  minor = "10";
   version = "${major}.${minor}";
 
   name = "libhttpseverywhere-${version}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/libhttpseverywhere/${major}/libhttpseverywhere-${version}.tar.xz";
-    sha256 = "0ndk6yyfcd7iwwkv4rkivhd08k0x8v03gnp9dk1ms4bxb1l2i8l1";
+    sha256 = "235f5b7f96188d800470871774e31696fbde085b63f65bd71434af8e9e6ac8aa";
   };
 
   nativeBuildInputs = [ gnome3.vala valadoc  gobjectIntrospection meson ninja pkgconfig ];
@@ -23,8 +23,7 @@ stdenv.mkDerivation rec {
 
   buildPhase = ''
     ninja
-    ninja devhelp
-  '';
+   '';
 
   installPhase = "ninja install";
 
diff --git a/pkgs/development/libraries/libibmad/default.nix b/pkgs/development/libraries/libibmad/default.nix
index fad5c5d73f42..6a8af9ccac6d 100644
--- a/pkgs/development/libraries/libibmad/default.nix
+++ b/pkgs/development/libraries/libibmad/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, libibumad }:
 
 stdenv.mkDerivation rec {
-  name = "libibmad-1.3.12";
+  name = "libibmad-1.3.13";
 
   src = fetchurl {
     url = "https://www.openfabrics.org/downloads/management/${name}.tar.gz";
-    sha256 = "0ywkz0rskci414r6h6jd4iz4qjbj37ga2k91z1mlj9xrnl9bbgzi";
+    sha256 = "02sj8k2jpcbiq8s0l2lqk4vwji2dbb2lc730cv1yzv0zr0hxgk8p";
   };
 
   buildInputs = [ libibumad ];
diff --git a/pkgs/development/libraries/libircclient/default.nix b/pkgs/development/libraries/libircclient/default.nix
index 14e41961e0a6..fef5e7278b81 100644
--- a/pkgs/development/libraries/libircclient/default.nix
+++ b/pkgs/development/libraries/libircclient/default.nix
@@ -26,6 +26,6 @@ stdenv.mkDerivation rec {
     homepage    = http://www.ulduzsoft.com/libircclient/;
     license     = licenses.lgpl3;
     maintainers = with maintainers; [ obadz ];
-    platforms   = platforms.all;
+    platforms   = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libmsgpack/generic.nix b/pkgs/development/libraries/libmsgpack/generic.nix
index 72943c098ba1..2da703da4cfd 100644
--- a/pkgs/development/libraries/libmsgpack/generic.nix
+++ b/pkgs/development/libraries/libmsgpack/generic.nix
@@ -8,7 +8,12 @@ stdenv.mkDerivation rec {
 
   inherit src patches;
 
-  buildInputs = [ cmake ];
+  nativeBuildInputs = [ cmake ];
+
+  crossAttrs = {
+  } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") {
+    cmakeFlags = "-DMSGPACK_BUILD_EXAMPLES=OFF -DCMAKE_SYSTEM_NAME=Windows";
+  };
 
   meta = with stdenv.lib; {
     description = "MessagePack implementation for C and C++";
diff --git a/pkgs/development/libraries/libp11/default.nix b/pkgs/development/libraries/libp11/default.nix
index 91195229d87a..26e754317df0 100644
--- a/pkgs/development/libraries/libp11/default.nix
+++ b/pkgs/development/libraries/libp11/default.nix
@@ -1,21 +1,25 @@
 { stdenv, fetchFromGitHub, autoreconfHook, libtool, openssl, pkgconfig }:
 
 stdenv.mkDerivation rec {
-  name = "libp11-0.2.7";
+  name = "libp11-${version}";
+  version = "0.4.4";
 
   src = fetchFromGitHub {
     owner = "OpenSC";
     repo = "libp11";
     rev = name;
-    sha256 = "0llw69kcb6nvz7zzkb9nyfyhc2s972q68sqciabqxwxljr09c411";
+    sha256 = "1jnpnwipmw3skw112qff36w046nyz5amiil228rn5divpkvx4axa";
   };
 
+  makeFlags = [ "DESTDIR=$(out)" "PREFIX=" ];
+
   nativeBuildInputs = [ autoreconfHook pkgconfig libtool ];
   buildInputs = [ openssl ];
 
-  meta = {
-    homepage = http://www.opensc-project.org/libp11/;
-    license = "LGPL";
+  meta = with stdenv.lib; {
+    homepage = https://github.com/OpenSC/libp11;
+    license = licenses.lgpl21Plus;
     description = "Small layer on top of PKCS#11 API to make PKCS#11 implementations easier";
+    platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/libseccomp/default.nix b/pkgs/development/libraries/libseccomp/default.nix
index a086ae890bd0..1575a60ec699 100644
--- a/pkgs/development/libraries/libseccomp/default.nix
+++ b/pkgs/development/libraries/libseccomp/default.nix
@@ -1,26 +1,30 @@
-{ stdenv, fetchurl, getopt }:
-
-let version = "2.3.1"; in
+{ stdenv, fetchurl, getopt, makeWrapper }:
 
 stdenv.mkDerivation rec {
   name = "libseccomp-${version}";
+  version = "2.3.2";
 
   src = fetchurl {
     url = "https://github.com/seccomp/libseccomp/releases/download/v${version}/libseccomp-${version}.tar.gz";
-    sha256 = "0asnlkzqms520r0dra08dzcz5hh6hs7lkajfw9wij3vrd0hxsnzz";
+    sha256 = "3ddc8c037956c0a5ac19664ece4194743f59e1ccd4adde848f4f0dae7f77bca1";
   };
 
-  buildInputs = [ getopt ];
+  buildInputs = [ getopt makeWrapper ];
 
   patchPhase = ''
     patchShebangs .
   '';
 
+  postInstall = ''
+    wrapProgram $out/bin/scmp_sys_resolver --prefix LD_LIBRARY_PATH ":" $out/lib
+  '';
+
   meta = with stdenv.lib; {
     description = "High level library for the Linux Kernel seccomp filter";
-    homepage    = "http://sourceforge.net/projects/libseccomp";
-    license     = licenses.lgpl2;
+    homepage    = "https://github.com/seccomp/libseccomp";
+    license     = licenses.lgpl21;
     platforms   = platforms.linux;
     maintainers = with maintainers; [ thoughtpolice wkennington ];
   };
 }
+
diff --git a/pkgs/development/libraries/libsodium/default.nix b/pkgs/development/libraries/libsodium/default.nix
index e0ad21008046..bfe224d28cd6 100644
--- a/pkgs/development/libraries/libsodium/default.nix
+++ b/pkgs/development/libraries/libsodium/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "libsodium-1.0.11";
+  name = "libsodium-1.0.12";
 
   src = fetchurl {
     url = "https://download.libsodium.org/libsodium/releases/${name}.tar.gz";
-    sha256 = "0rf7z6bgpnf8lyz8sph4h43fbb28pmj4dgybf0hsxxj97kdljid1";
+    sha256 = "159givfh5jgli3cifxgssivkklfyfq6lzyjgrx8h4jx5ncdqyr5q";
   };
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/libzip/default.nix b/pkgs/development/libraries/libzip/default.nix
index d1f2e633a0c5..9958a65d408b 100644
--- a/pkgs/development/libraries/libzip/default.nix
+++ b/pkgs/development/libraries/libzip/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "libzip-${version}";
-  version = "1.1.2";
+  version = "1.2.0";
 
   src = fetchurl {
     url = "http://www.nih.at/libzip/${name}.tar.gz";
-    sha256 = "08b26qbfxq6z5xf36y1d8insm5valv83dhj933iag6man04prb2r";
+    sha256 = "17vxj2ffsxwh8lkc6801ppmwj15jp8q58rin76znxfbx88789ybc";
   };
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/liquid-dsp/default.nix b/pkgs/development/libraries/liquid-dsp/default.nix
new file mode 100644
index 000000000000..391606d59e68
--- /dev/null
+++ b/pkgs/development/libraries/liquid-dsp/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  name = "liquid-dsp-${version}";
+  version = "20170307";
+
+  src = fetchFromGitHub {
+    owner = "jgaeddert";
+    repo = "liquid-dsp";
+    rev = "8c1978fa4f5662b8849fe712be716958f29cec0e";
+    sha256 = "0zpxvdsrw0vzzp3iaag3wh4z8ygl7fkswgjppp2fz2zhhqh93k2w";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  meta = {
+    homepage = http://liquidsdr.org/;
+    description = "Digital signal processing library for software-defined radios";
+    license = stdenv.lib.licenses.mit;
+    platforms = stdenv.lib.platforms.unix;
+  };
+
+}
diff --git a/pkgs/development/libraries/msilbc/default.nix b/pkgs/development/libraries/msilbc/default.nix
index 1e868b79ce66..c7d65f156b8b 100644
--- a/pkgs/development/libraries/msilbc/default.nix
+++ b/pkgs/development/libraries/msilbc/default.nix
@@ -2,18 +2,19 @@
 
 stdenv.mkDerivation rec {
   name = "msilbc-2.0.3";
-  
+
   src = fetchurl {
     url = "mirror://savannah/linphone/plugins/sources/${name}.tar.gz";
     sha256 = "125yadpc0w1q84839dadin3ahs0gxxfas0zmc4c18mjmf58dmm7d";
   };
 
-#  patchPhase = "sed -i /MS_FILTER_SET_FMTP/d ilbc.c";
-
-  propagatedBuildInputs = [ilbc mediastreamer];
+  propagatedBuildInputs = [ ilbc mediastreamer ];
+  nativeBuildInputs = [ pkgconfig ];
 
-  buildInputs = [pkgconfig];
-  configureFlags = "ILBC_LIBS=ilbc ILBC_CFLAGS=-I${ilbc}/include";
+  configureFlags = [
+    "ILBC_LIBS=ilbc" "ILBC_CFLAGS=-I${ilbc}/include"
+    "MEDIASTREAMER_LIBS=mediastreamer" "MEDIASTREAMER_CFLAGS=-I${mediastreamer}/include"
+  ];
 
   meta = {
     platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/development/libraries/nghttp2/default.nix b/pkgs/development/libraries/nghttp2/default.nix
index aee0b3d7116c..5fb9cc36e962 100644
--- a/pkgs/development/libraries/nghttp2/default.nix
+++ b/pkgs/development/libraries/nghttp2/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, pkgconfig
 
 # Optional Dependencies
-, openssl ? null, libev ? null, zlib ? null, libcares ? null
+, openssl ? null, libev ? null, zlib ? null, c-ares ? null
 , enableHpack ? false, jansson ? null
 , enableAsioLib ? false, boost ? null
 , enableGetAssets ? false, libxml2 ? null
@@ -17,18 +17,18 @@ with { inherit (stdenv.lib) optional; };
 
 stdenv.mkDerivation rec {
   name = "nghttp2-${version}";
-  version = "1.19.0";
+  version = "1.20.0";
 
   # Don't use fetchFromGitHub since this needs a bootstrap curl
   src = fetchurl {
     url = "https://github.com/nghttp2/nghttp2/releases/download/v${version}/nghttp2-${version}.tar.bz2";
-    sha256 = "477466eee27158d37b4478d9335dd091497cae4d7f2375fc6657beab67db9e7a";
+    sha256 = "fb29d0500b194f11680203aed21aafab241063ec1397cc51ab5cc0957341141b";
   };
 
   outputs = [ "out" "dev" "lib" ];
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ openssl libev zlib libcares ]
+  buildInputs = [ openssl libev zlib c-ares ]
     ++ optional enableHpack jansson
     ++ optional enableAsioLib boost
     ++ optional enableGetAssets libxml2
@@ -36,8 +36,14 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  configureFlags = [ "--with-spdylay=no" "--disable-examples" "--disable-python-bindings" ]
+    ++ optional enableAsioLib "--enable-asio-lib --with-boost-libdir=${boost}/lib";
+
+  #doCheck = true;  # requires CUnit ; currently failing at test_util_localtime_date in util_test.cc
+
+
   meta = with stdenv.lib; {
-    homepage = http://nghttp2.org/;
+    homepage = https://nghttp2.org/;
     description = "A C implementation of HTTP/2";
     license = licenses.mit;
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 2591a43f1d47..947c0e30f993 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -19,6 +19,7 @@ let
 
     patches =
       (args.patches or [])
+      ++ [ ./nix-ssl-cert-file.patch ]
       ++ optional (versionOlder version "1.1.0") ./use-etc-ssl-certs.patch
       ++ optional stdenv.isCygwin ./1.0.1-cygwin64.patch
       ++ optional
diff --git a/pkgs/development/libraries/openssl/nix-ssl-cert-file.patch b/pkgs/development/libraries/openssl/nix-ssl-cert-file.patch
new file mode 100644
index 000000000000..b615f1482b7c
--- /dev/null
+++ b/pkgs/development/libraries/openssl/nix-ssl-cert-file.patch
@@ -0,0 +1,14 @@
+diff -ru -x '*~' openssl-1.0.2j-orig/crypto/x509/by_file.c openssl-1.0.2j/crypto/x509/by_file.c
+--- openssl-1.0.2j-orig/crypto/x509/by_file.c	2016-09-26 11:49:07.000000000 +0200
++++ openssl-1.0.2j/crypto/x509/by_file.c	2016-10-13 16:54:31.400288302 +0200
+@@ -97,7 +97,9 @@
+     switch (cmd) {
+     case X509_L_FILE_LOAD:
+         if (argl == X509_FILETYPE_DEFAULT) {
+-            file = (char *)getenv(X509_get_default_cert_file_env());
++            file = (char *)getenv("NIX_SSL_CERT_FILE");
++            if (!file)
++                file = (char *)getenv(X509_get_default_cert_file_env());
+             if (file)
+                 ok = (X509_load_cert_crl_file(ctx, file,
+                                               X509_FILETYPE_PEM) != 0);
diff --git a/pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch b/pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch
new file mode 100644
index 000000000000..39c1b9c0d290
--- /dev/null
+++ b/pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch
@@ -0,0 +1,13 @@
+Index: phonon-gstreamer-4.9.0/gstreamer/backend.cpp
+===================================================================
+--- phonon-gstreamer-4.9.0.orig/gstreamer/backend.cpp
++++ phonon-gstreamer-4.9.0/gstreamer/backend.cpp
+@@ -85,6 +85,8 @@ Backend::Backend(QObject *parent, const
+         "--gst-debug-no-color"
+     };
+ 
++    qputenv("GST_PLUGIN_PATH_1_0", GST_PLUGIN_PATH_1_0);
++
+     int argc = sizeof(args) / sizeof(*args);
+     char **argv = const_cast<char**>(args);
+     GError *err = 0;
diff --git a/pkgs/development/libraries/phonon/backends/gstreamer.nix b/pkgs/development/libraries/phonon/backends/gstreamer.nix
index d8358757094d..e0f24fbc822a 100644
--- a/pkgs/development/libraries/phonon/backends/gstreamer.nix
+++ b/pkgs/development/libraries/phonon/backends/gstreamer.nix
@@ -29,15 +29,32 @@ stdenv.mkDerivation rec {
     sha256 = "1wc5p1rqglf0n1avp55s50k7fjdzdrhg0gind15k8796w7nfbhyf";
   };
 
+  # Hardcode paths to useful plugins so the backend doesn't depend
+  # on system paths being set.
+  patches = [ ./gst-plugin-paths.patch ];
+
+  NIX_CFLAGS_COMPILE =
+    let gstPluginPaths =
+          lib.makeSearchPathOutput "lib" "/lib/gstreamer-1.0"
+          (with gst_all_1; [
+            gstreamer
+            gst-plugins-base
+            gst-plugins-good
+            gst-plugins-ugly
+            gst-plugins-bad
+            gst-libav
+          ]);
+    in [
+      # This flag should be picked up through pkgconfig, but it isn't.
+      "-I${gst_all_1.gstreamer.dev}/lib/gstreamer-1.0/include"
+
+      ''-DGST_PLUGIN_PATH_1_0="${gstPluginPaths}"''
+    ];
+
   buildInputs = with gst_all_1;
     [ gstreamer gst-plugins-base phonon ]
     ++ (if withQt5 then [ qtbase qtx11extras ] else [ qt4 ]);
 
-  NIX_CFLAGS_COMPILE = [
-    # This flag should be picked up through pkgconfig, but it isn't.
-    "-I${gst_all_1.gstreamer.dev}/lib/gstreamer-1.0/include"
-  ];
-
   # cleanup: the build system creates (empty) $out/$out/share/icons (double prefix)
   # if DESTDIR is unset
   DESTDIR="/";
diff --git a/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix
index c4e7689efa29..ea04ca627284 100644
--- a/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.5/qtbase/default.nix
@@ -55,7 +55,7 @@ stdenv.mkDerivation {
   patches =
     copyPathsToStore (lib.readPathsFromFile ./. ./series)
     ++ lib.optional decryptSslTraffic ./decrypt-ssl-traffic.patch
-    ++ lib.optional mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
+    ++ lib.optionals mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
 
   postPatch =
     ''
diff --git a/pkgs/development/libraries/qt-5/5.6/default.nix b/pkgs/development/libraries/qt-5/5.6/default.nix
index 37b6eb7f3d3c..cc6475d31b64 100644
--- a/pkgs/development/libraries/qt-5/5.6/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/default.nix
@@ -114,9 +114,9 @@ let
       env = callPackage ../qt-env.nix {};
       full = env "qt-${qtbase.version}" [
         qtconnectivity qtdeclarative qtdoc qtenginio qtgraphicaleffects
-        qtimageformats qtlocation qtmultimedia qtquickcontrols qtscript
-        qtsensors qtserialport qtsvg qttools qttranslations qtwayland
-        qtwebchannel qtwebengine qtwebsockets qtx11extras qtxmlpatterns
+        qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2
+        qtscript qtsensors qtserialport qtsvg qttools qttranslations qtwayland
+        qtwebchannel qtwebengine qtwebkit qtwebsockets qtx11extras qtxmlpatterns
       ];
 
       makeQtWrapper =
diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
index 60a3896abafb..6f9ec5607122 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation {
     copyPathsToStore (lib.readPathsFromFile ./. ./series)
     ++ [(if stdenv.isDarwin then ./cmake-paths-darwin.patch else ./cmake-paths.patch)]
     ++ lib.optional decryptSslTraffic ./decrypt-ssl-traffic.patch
-    ++ lib.optional mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
+    ++ lib.optionals mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
 
   postPatch =
     ''
diff --git a/pkgs/development/libraries/qt-5/5.7/default.nix b/pkgs/development/libraries/qt-5/5.7/default.nix
index 85b38c6fc6ce..f387a242101b 100644
--- a/pkgs/development/libraries/qt-5/5.7/default.nix
+++ b/pkgs/development/libraries/qt-5/5.7/default.nix
@@ -98,21 +98,22 @@ let
 
       env = callPackage ../qt-env.nix {};
       full = env "qt-${qtbase.version}" [
-        qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
-        qtimageformats qtlocation qtmultimedia qtquickcontrols qtscript
+        qtconnectivity qtdeclarative qtdoc qtgraphicaleffects qtimageformats
+        qtlocation qtmultimedia qtquickcontrols qtquickcontrols2 qtscript
         qtsensors qtserialport qtsvg qttools qttranslations qtwayland
-        qtwebsockets qtx11extras qtxmlpatterns
+        qtwebchannel qtwebengine qtwebkit qtwebsockets qtx11extras
+        qtxmlpatterns
       ];
 
       makeQtWrapper =
         makeSetupHook
         { deps = [ makeWrapper ]; }
-        ../make-qt-wrapper.sh;
+        (if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh);
 
       qmakeHook =
         makeSetupHook
         { deps = [ self.qtbase.dev ]; }
-        ../qmake-hook.sh;
+        (if stdenv.isDarwin then ../qmake-hook-darwin.sh else ../qmake-hook.sh);
 
     };
 
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths-darwin.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths-darwin.patch
new file mode 100644
index 000000000000..2fda5ed8cf0c
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths-darwin.patch
@@ -0,0 +1,384 @@
+Index: qtbase-opensource-src-5.7.1/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ qtbase-opensource-src-5.7.1/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -9,30 +9,6 @@ if (CMAKE_VERSION VERSION_LESS 3.0.0)
+ endif()
+ !!ENDIF
+ 
+-!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+-!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ELSE
+-get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+-# Use original install prefix when loaded through a
+-# cross-prefix symbolic link such as /lib -> /usr/lib.
+-get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+-get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH)
+-if(_realCurr STREQUAL _realOrig)
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+-else()
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-endif()
+-unset(_realOrig)
+-unset(_realCurr)
+-unset(_IMPORT_PREFIX)
+-!!ENDIF
+-!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-!!ELSE
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ENDIF
+-
+ !!IF !equals(TEMPLATE, aux)
+ # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
+ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION).$$eval(QT.$${MODULE}.MINOR_VERSION).$$eval(QT.$${MODULE}.PATCH_VERSION)")
+@@ -59,7 +35,10 @@ macro(_populate_$${CMAKE_MODULE_NAME}_ta
+     set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"@NIX_OUT@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    if(NOT EXISTS \"${imported_location}\")
++        set(imported_location \"@NIX_DEV@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    endif()
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+@@ -74,45 +53,17 @@ macro(_populate_$${CMAKE_MODULE_NAME}_ta
+         \"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+     )
+ 
+-!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ELSE
+-    set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ENDIF
+-    _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
+-    if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
+-        set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+-        \"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
+-        )
+-    endif()
+-!!ENDIF
+ endmacro()
+ !!ENDIF
+ 
+ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ 
+ !!IF !no_module_headers
+-!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
+-    )
+-!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+-    )
+-!!ELSE
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+-!!ENDIF
+-!!ELSE
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
++    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"@NIX_OUT@/lib\" \"@NIX_OUT@/lib/$${MODULE_INCNAME}.framework/Headers\")
+ !!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
++        \"\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -128,7 +80,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+ !!ENDIF
+ !!ENDIF
+-!!ENDIF
++
+ !!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
+     include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
+ !!ENDIF
+@@ -253,28 +205,19 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+ 
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_DEBUG_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+-    if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+-        _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
++        \"@NIX_OUT@/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+ !!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+ !!ENDIF
+       AND EXISTS
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
++        \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+ !!ENDIF // CMAKE_DEBUG_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+@@ -282,36 +225,23 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+ !!ENDIF // CMAKE_RELEASE_TYPE
+ 
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-    _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+-!!ELSE
+     _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+ 
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_RELEASE_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+-    if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+-        _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
+-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
++        \"@NIX_OUT@/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+ !!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+ !!ENDIF
+       AND EXISTS
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
++        \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+ !!ENDIF // CMAKE_RELEASE_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+@@ -328,11 +258,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+-        set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ELSE
+-        set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ENDIF
++        set(imported_location \"${PLUGIN_LOCATION}\")
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+Index: qtbase-opensource-src-5.7.1/src/gui/Qt5GuiConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/gui/Qt5GuiConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.1/src/gui/Qt5GuiConfigExtras.cmake.in
+@@ -2,7 +2,7 @@
+ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+ 
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"@NIX_DEV@/$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ELSE
+ set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ENDIF
+@@ -17,13 +17,13 @@ macro(_populate_qt5gui_gl_target_propert
+     set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"@NIX_OUT@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
++    set(imported_implib \"@NIX_DEV@/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/widgets/Qt5WidgetsConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.1/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::uic)
+     add_executable(Qt5::uic IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qmake)
+     add_executable(Qt5::qmake IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::moc)
+     add_executable(Qt5::moc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -35,7 +35,7 @@ if (NOT TARGET Qt5::rcc)
+     add_executable(Qt5::rcc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -131,7 +131,7 @@ if (NOT TARGET Qt5::WinMain)
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ENDIF
+@@ -145,7 +145,7 @@ if (NOT TARGET Qt5::WinMain)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
++++ qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"@NIX_DEV@/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
++++ qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"@NIX_DEV@/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/src/dbus/Qt5DBusConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/dbus/Qt5DBusConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.1/src/dbus/Qt5DBusConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qdbuscpp2xml)
+     add_executable(Qt5::qdbuscpp2xml IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::qdbusxml2cpp)
+     add_executable(Qt5::qdbusxml2cpp IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/mkspecs/features/create_cmake.prf
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/mkspecs/features/create_cmake.prf
++++ qtbase-opensource-src-5.7.1/mkspecs/features/create_cmake.prf
+@@ -136,28 +136,28 @@ contains(CONFIG, plugin) {
+ 
+     win32 {
+         isEmpty(CMAKE_STATIC_TYPE) {
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.dll
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.dll
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}.dll
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}d.dll
+         } else:mingw {
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}.a
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}d.a
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}/$$PLUGIN_TYPE/lib$${TARGET}.a
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}d.a
+         } else {                         # MSVC static
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.lib
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.lib
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}.lib
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}d.lib
+         }
+     } else {
+         mac {
+             isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .dylib
+             else: CMAKE_PlUGIN_EXT = .a
+ 
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+         } else {
+             isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .so
+             else: CMAKE_PlUGIN_EXT = .a
+ 
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+         }
+     }
+     cmake_target_file.input = $$PWD/data/cmake/Qt5PluginTarget.cmake.in
+Index: qtbase-opensource-src-5.7.1/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ qtbase-opensource-src-5.7.1/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -2,10 +2,10 @@
+ add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
+ 
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"@NIX_OUT@/$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"@NIX_OUT@/$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+ !!ENDIF
+ 
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
index 73df6726f4a7..4bf16004ce51 100644
--- a/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
@@ -4,6 +4,7 @@
 
   coreutils, bison, flex, gdb, gperf, lndir, patchelf, perl, pkgconfig, python2,
   ruby,
+  darwin, libiconv,
 
   dbus, fontconfig, freetype, glib, gtk3, harfbuzz, icu, libX11, libXcomposite,
   libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng, libtiff,
@@ -15,7 +16,8 @@
   cups ? null, mysql ? null, postgresql ? null,
 
   # options
-  mesaSupported, mesa,
+  mesaSupported ? (!stdenv.isDarwin),
+  mesa,
   buildExamples ? false,
   buildTests ? false,
   developerBuild ? false,
@@ -35,8 +37,9 @@ stdenv.mkDerivation {
 
   patches =
     copyPathsToStore (lib.readPathsFromFile ./. ./series)
+    ++ [(if stdenv.isDarwin then ./cmake-paths-darwin.patch else ./cmake-paths.patch)]
     ++ lib.optional decryptSslTraffic ./decrypt-ssl-traffic.patch
-    ++ lib.optional mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
+    ++ lib.optionals mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
 
   postPatch =
     ''
@@ -54,11 +57,11 @@ stdenv.mkDerivation {
       substituteInPlace src/network/kernel/qhostinfo_unix.cpp \
         --replace "@glibc@" "${stdenv.cc.libc.out}"
 
-      substituteInPlace src/plugins/platforms/xcb/qxcbcursor.cpp \
-        --replace "@libXcursor@" "${libXcursor.out}"
-
       substituteInPlace src/network/ssl/qsslsocket_openssl_symbols.cpp \
         --replace "@openssl@" "${openssl.out}"
+    '' + lib.optionalString stdenv.isLinux ''
+      substituteInPlace src/plugins/platforms/xcb/qxcbcursor.cpp \
+        --replace "@libXcursor@" "${libXcursor.out}"
 
       substituteInPlace src/dbus/qdbus_symbols.cpp \
         --replace "@dbus_libs@" "${dbus.lib}"
@@ -74,8 +77,23 @@ stdenv.mkDerivation {
       substituteInPlace mkspecs/common/linux.conf \
         --replace "@mesa_lib@" "${mesa.out}" \
         --replace "@mesa_inc@" "${mesa.dev or mesa}"
-    '';
-
+    ''+ lib.optionalString stdenv.isDarwin ''
+      sed -i \
+          -e 's|! /usr/bin/xcode-select --print-path >/dev/null 2>&1;|false;|' \
+          -e 's|! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1;|false;|' \
+          -e 's|sysroot=$(/usr/bin/xcodebuild -sdk $sdk -version Path 2>/dev/null)|sysroot="${darwin.apple_sdk.sdk}"|' \
+          -e 's|QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`|QMAKE_CXX="clang++"\nQMAKE_CONF_COMPILER="clang++"|' \
+          -e 's|XCRUN=`/usr/bin/xcrun -sdk macosx clang -v 2>&1`|XCRUN="clang -v 2>&1"|' \
+          -e 's#sdk_val=$(/usr/bin/xcrun -sdk $sdk -find $(echo $val | cut -d \x27 \x27 -f 1))##' \
+          -e 's#val=$(echo $sdk_val $(echo $val | cut -s -d \x27 \x27 -f 2-))##' \
+          ./configure
+      sed -i '3,$d' ./mkspecs/features/mac/default_pre.prf
+      sed -i '26,$d' ./mkspecs/features/mac/default_post.prf
+      sed -i '1,$d' ./mkspecs/features/mac/sdk.prf
+      sed 's/QMAKE_LFLAGS_RPATH      = -Wl,-rpath,/QMAKE_LFLAGS_RPATH      =/' -i ./mkspecs/common/mac.conf
+     '';
+     # Note on the above: \x27 is a way if including a single-quote
+     # character in the sed string arguments.
 
   setOutputFlags = false;
   preConfigure = ''
@@ -103,7 +121,6 @@ stdenv.mkDerivation {
     ${lib.optionalString developerBuild "-developer-build"}
     -largefile
     -accessibility
-    -rpath
     -optimized-qmake
     -strip
     -no-reduce-relocations
@@ -117,15 +134,6 @@ stdenv.mkDerivation {
     -iconv
     -icu
     -pch
-    -glib
-    -xcb
-    -qpa xcb
-    -${lib.optionalString (cups == null) "no-"}cups
-
-    -no-eglfs
-    -no-directfb
-    -no-linuxfb
-    -no-kms
 
     ${lib.optionalString (!system-x86_64) "-no-sse2"}
     -no-sse3
@@ -141,13 +149,8 @@ stdenv.mkDerivation {
     -system-libpng
     -system-libjpeg
     -system-harfbuzz
-    -system-xcb
-    -system-xkbcommon
     -system-pcre
     -openssl-linked
-    -dbus-linked
-    -libinput
-    -gtk
 
     -system-sqlite
     -${if mysql != null then "plugin" else "no"}-sql-mysql
@@ -158,7 +161,30 @@ stdenv.mkDerivation {
     -${lib.optionalString (buildExamples == false) "no"}make examples
     -${lib.optionalString (buildTests == false) "no"}make tests
     -v
-  '';
+  '' + lib.optionalString (!stdenv.isDarwin) ''
+    -no-rpath
+    -glib
+    -xcb
+    -qpa xcb
+
+    -${lib.optionalString (cups == null) "no-"}cups
+
+    -no-eglfs
+    -no-directfb
+    -no-linuxfb
+    -no-kms
+
+    -libinput
+    -gtk
+    -system-xcb
+    -system-xkbcommon
+    -dbus-linked
+  '' + lib.optionalString stdenv.isDarwin ''
+    -platform macx-clang
+    -no-use-gold-linker
+    -no-fontconfig
+    -qt-freetype
+   '';
 
   # PostgreSQL autodetection fails sporadically because Qt omits the "-lpq" flag
   # if dependency paths contain the string "pq", which can occur in the hash.
@@ -166,32 +192,44 @@ stdenv.mkDerivation {
   PSQL_LIBS = lib.optionalString (postgresql != null) "-L${postgresql.lib}/lib -lpq";
 
   propagatedBuildInputs = [
-    dbus glib libxml2 libxslt openssl pcre16 sqlite udev zlib
+    libxml2 libxslt openssl pcre16 sqlite zlib
+
+    # Text rendering
+    harfbuzz icu
 
     # Image formats
     libjpeg libpng libtiff
+  ]
+  ++ lib.optional mesaSupported mesa
+  ++ lib.optionals (!stdenv.isDarwin) [
+    dbus glib udev
 
     # Text rendering
-    fontconfig freetype harfbuzz icu
+    fontconfig freetype
 
     # X11 libs
     libX11 libXcomposite libXext libXi libXrender libxcb libxkbcommon xcbutil
     xcbutilimage xcbutilkeysyms xcbutilrenderutil xcbutilwm
-  ]
-  ++ lib.optional mesaSupported mesa;
+   ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    ApplicationServices CoreServices AppKit Carbon OpenGL AGL Cocoa
+    DiskArbitration darwin.cf-private libiconv darwin.apple_sdk.sdk
+  ]);
 
-  buildInputs =
-    [ gtk3 libinput ]
+  buildInputs = [ ]
+    ++ lib.optionals (!stdenv.isDarwin) [ gtk3 libinput ]
     ++ lib.optional developerBuild gdb
     ++ lib.optional (cups != null) cups
     ++ lib.optional (mysql != null) mysql.lib
     ++ lib.optional (postgresql != null) postgresql;
 
-  nativeBuildInputs =
-    [ bison flex gperf lndir patchelf perl pkgconfig python2 ];
+  nativeBuildInputs = [ bison flex gperf lndir perl pkgconfig python2 ] ++ lib.optional (!stdenv.isDarwin) patchelf;
 
   # freetype-2.5.4 changed signedness of some struct fields
-  NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare";
+  NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare"
+    + lib.optionalString stdenv.isDarwin " -D__MAC_OS_X_VERSION_MAX_ALLOWED=1090 -D__AVAILABILITY_INTERNAL__MAC_10_10=__attribute__((availability(macosx,introduced=10.10)))";
+  # Note that nixpkgs's objc4 is from macOS 10.11 while the SDK is
+  # 10.9 which necessitates the above macro definition that mentions
+  # 10.10
 
   postInstall = ''
     find "$out" -name "*.cmake" | while read file; do
@@ -221,7 +259,7 @@ stdenv.mkDerivation {
       # Move libtool archives and qmake projects
       if [ "z''${!outputLib}" != "z''${!outputDev}" ]; then
           pushd "''${!outputLib}"
-          find lib -name '*.a' -o -name '*.la' -o -name '*.prl' | \
+          find lib -name '*.a' -o -name '*.la'${if stdenv.isDarwin then "" else "-o -name '*.prl'"} | \
               while read -r file; do
                   mkdir -p "''${!outputDev}/$(dirname "$file")"
                   mv "''${!outputLib}/$file" "''${!outputDev}/$file"
@@ -258,7 +296,9 @@ stdenv.mkDerivation {
     '';
 
   inherit lndir;
-  setupHook = ../../qtbase-setup-hook.sh;
+  setupHook = if stdenv.isDarwin
+              then ../../qtbase-setup-hook-darwin.sh
+              else ../../qtbase-setup-hook.sh;
 
   enableParallelBuilding = true;
 
@@ -267,7 +307,7 @@ stdenv.mkDerivation {
     description = "A cross-platform application framework for C++";
     license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
     maintainers = with maintainers; [ bbenoist qknight ttuegel ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 
 }
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/series b/pkgs/development/libraries/qt-5/5.7/qtbase/series
index 44e2d9040807..2196d8383752 100644
--- a/pkgs/development/libraries/qt-5/5.7/qtbase/series
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/series
@@ -7,4 +7,3 @@ xdg-config-dirs.patch
 nix-profiles-library-paths.patch
 compose-search-path.patch
 libressl.patch
-cmake-paths.patch
diff --git a/pkgs/development/libraries/qt-5/5.7/qtmultimedia.nix b/pkgs/development/libraries/qt-5/5.7/qtmultimedia.nix
index 7c1cc5da07e3..a48dd38ae6d2 100644
--- a/pkgs/development/libraries/qt-5/5.7/qtmultimedia.nix
+++ b/pkgs/development/libraries/qt-5/5.7/qtmultimedia.nix
@@ -1,4 +1,4 @@
-{ qtSubmodule, qtbase, qtdeclarative, pkgconfig
+{ stdenv, qtSubmodule, qtbase, qtdeclarative, pkgconfig
 , alsaLib, gstreamer, gst-plugins-base, libpulseaudio
 }:
 
@@ -6,7 +6,7 @@ qtSubmodule {
   name = "qtmultimedia";
   qtInputs = [ qtbase qtdeclarative ];
   buildInputs = [
-    pkgconfig alsaLib gstreamer gst-plugins-base libpulseaudio
-  ];
+    pkgconfig gstreamer gst-plugins-base libpulseaudio
+  ] ++ stdenv.lib.optional stdenv.isLinux alsaLib;
   qmakeFlags = [ "GST_VERSION=1.0" ];
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
index a48c5dbb07a9..280d1f9c50b4 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation {
   patches =
     copyPathsToStore (lib.readPathsFromFile ./. ./series)
     ++ lib.optional decryptSslTraffic ./decrypt-ssl-traffic.patch
-    ++ lib.optional mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
+    ++ lib.optionals mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
 
   postPatch =
     ''
diff --git a/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh b/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
index 977c859e76d3..aa2d24a741ca 100644
--- a/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
+++ b/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
@@ -135,10 +135,14 @@ qt5LinkModuleDir() {
 
 qt5LinkDarwinModuleLibDir() {
   for fw in $(find "$1"/lib -maxdepth 1 -name '*.framework'); do
+    if [ ! -L "$fw" ]; then
       ln -s "$fw" "$NIX_QT5_TMP"/lib
+    fi
   done
   for file in $(find "$1"/lib -maxdepth 1 -type f); do
+    if [ ! -L "$file" ]; then
       ln -s "$file" "$NIX_QT5_TMP"/lib
+    fi
   done
   for dir in $(find "$1"/lib -maxdepth 1 -mindepth 1 -type d ! -name '*.framework'); do
       mkdir -p "$NIX_QT5_TMP"/lib/$(basename "$dir")
@@ -178,4 +182,3 @@ _qtFixCMakePaths() {
 if [ -n "$NIX_QT_SUBMODULE" ]; then
     postInstallHooks+=(_qtFixCMakePaths)
 fi
-
diff --git a/pkgs/development/libraries/shapelib/default.nix b/pkgs/development/libraries/shapelib/default.nix
new file mode 100644
index 000000000000..529dee9376a9
--- /dev/null
+++ b/pkgs/development/libraries/shapelib/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, proj }:
+
+stdenv.mkDerivation rec {
+  name = "shapelib-1.4.0";
+
+  src = fetchurl {
+    url = "https://download.osgeo.org/shapelib/${name}.tar.gz";
+    sha256 = "18d7j5pn5srika7q3f90j0l2l4526xsjd64pin6z2b0gd7rdbp9y";
+  };
+
+  buildInputs =  [ proj ];
+
+  meta = with stdenv.lib; {
+    description = "C Library for reading, writing and updating ESRI Shapefiles";
+    homepage = http://shapelib.maptools.org/;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.ehmry ];
+  };
+}
diff --git a/pkgs/development/libraries/spice-gtk/default.nix b/pkgs/development/libraries/spice-gtk/default.nix
index 325d665aaf65..240de378afc7 100644
--- a/pkgs/development/libraries/spice-gtk/default.nix
+++ b/pkgs/development/libraries/spice-gtk/default.nix
@@ -8,11 +8,11 @@ with stdenv.lib;
 let
   inherit (python2Packages) python pygtk;
 in stdenv.mkDerivation rec {
-  name = "spice-gtk-0.32";
+  name = "spice-gtk-0.33";
 
   src = fetchurl {
     url = "http://www.spice-space.org/download/gtk/${name}.tar.bz2";
-    sha256 = "00pf94xh2xf0h1g13lnavxrysd0d0x22l5jl108cvq1mjc4z8j2c";
+    sha256 = "0fdgx9k4vgmasp8i2n0swrkapq8f212igcg7wsgvr3mbhsvk7bvx";
   };
 
   buildInputs = [
diff --git a/pkgs/development/libraries/umockdev/default.nix b/pkgs/development/libraries/umockdev/default.nix
new file mode 100644
index 000000000000..fdf882ce817e
--- /dev/null
+++ b/pkgs/development/libraries/umockdev/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, autoreconfHook
+, pkgconfig, glib, systemd, libgudev, vala  }:
+
+stdenv.mkDerivation rec {
+  name = "umockdev";
+  version = "0.8.13";
+
+  src = fetchFromGitHub {
+    owner = "martinpitt";
+    repo = "umockdev";
+    rev = version;
+    sha256 ="0bw2dpshlgbdwg5mhq4j22z474llpqix8pxii63r2bk5nhjc537k";
+  };
+
+  buildInputs = [ glib systemd libgudev vala ];
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+
+  ### docs/gtk-doc.make not found
+  prePatch = ''
+    sed -i 's|include $(top_srcdir)/docs/gtk-doc.make||g' docs/reference/Makefile.am
+   sed -i 's|+=|=|g' docs/reference/Makefile.am
+   '';
+
+  meta = with stdenv.lib; {
+    description = "Mock hardware devices for creating unit tests";
+    license = licenses.lgpl2;
+    maintainers = [ maintainers.ndowens ];
+  };
+}
diff --git a/pkgs/development/libraries/urt/default.nix b/pkgs/development/libraries/urt/default.nix
deleted file mode 100644
index 090ca28d7c45..000000000000
--- a/pkgs/development/libraries/urt/default.nix
+++ /dev/null
@@ -1,61 +0,0 @@
-{stdenv, fetchurl, ncompress}:
-
-stdenv.mkDerivation rec {
-  name = "urt-${version}";
-  version = "3.1b";
-  
-  src = fetchurl {
-    url = ftp://ftp.iastate.edu/pub/utah-raster/urt-3.1b.tar.Z;
-    sha256 = "0hbb3avgvkfb2cksqn6cmmgcr0278nb2qd1srayqx0876pq6g2vd";
-  };
-
-  buildInputs = [ ncompress ];
-
-  unpackPhase = ''
-      mkdir urt
-      tar xvf "$src" -C urt
-  '';
-  patchFlags = "-p0 -d urt";
-  patches = [ ./urt-3.1b-build-fixes.patch ./urt-3.1b-compile-updates.patch
-              ./urt-3.1b-make.patch ./urt-3.1b-rle-fixes.patch ./urt-3.1b-tempfile.patch ];
-  postPatch = ''
-      cd urt
-
-      rm bin/README
-      rm man/man1/template.1
-
-      # stupid OS X declares a stack_t type already 
-      sed -i -e 's:stack_t:_urt_stack:g' tools/clock/rleClock.c
-
-      sed -i -e '/^CFLAGS/s: -O : :' makefile.hdr
-
-      cp "${./gentoo-config}" config/gentoo
-  '';
-  configurePhase = ''
-      ./Configure config/gentoo
-  '';
-  postInstall = ''
-      mkdir -p $out/bin
-      cp bin/* $out/bin
-
-      mkdir -p $out/lib
-      cp lib/librle.a $out/lib
-
-      mkdir -p $out/include
-      cp include/rle*.h $out/include
-
-      mkdir -p $out/share/man/man1
-      cp man/man1/*.1 $out/share/man/man1
-
-      mkdir -p $out/share/man/man3
-      cp man/man3/*.3 $out/share/man/man3
-
-      mkdir -p $out/share/man/man5
-      cp man/man5/*.5 $out/share/man/man5
-  '';
-
-  meta = {
-    homepage = http://www.cs.utah.edu/gdc/projects/urt/;
-    description = "A library for dealing with raster images";
-  };
-}
\ No newline at end of file
diff --git a/pkgs/development/libraries/urt/gentoo-config b/pkgs/development/libraries/urt/gentoo-config
deleted file mode 100644
index a2d9ec3faf2f..000000000000
--- a/pkgs/development/libraries/urt/gentoo-config
+++ /dev/null
@@ -1,52 +0,0 @@
-#define ABEKASA60
-#define ABEKASA62
-#define ALIAS
-##define CGM
-#define CUBICOMP
-##define DVIRLE
-#define GRAYFILES
-#define MACPAINT
-##define PBMPLUS
-##define SUNRASTER
-#define TARGA
-#define VICAR
-#define WASATCH
-#define WAVEFRONT
-
-#define GCC
-
-#define CONST_DECL
-#define NO_MAKE_MAKEFILE
-#define USE_TIME_H
-#define SYS_V_SETPGRP
-#define USE_PROTOTYPES
-#define USE_RANDOM
-#define USE_STDARG
-#define USE_STDLIB_H
-#define USE_UNISTD_H
-#define USE_STRING_H
-#define VOID_STAR
-#define USE_XLIBINT_H
-#define X_SHARED_MEMORY
-
-#defpath DEST bin
-#defpath RI include
-#defpath RL lib
-
-ROFF = nroff
-ROFFOPT = -man
-ROFFPIPE = | lpr
-
-INCTIFF = 
-LIBTIFF = -ltiff
-INCX11 =
-LIBX11 = -lX11
-
-# Most people have migrated X11 to /usr/lib, but just in case ...
-check_x11=$(shell \
-	echo 'int main(){}' > test.c ; \
-	if ! $(CC) test.c -lX11 -o .urt-x11-test 2>/dev/null ; then \
-		echo "-L/usr/X11R6/lib" ; \
-	fi ; \
-	rm -f .urt-x11-test test.c)
-LIBX11 += $(call check_x11)
diff --git a/pkgs/development/libraries/urt/urt-3.1b-build-fixes.patch b/pkgs/development/libraries/urt/urt-3.1b-build-fixes.patch
deleted file mode 100644
index fc2bacddb30c..000000000000
--- a/pkgs/development/libraries/urt/urt-3.1b-build-fixes.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-some hosts are more anal about ar usage than others
-http://bugs.gentoo.org/107428
-
-respect user LDFLAGS
-http://bugs.gentoo.org/126872
-
---- lib/makefile.src
-+++ lib/makefile.src
-@@ -181,8 +181,7 @@
- # Rebuild the library from all the .o files.
- buildlib: $(OBJS)
- 	-rm -f $(LIBNAME)
--	ar rc $(LIBNAME)
--	ar q $(LIBNAME) $(OBJS)
-+	ar rc $(LIBNAME) $(OBJS)
- #ifndef NO_RANLIB
- 	ranlib $(LIBNAME)
- #endif
---- tools/clock/makefile.src
-+++ tools/clock/makefile.src
-@@ -6,7 +6,7 @@ install: rleClock
- 	mv rleClock ../rleClock.out
- 
- rleClock:rleClock.o font.o
--	${CC} ${CFLAGS} rleClock.o font.o -lm ${LIBS} -o rleClock
-+	${CC} ${CFLAGS} ${LDFLAGS} rleClock.o font.o ${LIBS} -o rleClock -lm
- 
- font.c:font.src makeFont
- 	chmod +x makeFont
---- tools/makefile.src
-+++ tools/makefile.src
-@@ -62,21 +62,21 @@ applymap.out rlebg.out: $(RI)/rle_raw.h
- pyrlib.o: pyrlib.c $(RI)/pyramid.h $(RI)/rle.h $(RI)/rle_config.h
- 	$(CC) $(CFLAGS) pyrlib.c -c
- pyrmask.out: pyrlib.o pyrmask.c $(RI)/pyramid.h
--	$(CC) $(CFLAGS) -I$(RI) pyrmask.c pyrlib.o $(LIBS) -lm -o pyrmask.new
-+	$(CC) $(LDFLAGS) $(CFLAGS) -I$(RI) pyrmask.c pyrlib.o $(LIBS) -lm -o pyrmask.new
- 	mv pyrmask.new pyrmask.out
- 
- fant.out: fant.o mallocNd.o
--	$(CC) $(CFLAGS) -I$(RI) fant.o mallocNd.o $(LIBS) -lm -o fant.new
-+	$(CC) $(LDFLAGS) $(CFLAGS) -I$(RI) fant.o mallocNd.o $(LIBS) -lm -o fant.new
- 	mv fant.new fant.out
- 	
- # rlebox and crop use some common code.
- rle_box.o: $(RI)/rle.h $(RI)/rle_config.h $(RI)/rle_raw.h
- 
- crop.out: crop.c rle_box.o
--	${CC} ${CFLAGS} crop.c rle_box.o ${LIBS} -o crop.new
-+	${CC} ${LDFLAGS} ${CFLAGS} crop.c rle_box.o ${LIBS} -o crop.new
- 	mv crop.new crop.out
- rlebox.out: rlebox.c rle_box.o
--	${CC} ${CFLAGS} rlebox.c rle_box.o ${LIBS} -o rlebox.new
-+	${CC} ${LDFLAGS} ${CFLAGS} rlebox.c rle_box.o ${LIBS} -o rlebox.new
- 	mv rlebox.new rlebox.out
- 
- # rleClock has it's own directory, must be built special
-@@ -100,7 +100,7 @@ clean:	clean-pgm
- .SUFFIXES:
- .SUFFIXES: .out .c .o
- .c.out:
--	$(CC) $(CFLAGS) $< $(LIBS) -lm -o $*.new
-+	$(CC) $(LDFLAGS) $(CFLAGS) $< $(LIBS) -lm -o $*.new
- 	mv $*.new $@
- 
- .c.o:
---- cnv/makefile.src
-+++ cnv/makefile.src
-@@ -76,13 +76,13 @@ PBMDIR = 
- # ppmtorle - ppm format to RLE
- # rletoppm - RLE to ppm format
- pgmtorle.out: pgmtorle.c
--	$(CC) $(CFLAGS) $(INCPBMPLUS) $*.c $(LIBS) $(LIBPBMPLUS) -o $*.new
-+	$(CC) $(CFLAGS) $(LDFLAGS) $(INCPBMPLUS) $*.c $(LIBS) $(LIBPBMPLUS) -o $*.new
- 	mv $*.new $@
- ppmtorle.out: ppmtorle.c
--	$(CC) $(CFLAGS) $(INCPBMPLUS) $*.c $(LIBS) $(LIBPBMPLUS) -o $*.new
-+	$(CC) $(CFLAGS) $(LDFLAGS) $(INCPBMPLUS) $*.c $(LIBS) $(LIBPBMPLUS) -o $*.new
- 	mv $*.new $@
- rletoppm.out: rletoppm.c
--	$(CC) $(CFLAGS) $(INCPBMPLUS) $*.c $(LIBS) $(LIBPBMPLUS) -o $*.new
-+	$(CC) $(CFLAGS) $(LDFLAGS) $(INCPBMPLUS) $*.c $(LIBS) $(LIBPBMPLUS) -o $*.new
- 	mv $*.new $@
- #endif
- 
-@@ -95,10 +95,10 @@ rletoppm.out: rletoppm.c
- # iristorle/rletoiris - Convert between RLE and SGI image format.
- #
- iristorle.out: iristorle.c
--	$(CC) $(CFLAGS) -I/usr/include/gl $*.c $(LIBS) -limage -o $*.new
-+	$(CC) $(CFLAGS) $(LDFLAGS) -I/usr/include/gl $*.c $(LIBS) -limage -o $*.new
- 	mv $*.new $@
- rletoiris.out: rletoiris.c
--	$(CC) $(CFLAGS) -I/usr/include/gl $*.c $(LIBS) -limage -o $*.new
-+	$(CC) $(CFLAGS) $(LDFLAGS) -I/usr/include/gl $*.c $(LIBS) -limage -o $*.new
- 	mv $*.new $@
- #endif
- 
-@@ -108,10 +108,10 @@ TIFFDIR =
- # tifftorle - Convert TIFF images to RLE
- # rletotiff - Convert RLE images to TIFF
- rletotiff.out: rletotiff.c
--	$(CC) $(CFLAGS) $(INCTIFF) $*.c $(LIBS) $(LIBTIFF) -lm -o $*.new
-+	$(CC) $(CFLAGS) $(LDFLAGS) $(INCTIFF) $*.c $(LIBS) $(LIBTIFF) -lm -o $*.new
- 	mv $*.new $@
- tifftorle.out: tifftorle.c
--	$(CC) $(CFLAGS) $(INCTIFF) $*.c $(LIBS) $(LIBTIFF) -lm -o $*.new
-+	$(CC) $(CFLAGS) $(LDFLAGS) $(INCTIFF) $*.c $(LIBS) $(LIBTIFF) -lm -o $*.new
- 	mv $*.new $@
- #endif
- 
-@@ -125,7 +125,7 @@ tifftorle.out: tifftorle.c
- # Will build with the default rule.
- # rletorla - RLE to Wavefront RLA
- rletorla.out: rletorla.c
--	$(CC) $(CFLAGS) $*.c $(LIBS) $(LIBWAVEFRONT) -lm -o $*.new
-+	$(CC) $(CFLAGS) $(LDFLAGS) $*.c $(LIBS) $(LIBWAVEFRONT) -lm -o $*.new
- 	mv $*.new $@
- #endif WAVEFRONT
- 
-@@ -144,7 +144,7 @@ pristine: pristine-pgm
- .SUFFIXES:
- .SUFFIXES: .out .c
- .c.out:
--	$(CC) $(CFLAGS) $*.c $(LIBS) -lm -o $*.new
-+	$(CC) $(CFLAGS) $(LDFLAGS) $*.c $(LIBS) -lm -o $*.new
- 	mv $*.new $@
- 
- # Dependency lines.  Make sure to #ifdef them.
---- cnv/rletoabA62/makefile.src
-+++ cnv/rletoabA62/makefile.src
-@@ -15,7 +15,7 @@ all		:	$(PGMS)
- # Executables.  The .out will be stripped off in the install action.
- 
- rletoabA62.out	:	rletoabA62.o rle.o
--			$(CC) $(CFLAGS) -o rletoabA62.new \
-+			$(CC) $(CFLAGS) $(LDFLAGS) -o rletoabA62.new \
- 			  rletoabA62.o rle.o $(LIBS)
- 			mv rletoabA62.new rletoabA62.out
- 
---- cnv/rletogif/makefile.src
-+++ cnv/rletogif/makefile.src
-@@ -15,7 +15,7 @@ all:	$(PGMS)
- # The executable.  The ".out" will be stripped off in the install action.
- 
- rletogif.out: ${OBJ}
--	${CC} ${CFLAGS} ${OBJ} ${LIBS} -o rletogif.new
-+	${CC} ${CFLAGS} ${LDFLAGS} ${OBJ} ${LIBS} -o rletogif.new
- 	mv rletogif.new rletogif.out
- 
- # Incremental install, copies executable to DEST dir.
diff --git a/pkgs/development/libraries/urt/urt-3.1b-compile-updates.patch b/pkgs/development/libraries/urt/urt-3.1b-compile-updates.patch
deleted file mode 100644
index 105f7c41f6a7..000000000000
--- a/pkgs/development/libraries/urt/urt-3.1b-compile-updates.patch
+++ /dev/null
@@ -1,141 +0,0 @@
---- get/getx11/XGetHClrs.c
-+++ get/getx11/XGetHClrs.c
-@@ -1,5 +1,4 @@
- #ifndef XLIBINT_H_NOT_AVAILABLE
--#include <X11/copyright.h>
- 
- /* $XConsortium: XGetHClrs.c,v 11.10 88/09/06 16:07:50 martin Exp $ */
- /* Copyright    Massachusetts Institute of Technology    1986	*/
---- tools/mallocNd.c
-+++ tools/mallocNd.c
-@@ -67,7 +67,7 @@
- 
- /* Imports */
- #include <stdio.h>
--extern char *malloc();
-+#include <string.h>
- 
- /* Forward declarations */
- char *BuildIndirectionTable();
---- tools/into.c
-+++ tools/into.c
-@@ -40,8 +40,8 @@
- static char buf[MAXPATHLEN+1];
- short forceflg;				/* overwrite an unwritable file? */
- 
--extern int errno;
--extern char *sys_errlist[];
-+#include <errno.h>
-+#include <string.h>
- 
- void
- main(argc, argv)
-@@ -103,7 +103,7 @@
-     if (ferror(outf))
-     {
- 	fprintf(stderr, "into: %s, \"%s\" not modified\n",
--	    sys_errlist[errno], argv[1]);
-+	    strerror(errno), argv[1]);
- 	unlink(buf);
- 	exit(1);
-     }
---- cnv/tex/dvirle2.c
-+++ cnv/tex/dvirle2.c
-@@ -55,7 +55,6 @@
- void DumpTopOfBand(), MoveDown(), WriteBuf(), WriteBlanks();
- 
- char	*ProgName;
--extern int errno;
- extern char *optarg;
- extern int optind;
- 
---- cnv/wasatchrle.c
-+++ cnv/wasatchrle.c
-@@ -32,7 +32,6 @@
- #include <errno.h>
- #include "rle.h"
- 
--extern int errno;
- 
- /* "short" in our world is 16 bits.  Beware of swyte-bopping. */
- 
---- get/getx11/x11_stuff.c
-+++ get/getx11/x11_stuff.c
-@@ -155,7 +155,6 @@
- 			IPC_CREAT|0777 );
- 	    if ( img->shm_img.shmid < 0 )
- 	    {
--		extern int errno;
- 		if ( errno == ENOSPC )
- 		{
- 		    if ( !no_shared_space )
-@@ -361,7 +360,6 @@ Boolean reallocate;
- 	    XDestroyImage( image );
- 	    if ( img->shm_pix.shmid < 0 )
- 	    {
--		extern int errno;
- 		if ( errno == ENOSPC )
- 		{
- 		    if ( !no_shared_space )
---- get/qcr/qcr.h
-+++ get/qcr/qcr.h
-@@ -6,8 +6,6 @@
- #define GREEN 1
- #define BLUE 2
- 
--extern int errno;
--
- /* Command defs for QCR-Z Film Recorder */
- 
- /* These are for 8 bit Look Up Tables */
---- get/gettaac.c
-+++ get/gettaac.c
-@@ -24,6 +24,7 @@
-  * Send bug fixes and improvements to:  ksp@maxwell.nde.swri.edu
-  */
- 
-+#include <errno.h>
- #include <stdio.h>
- #include <strings.h>
- #include <signal.h>
-@@ -459,7 +460,6 @@ char    *template;
-      char    nonUnique;
-      char    twiddleUserCompletion;
- 
--     extern  int         errno;
-      struct  direct     *nameEntry;
-      DIR                *dirChan;
-      struct  passwd     *pwdEntry;
---- tools/clock/rleClock.c
-+++ tools/clock/rleClock.c
-@@ -598,7 +598,7 @@
-     { TRUE,  "-tf", STRING, "Text area format string", 	          (char *)&FormatString }, 
-     { FALSE, "-Xm", BOOL,   "Output the alpha channel on RGB",    (char *)&DebugAlpha },
-     { FALSE, "-D",  BOOL,   "Turn on debugging",	          (char *)&Debug },
--    NULL
-+    { FALSE, NULL }
- };
- 
- void
---- tools/to8.c
-+++ tools/to8.c
-@@ -175,7 +175,7 @@
- 	 * Give it a background color of black, since the real background
- 	 * will be dithered anyway.
- 	 */
--	if ( in_hdr.background != NULL )
-+	if ( in_hdr.background != 0 )
- 	{
- 	    out_hdr.bg_color = (int *)malloc( sizeof( int ) );
- 	    RLE_CHECK_ALLOC( cmd_name( argv ), out_hdr.bg_color, 0 );
---- cnv/rletoabA62/rletoabA62.c
-+++ cnv/rletoabA62/rletoabA62.c
-@@ -157,7 +157,7 @@
- 	exit(1);
-     }
-     if (optind < argc) {
--	if ((file = open(argv[optind], 0)) == NULL) {
-+	if ((file = open(argv[optind], 0)) == -1) {
- 	    perror(argv[optind]);
- 	    exit(1);
- 	}
diff --git a/pkgs/development/libraries/urt/urt-3.1b-make.patch b/pkgs/development/libraries/urt/urt-3.1b-make.patch
deleted file mode 100644
index 310675dd395d..000000000000
--- a/pkgs/development/libraries/urt/urt-3.1b-make.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-Index: makefile.src
-===================================================================
---- makefile.src
-+++ makefile.src
-@@ -17,7 +17,7 @@ all: default
- # clean deletes all but source, pristine (below) deletes installed stuff, too
- default clean: doit
- 	@for d in $(DIRS) ; do \
--		( cd $$d ; echo make $@ on $$d ; make $(MFLAGS) $@ ) ; \
-+		( cd $$d ; echo $(MAKE) $@ on $$d ; $(MAKE) $(MFLAGS) $@ ) ; \
- 	done
- 
- # install puts library, binaries and documentation into global location
-@@ -29,7 +29,7 @@ MAKE_TARGET =
- 
- install $(MAKE_TARGET) pristine depend:: doit
- 	@for d in $(ALLDIRS) ; do \
--		( cd $$d ; echo make $@ on $$d ; make $(MFLAGS) $@ ) ; \
-+		( cd $$d ; echo $(MAKE) $@ on $$d ; $(MAKE) $(MFLAGS) $@ ) ; \
- 	done
- 
- 
-Index: tools/makefile.src
-===================================================================
---- tools/makefile.src
-+++ tools/makefile.src
-@@ -82,7 +82,7 @@ rlebox.out: rlebox.c rle_box.o
- # rleClock has it's own directory, must be built special
- 
- rleClock.out: clock/font.c clock/font.h clock/font.src clock/rleClock.c
--	(cd clock ; make)
-+	(cd clock ; $(MAKE))
- 
- # Incremental install, copies everything ("$?") since last install to DEST dir.
- install: $(PGMS) install-pgm
-Index: makefile.tlr
-===================================================================
---- makefile.tlr
-+++ makefile.tlr
-@@ -7,7 +7,7 @@ subdirs:
- 	@sh -c "if test 'x$(DIRS)' != x ; then eval \
- 		'set -e ; for dir in $(DIRS) ; do \
- 			(cd \$$dir ; echo Make ${HERE}\$$dir ; \
--			 	make $(MFLAGS) $(DIRMFLAGS) ) ; \
-+			 	$(MAKE) $(MFLAGS) $(DIRMFLAGS) ) ; \
- 		done' ; \
- 	  else \
- 		true ; \
-@@ -46,7 +46,7 @@ install-subdirs: subdirs
- 	@sh -c "if test 'x$(DIRS)' != x  ; then eval \
- 		'for dir in $(DIRS) ; do \
- 			(cd \$$dir ; echo Install ${HERE}\$$dir ; \
--			 make $(MFLAGS) $(DIRMFLAGS) install) ; \
-+			 $(MAKE) $(MFLAGS) $(DIRMFLAGS) install) ; \
- 		done' ; \
- 	  else \
- 		true ; \
-@@ -105,7 +105,7 @@ pristine-pgm: clean-pgm
- 	    'for dir in $(ALLDIRS); do \
- 		if test -d $$dir ; then \
- 			(cd $$dir; echo Make ${HERE}$$dir pristine ; \
--			 make $(MFLAGS) pristine); \
-+			 $(MAKE) $(MFLAGS) pristine); \
- 		else \
- 			true; \
- 		fi; \
-@@ -124,7 +124,7 @@ clean-pgm:
- 	    'for dir in $(ALLDIRS); do \
- 		if test -d $$dir ; then \
- 			(cd $$dir; echo Clean ${HERE}$$dir ; \
--			 make $(MFLAGS) clean); \
-+			 $(MAKE) $(MFLAGS) clean); \
- 		else \
- 			true; \
- 		fi; \
diff --git a/pkgs/development/libraries/urt/urt-3.1b-rle-fixes.patch b/pkgs/development/libraries/urt/urt-3.1b-rle-fixes.patch
deleted file mode 100644
index 3720806960fe..000000000000
--- a/pkgs/development/libraries/urt/urt-3.1b-rle-fixes.patch
+++ /dev/null
@@ -1,203 +0,0 @@
-Fixes taken from netpbm
-
---- lib/rle_global.c
-+++ lib/rle_global.c
-@@ -76,7 +76,7 @@ rle_hdr rle_dflt_hdr = {
-     8,				/* cmaplen (log2 of length of color map) */
-     NULL,			/* pointer to color map */
-     NULL,			/* pointer to comment strings */
--    stdout,			/* output file */
-+    NULL,			/* output file -- must be set dynamically */
-     { 7 },			/* RGB channels only */
-     0L,				/* Can't free name and file fields. */
-     "Urt",			/* Default "program name". */
---- lib/rle_hdr.c
-+++ lib/rle_hdr.c
-@@ -269,6 +273,9 @@
- {
-     rle_hdr *ret_hdr;
- 
-+    rle_dflt_hdr.rle_file = stdout;
-+    /* The rest of rle_dflt_hdr is set by the loader's data initialization */
-+
-     if ( the_hdr == &rle_dflt_hdr )
- 	return the_hdr;
- 
---- lib/dither.c
-+++ lib/dither.c
-@@ -38,10 +38,10 @@ void	make_square();
- #endif
- 
- static int magic4x4[4][4] =  {
-- 	 0, 14,  3, 13,
--	11,  5,  8,  6,
--	12,  2, 15,  1,
--	 7,  9,  4, 10
-+{	 0, 14,  3, 13},
-+{	11,  5,  8,  6},
-+{	12,  2, 15,  1},
-+{	 7,  9,  4, 10}
- };
- 
- /* basic dithering macro */
---- lib/rle_open_f.c
-+++ lib/rle_open_f.c
-@@ -9,7 +9,11 @@
-  */
- 
- #include "rle_config.h"
-+#define _XOPEN_SOURCE  /* Make sure fdopen() is in stdio.h */
-+
- #include <stdio.h>
-+#include <unistd.h>
-+#include <fcntl.h>
- 
- #ifndef NO_OPEN_PIPES
- /* Need to have a SIGCLD signal catcher. */
-@@ -260,7 +260,6 @@
-     int pipefd[2];
-     int i;
-     char *argv[4];
--    extern int errno;
- 
-     /* Check args. */
-     if ( *mode != 'r' && *mode != 'w' )
---- lib/rle_getcom.c
-+++ lib/rle_getcom.c
-@@ -53,11 +53,12 @@
- {
-     for ( ; *n != '\0' && *n != '=' && *n == *v; n++, v++ )
- 	;
--    if (*n == '\0' || *n == '=')
-+    if (*n == '\0' || *n == '=') {
- 	if ( *v == '\0' )
- 	    return v;
- 	else if ( *v == '=' )
- 	    return ++v;
-+    }
- 
-     return NULL;
- }
---- lib/scanargs.c
-+++ lib/scanargs.c
-@@ -128,10 +130,10 @@
- va_list argl;
- {
- 
--    register    check;			/* check counter to be sure all argvs
-+    int    check;			/* check counter to be sure all argvs
- 					   are processed */
-     register CONST_DECL char  *cp;
--    register    cnt;
-+    int    cnt;
-     int	    optarg = 0;			/* where optional args start */
-     int	    nopt = 0;
-     char    tmpflg,			/* temp flag */
-@@ -375,11 +377,12 @@
- 				if ( optarg > 0 ) /* end optional args? */
- 				{
- 				    /* Eat the arg, too, if necessary */
--				    if ( list_cnt == 0 )
-+				    if ( list_cnt == 0 ) {
- 					if ( typchr == 's' )
- 					    (void)va_arg( argl, char * );
- 					else
- 					    (void)va_arg( argl, ptr );
-+                    }
- 				    break;
- 				}
- 				else
-@@ -567,7 +570,7 @@
- 				     * Do conversion for n and N types
- 				     */
- 				    tmpflg = typchr;
--				    if (typchr == 'n' || typchr == 'N' )
-+				    if (typchr == 'n' || typchr == 'N' ) {
- 					if (*argp != '0')
- 					    tmpflg = 'd';
- 					else if (*(argp+1) == 'x' ||
-@@ -578,6 +581,7 @@
- 					}
- 					else
- 					    tmpflg = 'o';
-+                    }
- 				    if (typchr == 'N')
- 					tmpflg = toupper( tmpflg );
- 
---- lib/inv_cmap.c
-+++ lib/inv_cmap.c
-@@ -42,7 +42,7 @@
- static long cbinc, cginc, crinc;
- static unsigned long *gdp, *rdp, *cdp;
- static unsigned char *grgbp, *rrgbp, *crgbp;
--static gstride, rstride;
-+static long gstride, rstride;
- static long x, xsqr, colormax;
- static int cindex;
- #ifdef INSTRUMENT_IT
---- lib/rle_getrow.c
-+++ lib/rle_getrow.c
-@@ -351,7 +351,7 @@
- 	    bzero( (char *)scanline[-1] + the_hdr->xmin,
- 		   the_hdr->xmax - the_hdr->xmin + 1 );
- 	for ( nc = 0; nc < the_hdr->ncolors; nc++ )
--	    if ( RLE_BIT( *the_hdr, nc ) )
-+	    if ( RLE_BIT( *the_hdr, nc ) ) {
- 		/* Unless bg color given explicitly, use 0. */
- 		if ( the_hdr->background != 2 || the_hdr->bg_color[nc] == 0 )
- 		    bzero( (char *)scanline[nc] + the_hdr->xmin,
-@@ -360,6 +360,7 @@
- 		    bfill( (char *)scanline[nc] + the_hdr->xmin,
- 			   the_hdr->xmax - the_hdr->xmin + 1,
- 			   the_hdr->bg_color[nc] );
-+	    }
-     }
- 
-     /* If skipping, then just return */
-@@ -367,7 +368,7 @@
-     {
- 	the_hdr->priv.get.vert_skip--;
- 	the_hdr->priv.get.scan_y++;
--	if ( the_hdr->priv.get.vert_skip > 0 )
-+	if ( the_hdr->priv.get.vert_skip > 0 ) {
- 	    if ( the_hdr->priv.get.scan_y >= the_hdr->ymax )
- 	    {
- 		int y = the_hdr->priv.get.scan_y;
-@@ -377,6 +378,7 @@
- 	    }
- 	    else
- 		return the_hdr->priv.get.scan_y;
-+	}
-     }
- 
-     /* If EOF has been encountered, return also */
-@@ -457,11 +459,12 @@
- 	    else
- 		nc = DATUM(inst);
- 	    nc++;
--	    if ( debug_f )
-+	    if ( debug_f ) {
- 		if ( RLE_BIT( *the_hdr, channel ) )
- 		    fprintf( stderr, "Pixel data %d (to %d):", nc, scan_x+nc );
- 		else
- 		    fprintf( stderr, "Pixel data %d (to %d)\n", nc, scan_x+nc);
-+	    }
- 	    if ( RLE_BIT( *the_hdr, channel ) )
- 	    {
- 		/* Don't fill past end of scanline! */
---- lib/rle_putcom.c
-+++ lib/rle_putcom.c
-@@ -53,11 +53,12 @@
- {
-     for ( ; *n != '\0' && *n != '=' && *n == *v; n++, v++ )
- 	;
--    if (*n == '\0' || *n == '=')
-+    if (*n == '\0' || *n == '=') {
- 	if ( *v == '\0' )
- 	    return v;
- 	else if ( *v == '=' )
- 	    return ++v;
-+    }
- 
-     return NULL;
- }
diff --git a/pkgs/development/libraries/urt/urt-3.1b-tempfile.patch b/pkgs/development/libraries/urt/urt-3.1b-tempfile.patch
deleted file mode 100644
index 12acce151b5d..000000000000
--- a/pkgs/development/libraries/urt/urt-3.1b-tempfile.patch
+++ /dev/null
@@ -1,19 +0,0 @@
---- tools/rlecat.c
-+++ tools/rlecat.c
-@@ -110,8 +110,14 @@
- 	    nflag = 0;		/* Not really repeating! */
- 	else
- 	{
--	    mktemp( temp );	/* Make a temporary file name */
--	    tmpfile = rle_open_f( cmd_name( argv ), temp, "w+" );
-+	    /* we dont have to use rle_open_f() because all it does in
-+	     * this case is run fopen() ... we're creating a file so all
-+	     * the checks for opening an existing file aren't needed */
-+	    int fd = mkstemp(temp);
-+	    if (fd == -1 || (tmpfile = fdopen(fd, "w+")) == NULL) {
-+		perror("Unable to open tempfile");
-+		exit(-1);
-+	    }
- 	}
-     }
- 
diff --git a/pkgs/development/node-packages/node-env.nix b/pkgs/development/node-packages/node-env.nix
index bd1de3e9f93e..e8328252a117 100644
--- a/pkgs/development/node-packages/node-env.nix
+++ b/pkgs/development/node-packages/node-env.nix
@@ -73,7 +73,7 @@ let
               if(versionSpec == "latest" || versionSpec == "unstable" ||
                   versionSpec.substr(0, 2) == ".." || dependency.substr(0, 2) == "./" || dependency.substr(0, 2) == "~/" || dependency.substr(0, 1) == '/')
                   return '*';
-              else if(parsedUrl.protocol == "git:" || parsedUrl.protocol == "git+ssh:" || parsedUrl.protocol == "git+http:" || parsedUrl.protocol == "git+https:" ||
+              else if(parsedUrl.protocol == "git:" || parsedUrl.protocol == "git+ssh:" || parsedUrl.protocol == "git+http:" || parsedUrl.protocol == "git+https:" || parsedUrl.protocol == "github:" ||
                   parsedUrl.protocol == "http:" || parsedUrl.protocol == "https:")
                   return '*';
               else
diff --git a/pkgs/development/ocaml-modules/bos/default.nix b/pkgs/development/ocaml-modules/bos/default.nix
new file mode 100644
index 000000000000..eb1e8d15feab
--- /dev/null
+++ b/pkgs/development/ocaml-modules/bos/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg
+, astring, fmt, fpath, logs, rresult
+}:
+
+stdenv.mkDerivation rec {
+	name = "ocaml${ocaml.version}-bos-${version}";
+	version = "0.1.4";
+	src = fetchurl {
+		url = "http://erratique.ch/software/bos/releases/bos-${version}.tbz";
+		sha256 = "1ly66lysk4w6mdy4k1n3ynlpfpq7lw4wshcpzgx58v6x613w5s7q";
+	};
+
+	unpackCmd = "tar xjf $src";
+
+	buildInputs = [ ocaml findlib ocamlbuild opam topkg ];
+	propagatedBuildInputs = [ astring fmt fpath logs rresult ];
+
+	inherit (topkg) buildPhase installPhase;
+
+	meta = {
+		description = "Basic OS interaction for OCaml";
+		homepage = http://erratique.ch/software/bos;
+		license = stdenv.lib.licenses.isc;
+		maintainers = [ stdenv.lib.maintainers.vbgl ];
+		inherit (ocaml.meta) platforms;
+	};
+}
diff --git a/pkgs/development/ocaml-modules/cpuid/default.nix b/pkgs/development/ocaml-modules/cpuid/default.nix
new file mode 100644
index 000000000000..1bdf70e86c5a
--- /dev/null
+++ b/pkgs/development/ocaml-modules/cpuid/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg, ocb-stubblr }:
+
+stdenv.mkDerivation {
+  name = "ocaml${ocaml.version}-cpuid-0.1.0";
+
+  src = fetchurl {
+    url = http://github.com/pqwy/cpuid/releases/download/v0.1.0/cpuid-0.1.0.tbz;
+    sha256 = "08k2558a3dnxn8msgpz8c93sfn0y027ganfdi2yvql0fp1ixv97p";
+  };
+
+  unpackCmd = "tar xjf $src";
+
+  buildInputs = [ ocaml findlib ocamlbuild opam topkg ocb-stubblr ];
+
+  inherit (topkg) buildPhase installPhase;
+
+  meta = {
+    homepage = https://github.com/pqwy/cpuid;
+    description = "Detect CPU features from OCaml";
+    license = stdenv.lib.licenses.isc;
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+    inherit (ocaml.meta) platforms;
+  };
+}
diff --git a/pkgs/development/ocaml-modules/eliom/default.nix b/pkgs/development/ocaml-modules/eliom/default.nix
index d7b0bbd3d48c..57f3477edf6b 100644
--- a/pkgs/development/ocaml-modules/eliom/default.nix
+++ b/pkgs/development/ocaml-modules/eliom/default.nix
@@ -10,12 +10,12 @@ assert stdenv.lib.versionAtLeast ocaml.version "4.02";
 stdenv.mkDerivation rec
 {
   pname = "eliom";
-  version = "6.0.0";
+  version = "6.2.0";
   name = "${pname}-${version}";
 
   src = fetchurl {
     url = "https://github.com/ocsigen/eliom/archive/${version}.tar.gz";
-    sha256 = "1yaqi5fdzvi2ga412chw5rk3533a3xamwfmias1crk793d43cmpc";
+    sha256 = "01c4l982ld6d1ndhb6f15ldb2li7mv0bs279d5gs99mpiwsapadx";
   };
 
   patches = [ ./camlp4.patch ];
diff --git a/pkgs/development/ocaml-modules/functoria/default.nix b/pkgs/development/ocaml-modules/functoria/default.nix
new file mode 100644
index 000000000000..bfcdd4168ca7
--- /dev/null
+++ b/pkgs/development/ocaml-modules/functoria/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg
+, bos, cmdliner, ocamlgraph
+}:
+
+stdenv.mkDerivation rec {
+	name = "ocaml${ocaml.version}-functoria-${version}";
+	version = "2.0.2";
+	src = fetchurl {
+		url = "http://github.com/mirage/functoria/releases/download/${version}/functoria-${version}.tbz";
+		sha256 = "019rl4rir4lwgjyqj2wq3ylw4daih1kxxgbc6ld6kzcq66mwr747";
+	};
+
+	unpackCmd = "tar xjf $src";
+
+	buildInputs = [ ocaml findlib ocamlbuild opam topkg ];
+	propagatedBuildInputs = [ bos cmdliner ocamlgraph ];
+
+	inherit (topkg) buildPhase installPhase;
+
+	meta = {
+		description = "A DSL to organize functor applications";
+		homepage = https://github.com/mirage/functoria;
+		license = stdenv.lib.licenses.isc;
+		maintainers = [ stdenv.lib.maintainers.vbgl ];
+		inherit (ocaml.meta) platforms;
+	};
+}
diff --git a/pkgs/development/ocaml-modules/llvm/default.nix b/pkgs/development/ocaml-modules/llvm/default.nix
index 351a773a6f7b..3bced92cc3e3 100644
--- a/pkgs/development/ocaml-modules/llvm/default.nix
+++ b/pkgs/development/ocaml-modules/llvm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, python, llvm, ocaml, findlib, ctypes }:
+{ stdenv, fetchpatch, python, cmake, llvm, ocaml, findlib, ctypes }:
 
 let version = stdenv.lib.getVersion llvm; in
 
@@ -7,21 +7,23 @@ stdenv.mkDerivation {
 
   inherit (llvm) src;
 
-  buildInputs = [ python llvm ocaml findlib ctypes ];
+  buildInputs = [ python cmake llvm ocaml findlib ctypes ];
 
-  configurePhase = ''
-    mkdir build
-    cd build
-    ../configure --disable-compiler-version-checks --prefix=$out \
-    --disable-doxygen --disable-docs --with-ocaml-libdir=$OCAMLFIND_DESTDIR/llvm \
-    --enable-static
-    '';
+  patches = [ (fetchpatch {
+    url = https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/llvm/llvm.3.9/files/cmake.patch;
+    sha256 = "1fcc6ylfiw1npdhx7mrsj7h0dx7cym7i9664kpr76zqazb52ikm9";
+  })];
 
-  enableParallelBuilding = false;
+  cmakeFlags = [ "-DLLVM_OCAML_OUT_OF_TREE=TRUE" ];
 
-  makeFlags = [ "-C bindings" "SYSTEM_LLVM_CONFIG=llvm-config" ];
+  buildFlags = "ocaml_all";
+
+  installFlags = "-C bindings/ocaml";
 
   postInstall = ''
+    mv $out/lib/ocaml $out/ocaml
+    mkdir -p $OCAMLFIND_DESTDIR/
+    mv $out/ocaml $OCAMLFIND_DESTDIR/llvm
     mv $OCAMLFIND_DESTDIR/llvm/META{.llvm,}
   '';
 
diff --git a/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/default.nix b/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/default.nix
new file mode 100644
index 000000000000..3694dd2d6abc
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ocaml-migrate-parsetree/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, jbuilder, result }:
+
+stdenv.mkDerivation rec {
+   name = "ocaml${ocaml.version}-ocaml-migrate-parsetree-${version}";
+   version = "0.5";
+
+   src = fetchFromGitHub {
+     owner = "let-def";
+     repo = "ocaml-migrate-parsetree";
+     rev = "v${version}";
+     sha256 = "023lnd3kxa3d4zgsvv0z2lyzhg05zcgagy18vaalimbza57wq83h";
+   };
+
+   buildInputs = [ ocaml findlib ocamlbuild jbuilder ];
+   propagatedBuildInputs = [ result ];
+
+   installPhase = ''
+     for p in *.install
+     do
+       ${jbuilder.installPhase} $p
+     done
+   '';
+
+   meta = {
+     description = "Convert OCaml parsetrees between different major versions";
+     license = stdenv.lib.licenses.lgpl21;
+     maintainers = [ stdenv.lib.maintainers.vbgl ];
+     inherit (src.meta) homepage;
+     inherit (ocaml.meta) platforms;
+   };
+}
diff --git a/pkgs/development/ocaml-modules/ocsigen-server/default.nix b/pkgs/development/ocaml-modules/ocsigen-server/default.nix
index 8d949497b465..8685097750b9 100644
--- a/pkgs/development/ocaml-modules/ocsigen-server/default.nix
+++ b/pkgs/development/ocaml-modules/ocsigen-server/default.nix
@@ -1,6 +1,7 @@
 {stdenv, fetchurl, ocaml, findlib, which, ocaml_react, ocaml_ssl,
 ocaml_lwt, ocamlnet, ocaml_pcre, cryptokit, tyxml, ipaddr, zlib,
 libev, openssl, ocaml_sqlite3, tree, uutf, makeWrapper, camlp4
+, pgocaml
 }:
 
 let mkpath = p: n:
@@ -18,7 +19,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ocaml which findlib ocaml_react ocaml_ssl ocaml_lwt
   ocamlnet ocaml_pcre cryptokit tyxml ipaddr zlib libev openssl
-  ocaml_sqlite3 tree uutf makeWrapper camlp4 ];
+  ocaml_sqlite3 tree uutf makeWrapper camlp4 pgocaml ];
 
   configureFlags = "--root $(out) --prefix /";
 
diff --git a/pkgs/development/ocaml-modules/ocsigen-toolkit/default.nix b/pkgs/development/ocaml-modules/ocsigen-toolkit/default.nix
new file mode 100644
index 000000000000..00416c92bb94
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ocsigen-toolkit/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, fetchurl, buildOcaml, ocaml, eliom, opam }:
+
+buildOcaml rec
+{
+ name = "ocsigen-toolkit";
+ version = "1.0.0";
+
+ propagatedBuildInputs = [ eliom ];
+ buildInputs = [ opam ];
+
+ createFindlibDestdir = true;
+
+ installPhase =
+  ''
+    export OCAMLPATH=$out/lib/ocaml/${ocaml.version}/site-lib/:$OCAMLPATH
+    make install
+    opam-installer --prefix=$out
+  '';
+
+  src = fetchurl {
+    sha256 = "0wm4fnss7vlkd03ybgfrk63kpip6m6p6kdqjn3f64n11256mwzj2";
+    url = "https://github.com/ocsigen/${name}/archive/${version}.tar.gz";
+  };
+
+  meta = {
+    homepage = http://ocsigen.org/ocsigen-toolkit/;
+    description = " User interface widgets for Ocsigen applications";
+    license = stdenv.lib.licenses.lgpl21;
+    maintainers = [ stdenv.lib.maintainers.gal_bolle ];
+  };
+
+
+}
diff --git a/pkgs/development/ocaml-modules/ppx_deriving_yojson/default.nix b/pkgs/development/ocaml-modules/ppx_deriving_yojson/default.nix
new file mode 100644
index 000000000000..69276fb5a7d6
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ppx_deriving_yojson/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, ocaml, findlib, ocamlbuild, opam, topkg, cppo
+, ppx_import, ppx_deriving, yojson, ounit
+}:
+
+stdenv.mkDerivation rec {
+  name = "ocaml${ocaml.version}-ppx_deriving_yojson-${version}";
+  version = "3.0";
+
+  src = fetchFromGitHub {
+    owner = "whitequark";
+    repo = "ppx_deriving_yojson";
+    rev = "v${version}";
+    sha256 = "1id1a29qq0ax9qp98b5hv6p2q2r0vp4fbkkwzm1bxdhnasw97msk";
+  };
+
+  buildInputs = [ ocaml findlib ocamlbuild opam cppo ounit ppx_import ];
+
+  propagatedBuildInputs = [ ppx_deriving yojson ];
+
+  inherit (topkg) installPhase;
+
+  doCheck = true;
+  checkTarget = "test";
+
+  meta = {
+    description = "A Yojson codec generator for OCaml >= 4.02.";
+    inherit (src.meta) homepage;
+    license = stdenv.lib.licenses.mit;
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+    inherit (ocaml.meta) platforms;
+  };
+}
diff --git a/pkgs/development/ocaml-modules/rresult/default.nix b/pkgs/development/ocaml-modules/rresult/default.nix
new file mode 100644
index 000000000000..f9951b56da2d
--- /dev/null
+++ b/pkgs/development/ocaml-modules/rresult/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, ocaml, findlib, ocamlbuild, opam, topkg }:
+
+stdenv.mkDerivation rec {
+	name = "ocaml${ocaml.version}-rresult-${version}";
+	version = "0.5.0";
+	src = fetchurl {
+		url = "http://erratique.ch/software/rresult/releases/rresult-${version}.tbz";
+		sha256 = "1xxycxhdhaq8p9vhwi93s2mlxjwgm44fcxybx5vghzgbankz9yhm";
+	};
+
+	unpackCmd = "tar xjf $src";
+
+	buildInputs = [ ocaml findlib ocamlbuild topkg opam ];
+
+	inherit (topkg) buildPhase installPhase;
+
+	meta = {
+		license = stdenv.lib.licenses.isc;
+		homepage = http://erratique.ch/software/rresult;
+		description = "Result value combinators for OCaml";
+		maintainers = [ stdenv.lib.maintainers.vbgl ];
+		inherit (ocaml.meta) platforms;
+	};
+}
diff --git a/pkgs/development/pure-modules/octave/default.nix b/pkgs/development/pure-modules/octave/default.nix
index 9f9527d0f025..61bc7a4d5c15 100644
--- a/pkgs/development/pure-modules/octave/default.nix
+++ b/pkgs/development/pure-modules/octave/default.nix
@@ -1,16 +1,16 @@
-{ stdenv, fetchurl, pkgconfig, pure, octave }:
+{ stdenv, fetchurl, pkgconfig, pure, octave, gcc6 }:
 
 stdenv.mkDerivation rec {
   baseName = "octave";
-  version = "0.7";
+  version = "0.9";
   name = "pure-${baseName}-${version}";
 
   src = fetchurl {
     url = "https://bitbucket.org/purelang/pure-lang/downloads/${name}.tar.gz";
-    sha256 = "04c1q5cjcyc5sg15ny1hn43rkphja3virw4k110cahc3piwbpsqk";
+    sha256 = "0l1mvmi3rpabzjcrk6p04rdn922mvdm9x67zby3dha5iiccc47q0";
   };
 
-  buildInputs = [ pkgconfig ];
+  buildInputs = [ pkgconfig gcc6 ];
   propagatedBuildInputs = [ pure octave ];
   makeFlags = "libdir=$(out)/lib prefix=$(out)/";
   setupHook = ../generic-setup-hook.sh;
diff --git a/pkgs/development/python-modules/configparser/0001-namespace-fix.patch b/pkgs/development/python-modules/configparser/0001-namespace-fix.patch
new file mode 100644
index 000000000000..05dbf4677182
--- /dev/null
+++ b/pkgs/development/python-modules/configparser/0001-namespace-fix.patch
@@ -0,0 +1,42 @@
+From daae1ae35e13bc8107dc97d9219dfb8e172d5d2a Mon Sep 17 00:00:00 2001
+From: Frederik Rietdijk <fridh@fridh.nl>
+Date: Tue, 14 Mar 2017 15:00:33 +0100
+Subject: [PATCH] namespace fix
+
+configparser broke other namespace packages
+https://github.com/NixOS/nixpkgs/issues/23855#issuecomment-286427428
+This patch seems to solve that issue.
+---
+ setup.py                  | 1 -
+ src/backports/__init__.py | 6 ------
+ 2 files changed, 7 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 3b07823..63ed25d 100644
+--- a/setup.py
++++ b/setup.py
+@@ -42,7 +42,6 @@ setup(
+     py_modules=modules,
+     package_dir={'': 'src'},
+     packages=find_packages('src'),
+-    namespace_packages=['backports'],
+     include_package_data=True,
+     zip_safe=False,
+     install_requires=requirements,
+diff --git a/src/backports/__init__.py b/src/backports/__init__.py
+index f84d25c..febdb2f 100644
+--- a/src/backports/__init__.py
++++ b/src/backports/__init__.py
+@@ -3,9 +3,3 @@
+ 
+ from pkgutil import extend_path
+ __path__ = extend_path(__path__, __name__)
+-
+-try:
+-    import pkg_resources
+-    pkg_resources.declare_namespace(__name__)
+-except ImportError:
+-    pass
+-- 
+2.11.1
+
diff --git a/pkgs/development/python-modules/dateutil/default.nix b/pkgs/development/python-modules/dateutil/default.nix
new file mode 100644
index 000000000000..8e05ee343573
--- /dev/null
+++ b/pkgs/development/python-modules/dateutil/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, buildPythonPackage, fetchurl, six }:
+buildPythonPackage rec {
+  name = "dateutil-${version}";
+  version = "2.6.0";
+
+  src = fetchurl {
+    url = "mirror://pypi/p/python-dateutil/python-${name}.tar.gz";
+    sha256 = "1lhq0hxjc3cfha101q02ld5ijlpfyjn2w1yh7wvpiy367pgzi8k2";
+  };
+
+  propagatedBuildInputs = [ six ];
+
+  meta = with stdenv.lib; {
+    description = "Powerful extensions to the standard datetime module";
+    homepage = http://pypi.python.org/pypi/python-dateutil;
+    license = "BSD-style";
+  };
+}
diff --git a/pkgs/development/python-modules/django-raster/default.nix b/pkgs/development/python-modules/django-raster/default.nix
new file mode 100644
index 000000000000..e673d587e3e3
--- /dev/null
+++ b/pkgs/development/python-modules/django-raster/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, buildPythonPackage, fetchurl,
+  numpy, django_colorful, pillow, psycopg2,
+  pyparsing, django, celery
+}:
+buildPythonPackage rec {
+  name = "django-raster-${version}";
+  version = "0.3.1";
+
+  src = fetchurl {
+    url = "mirror://pypi/d/django-raster/${name}.tar.gz";
+    sha256 = "1hsrkvybak1adn9d9qdw7hx3rcxsbzas4ixwll6vrjkrizgfihk3";
+  };
+
+  # Tests require a postgresql + postgis server
+  doCheck = false;
+
+  propagatedBuildInputs = [ numpy django_colorful pillow psycopg2
+                            pyparsing django celery ];
+
+  meta = with stdenv.lib; {
+    description = "Basic raster data integration for Django";
+    homepage = https://github.com/geodesign/django-raster;
+    license = licenses.mit;
+  };
+}
diff --git a/pkgs/development/python-modules/django_guardian.nix b/pkgs/development/python-modules/django_guardian.nix
index c9217955213d..1b31456162b0 100644
--- a/pkgs/development/python-modules/django_guardian.nix
+++ b/pkgs/development/python-modules/django_guardian.nix
@@ -1,6 +1,6 @@
 { stdenv, buildPythonPackage, python, fetchurl
 , django_environ, mock, django, six
-, pytest, pytestrunner, pytestdjango, setuptools_scm
+, pytest, pytestrunner, pytest-django, setuptools_scm
 }:
 buildPythonPackage rec {
   name = "django-guardian-${version}";
@@ -11,7 +11,7 @@ buildPythonPackage rec {
     sha256 = "1r3xj0ik0hh6dfak4kjndxk5v73x95nfbppgr394nhnmiayv4zc5";
   };
 
-  buildInputs = [ pytest pytestrunner pytestdjango django_environ mock setuptools_scm ];
+  buildInputs = [ pytest pytestrunner pytest-django django_environ mock setuptools_scm ];
   propagatedBuildInputs = [ django six ];
 
   checkPhase = ''
diff --git a/pkgs/development/python-modules/ds4drv.nix b/pkgs/development/python-modules/ds4drv.nix
new file mode 100644
index 000000000000..8698a65ea11b
--- /dev/null
+++ b/pkgs/development/python-modules/ds4drv.nix
@@ -0,0 +1,27 @@
+{ lib, fetchFromGitHub, buildPythonPackage
+, evdev, pyudev
+, bluez
+}:
+
+buildPythonPackage rec {
+  name = "ds4drv-${version}";
+  version = "0.5.1";
+
+  # PyPi only carries py3 wheel
+  src = fetchFromGitHub {
+    owner = "chrippa";
+    repo = "ds4drv";
+    rev = "v${version}";
+    sha256 = "0vinpla0apizzykcyfis79mrm1i6fhns83nkzw85svypdhkx2g8v";
+  };
+
+  propagatedBuildInputs = [ evdev pyudev ];
+
+  buildInputs = [ bluez ];
+
+  meta = {
+    description = "Userspace driver for the DualShock 4 controller";
+    homepage = "https://github.com/chrippa/ds4drv";
+    license = lib.licenses.mit;
+  };
+}
diff --git a/pkgs/development/python-modules/edward/default.nix b/pkgs/development/python-modules/edward/default.nix
new file mode 100644
index 000000000000..0ae81aef0968
--- /dev/null
+++ b/pkgs/development/python-modules/edward/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, buildPythonPackage, fetchPypi, isPy27, pythonAtLeast
+, Keras, numpy, scipy, six, tensorflow }:
+
+buildPythonPackage rec {
+  pname = "edward";
+  version = "1.2.2";
+  name  = "${pname}-${version}";
+
+  disabled = !(isPy27 || pythonAtLeast "3.4");
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0h9i15l7mczwx8jvabjbvxjjidr13x81h6vylb1p8r308w01r2as";
+  };
+
+  # disabled for now due to Tensorflow trying to create files in $HOME:
+  doCheck = false;
+
+  propagatedBuildInputs = [ Keras numpy scipy six tensorflow ];
+
+  meta = with stdenv.lib; {
+    description = "Probabilistic programming language using Tensorflow";
+    homepage = https://github.com/blei-lab/edward;
+    license = licenses.asl20;
+    maintainers = with maintainers; [ bcdarwin ];
+  };
+}
diff --git a/pkgs/development/python-modules/first/default.nix b/pkgs/development/python-modules/first/default.nix
new file mode 100644
index 000000000000..5ecbff90442d
--- /dev/null
+++ b/pkgs/development/python-modules/first/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, buildPythonPackage, fetchPypi }:
+let
+  pname = "first";
+  version = "2.0.1";
+in
+buildPythonPackage {
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0pn9hl2y0pz61la1xhkdz6vl9i2dg3nh0ksizcf0f9ybh8sxxcrv";
+  };
+
+  doCheck = false; # no tests
+
+  meta = with stdenv.lib; {
+    description = "The function you always missed in Python";
+    homepage = https://github.com/hynek/first/;
+    license = licenses.mit;
+    maintainers = with maintainers; [ zimbatm ];
+  };
+}
diff --git a/pkgs/development/python-modules/hypothesis.nix b/pkgs/development/python-modules/hypothesis.nix
index f313f6ab5c4d..271251b830e1 100644
--- a/pkgs/development/python-modules/hypothesis.nix
+++ b/pkgs/development/python-modules/hypothesis.nix
@@ -1,5 +1,5 @@
 { stdenv, buildPythonPackage, fetchFromGitHub, python
-, isPy27, enum34
+, pythonOlder, pythonAtLeast, enum34
 , doCheck ? true, pytest, flake8, flaky
 }:
 buildPythonPackage rec {
@@ -10,18 +10,18 @@ buildPythonPackage rec {
   # If you need these, you can just add them to your environment.
 
   name = "hypothesis-${version}";
-  version = "3.6.0";
+  version = "3.6.1";
 
   # Upstream prefers github tarballs
   src = fetchFromGitHub {
     owner = "HypothesisWorks";
     repo = "hypothesis";
     rev = "${version}";
-    sha256 = "0a3r4c8sr9jn7sv419vdzrzfc9sp7zf105f1lgyiwyzi3cgyvcvg";
+    sha256 = "1zwr9g4h4jizbvm2d7fywdpcxmw8i1m85h8g72kizah07gk12aq1";
   };
 
   buildInputs = stdenv.lib.optionals doCheck [ pytest flake8 flaky ];
-  propagatedBuildInputs = stdenv.lib.optionals isPy27 [ enum34 ];
+  propagatedBuildInputs = stdenv.lib.optionals (pythonOlder "3.4") [ enum34 ];
 
   inherit doCheck;
 
@@ -30,6 +30,10 @@ buildPythonPackage rec {
     ${python.interpreter} -m pytest tests/cover
   '';
 
+  # Unsupport by upstream on certain versions
+  # https://github.com/HypothesisWorks/hypothesis-python/issues/477
+  disabled = pythonOlder "3.4" && pythonAtLeast "2.8";
+
   meta = with stdenv.lib; {
     description = "A Python library for property based testing";
     homepage = https://github.com/DRMacIver/hypothesis;
diff --git a/pkgs/development/python-modules/libais/default.nix b/pkgs/development/python-modules/libais/default.nix
new file mode 100644
index 000000000000..85b5d92e79f4
--- /dev/null
+++ b/pkgs/development/python-modules/libais/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, buildPythonPackage, fetchurl,
+  six, pytest, pytestrunner, pytestcov, coverage
+}:
+buildPythonPackage rec {
+  name = "libais-${version}";
+  version = "0.16";
+
+  src = fetchurl {
+    url = "mirror://pypi/l/libais/${name}.tar.bz2";
+    sha256 = "14dsh5k32ryszwdn6p45wrqp4ska6cc9qpm6lk5c5d1p4rc7wnhq";
+  };
+
+  # data files missing
+  doCheck = false;
+
+  buildInputs = [ pytest pytestrunner pytestcov coverage ];
+  propagatedBuildInputs = [ six ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/schwehr/libais;
+    description = "Library for decoding maritime Automatic Identification System messages";
+    license = licenses.asl20;
+    platforms = platforms.linux;  # It currently fails to build on darwin
+  };
+}
diff --git a/pkgs/development/python-modules/libnacl/default.nix b/pkgs/development/python-modules/libnacl/default.nix
new file mode 100644
index 000000000000..0aa3ed29f20b
--- /dev/null
+++ b/pkgs/development/python-modules/libnacl/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, buildPythonPackage, fetchPypi, pytest, libsodium }:
+
+buildPythonPackage rec {
+  pname = "libnacl";
+  version = "1.5.0";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1ph042x0cfysj16mmjif40pxn505rg5c9n94s972dgc0mfgvrwhs";
+  };
+
+  buildInputs = [ pytest ];
+  propagatedBuildInputs = [ libsodium ];
+
+  postPatch = ''
+    substituteInPlace "./libnacl/__init__.py" --replace "ctypes.cdll.LoadLibrary('libsodium.so')" "ctypes.cdll.LoadLibrary('${libsodium}/lib/libsodium.so')"
+  '';
+
+  checkPhase = ''
+    py.test
+  '';
+
+  meta = with stdenv.lib; {
+    maintainers = with maintainers; [ xvapx ];
+    description = "Python bindings for libsodium based on ctypes";
+    homepage = "https://pypi.python.org/pypi/libnacl";
+    license = licenses.asl20;
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/development/python-modules/mnemonic.nix b/pkgs/development/python-modules/mnemonic.nix
new file mode 100644
index 000000000000..9f71fdb8e741
--- /dev/null
+++ b/pkgs/development/python-modules/mnemonic.nix
@@ -0,0 +1,21 @@
+{ lib, fetchurl, buildPythonPackage, pbkdf2 }:
+
+buildPythonPackage rec {
+  pname = "mnemonic";
+  version = "0.17";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://pypi/m/${pname}/${name}.tar.gz";
+    sha256 = "1hq6xb47jagfqf65iwcrh0065mj3521d2mxmahg7vfraihqyqdjn";
+  };
+
+  propagatedBuildInputs = [ pbkdf2 ];
+
+  meta = {
+    description = "Implementation of Bitcoin BIP-0039";
+    homepage = https://github.com/trezor/python-mnemonic;
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ np ];
+  };
+}
diff --git a/pkgs/development/python-modules/pep257.nix b/pkgs/development/python-modules/pep257.nix
index f185019b0f7a..1cd0e4afc0ce 100644
--- a/pkgs/development/python-modules/pep257.nix
+++ b/pkgs/development/python-modules/pep257.nix
@@ -18,6 +18,6 @@ buildPythonPackage rec {
     homepage = https://github.com/GreenSteam/pep257/;
     description = "Python docstring style checker";
     longDescription = "Static analysis tool for checking compliance with Python PEP 257.";
-    lecense = licenses.mit;
+    license = licenses.mit;
   };
 }
diff --git a/pkgs/development/python-modules/pip-tools/default.nix b/pkgs/development/python-modules/pip-tools/default.nix
new file mode 100644
index 000000000000..fe307513de7c
--- /dev/null
+++ b/pkgs/development/python-modules/pip-tools/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, buildPythonPackage, pip, pytest, click, six, first, glibcLocales }:
+buildPythonPackage rec {
+  pname = "pip-tools";
+  version = "1.8.1rc3";
+  name = "pip-tools-${version}";
+
+  src = fetchFromGitHub {
+    owner = "jazzband";
+    repo = "pip-tools";
+    rev = version;
+    sha256 = "09rbgzj71bfp1x1jfr1zx3vax4qjbw5l6vcd3fqvshsdvg9lcnpx";
+  };
+
+  LC_ALL = "en_US.UTF-8";
+  buildInputs = [ pytest glibcLocales ];
+  propagatedBuildInputs = [ pip click six first ];
+
+  checkPhase = ''
+    export HOME=$(mktemp -d)
+    py.test -k "not test_realistic_complex_sub_dependencies" # requires network
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Keeps your pinned dependencies fresh";
+    homepage = https://github.com/jazzband/pip-tools/;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ zimbatm ];
+  };
+}
diff --git a/pkgs/development/python-modules/pyGithub/default.nix b/pkgs/development/python-modules/pyGithub/default.nix
new file mode 100644
index 000000000000..75fb75f93185
--- /dev/null
+++ b/pkgs/development/python-modules/pyGithub/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub
+, cacert
+, buildPythonPackage, python-jose }:
+
+buildPythonPackage rec {
+  name = "PyGithub-${version}";
+  version = "1.32";
+
+  src = fetchFromGitHub {
+    owner = "PyGithub";
+    repo = "PyGithub";
+    rev = "v${version}";
+    sha256 = "15dr9ja63zdxax9lg6q2kcakqa82dpffyhgpjr13wq3sfkcy5pdw";
+  };
+
+  postPatch = ''
+    # requires network
+    echo "" > github/tests/Issue142.py
+  '';
+  propagatedBuildInputs = [ python-jose ];
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/PyGithub/PyGithub";
+    description = "A Python (2 and 3) library to access the GitHub API v3";
+    platforms = platforms.all;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ jhhuh ];
+  };
+}
diff --git a/pkgs/development/python-modules/pyaes.nix b/pkgs/development/python-modules/pyaes.nix
new file mode 100644
index 000000000000..c2feb2e239c7
--- /dev/null
+++ b/pkgs/development/python-modules/pyaes.nix
@@ -0,0 +1,18 @@
+{ lib, fetchPypi, buildPythonPackage }:
+
+buildPythonPackage rec {
+  pname = "pyaes";
+  version = "1.6.0";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0bp9bjqy1n6ij1zb86wz9lqa1dhla8qr1d7w2kxyn7jbj56sbmcw";
+  };
+
+  meta = {
+    description = "Pure-Python AES";
+    license = lib.licenses.mit;
+    homepage = https://github.com/ricmoo/pyaes;
+  };
+}
diff --git a/pkgs/development/python-modules/pycassa/default.nix b/pkgs/development/python-modules/pycassa/default.nix
new file mode 100644
index 000000000000..fc8fbcaa8d2d
--- /dev/null
+++ b/pkgs/development/python-modules/pycassa/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, buildPythonPackage, fetchPypi, thrift, isPy3k }:
+
+buildPythonPackage rec {
+  pname = "pycassa";
+  version = "1.11.2";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1nsqjzgn6v0rya60dihvbnrnq1zwaxl2qwf0sr08q9qlkr334hr6";
+  };
+
+  disabled = isPy3k;
+
+  # Tests are not executed since they require a cassandra up and
+  # running
+  doCheck = false;
+
+  propagatedBuildInputs = [ thrift ];
+
+  meta = {
+    description = "A python client library for Apache Cassandra";
+    homepage = http://github.com/pycassa/pycassa;
+    license = stdenv.lib.licenses.mit;
+  };
+}
diff --git a/pkgs/development/python-modules/pygame/default.nix b/pkgs/development/python-modules/pygame/default.nix
index 226b613a8b4b..af7b7aca93cb 100644
--- a/pkgs/development/python-modules/pygame/default.nix
+++ b/pkgs/development/python-modules/pygame/default.nix
@@ -1,29 +1,24 @@
 { stdenv, lib, fetchurl, buildPythonPackage, python, smpeg, libX11
-, SDL, SDL_image, SDL_mixer, SDL_ttf, libpng, libjpeg, portmidi, isPy3k,
+, SDL, SDL_image, SDL_mixer, SDL_ttf, libpng, libjpeg, portmidi, freetype
 }:
 
 buildPythonPackage rec {
   name = "pygame-${version}";
-  version = "1.9.1";
+  version = "1.9.3";
 
   src = fetchurl {
-    url = "http://www.pygame.org/ftp/pygame-1.9.1release.tar.gz";
-    sha256 = "0cyl0ww4fjlf289pjxa53q4klyn55ajvkgymw0qrdgp4593raq52";
+    url = "mirror://pypi/p/pygame/pygame-${version}.tar.gz";
+    sha256 = "1hlydiyygl444bq5m5g8n3jsxsgrdyxlm42ipmfbw36wkf0j243m";
   };
 
   buildInputs = [
     SDL SDL_image SDL_mixer SDL_ttf libpng libjpeg
-    smpeg portmidi libX11
+    portmidi libX11 freetype
   ];
 
-  # http://ubuntuforums.org/showthread.php?t=1960262
-  disabled = isPy3k;
-
   # Tests fail because of no audio device and display.
   doCheck = false;
 
-  patches = [ ./pygame-v4l.patch ];
-
   preConfigure = ''
     sed \
       -e "s/^origincdirs = .*/origincdirs = []/" \
diff --git a/pkgs/development/python-modules/pylibmc/default.nix b/pkgs/development/python-modules/pylibmc/default.nix
new file mode 100644
index 000000000000..c91930292c2e
--- /dev/null
+++ b/pkgs/development/python-modules/pylibmc/default.nix
@@ -0,0 +1,21 @@
+{ buildPythonPackage, fetchurl, stdenv, libmemcached, zlib }:
+buildPythonPackage rec {
+  name = "pylibmc-${version}";
+  version = "1.5.1";
+
+  src = fetchurl {
+    url = "https://pypi.python.org/packages/source/p/pylibmc/${name}.tar.gz";
+    sha256 = "1mnd8lng9wmcihl7mxd940hy1dzzvzsb971qclrvmqf3b4c2dfpc";
+  };
+
+  buildInputs = [ libmemcached zlib ];
+
+  # requires an external memcached server running
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "Quick and small memcached client for Python";
+    homepage = http://sendapatch.se/projects/pylibmc/;
+    license = licenses.bsd3;
+  };
+}
diff --git a/pkgs/development/python-modules/pytest-django/default.nix b/pkgs/development/python-modules/pytest-django/default.nix
new file mode 100644
index 000000000000..56fc72ebccee
--- /dev/null
+++ b/pkgs/development/python-modules/pytest-django/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, buildPythonPackage, fetchurl
+, pytest, django, setuptools_scm
+, fetchpatch
+}:
+buildPythonPackage rec {
+  name = "pytest-django-${version}";
+  version = "3.1.2";
+
+  src = fetchurl {
+    url = "mirror://pypi/p/pytest-django/${name}.tar.gz";
+    sha256 = "02932m2sr8x22m4az8syr8g835g4ak77varrnw71n6xakmdcr303";
+  };
+
+  buildInputs = [ pytest setuptools_scm ];
+  propagatedBuildInputs = [ django ];
+
+  patches = [
+    # Unpin setuptools-scm
+    (fetchpatch {
+      url = "https://github.com/pytest-dev/pytest-django/commit/25cbc3b395dcdeb92bdc9414e296680c2b9d602e.patch";
+      sha256 = "0mz3rcsv44pfzlxy3pv8mx87glmv34gy0d5aknvbzgb2a9niryws";
+    })
+  ];
+
+  # Complicated. Requires Django setup.
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "py.test plugin for testing of Django applications";
+    homepage = http://pytest-django.readthedocs.org/en/latest/;
+    license = licenses.bsd3;
+  };
+}
diff --git a/pkgs/development/python-modules/python-jose/default.nix b/pkgs/development/python-modules/python-jose/default.nix
new file mode 100644
index 000000000000..da4dd4107461
--- /dev/null
+++ b/pkgs/development/python-modules/python-jose/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, buildPythonPackage, fetchFromGitHub
+, future, six, ecdsa, pycryptodome, pytest
+}:
+
+buildPythonPackage rec {
+  name = "python-jose-${version}";
+  version = "1.3.2";
+  src = fetchFromGitHub {
+    owner = "mpdavis";
+    repo = "python-jose";
+    rev = version;
+    sha256 = "0933pbflv2pvws5m0ksz8y1fqr8m123smmrbr5k9a71nssd502sv";
+  };
+
+  buildInputs = [ pytest ];
+  checkPhase = "py.test .";
+  patches = [
+    # to use pycryptodme instead of pycrypto
+    ./pycryptodome.patch
+  ];
+  propagatedBuildInputs = [ future six ecdsa pycryptodome ];
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/mpdavis/python-jose";
+    description = "A JOSE implementation in Python";
+    platforms = platforms.all;
+    license = licenses.mit;
+    maintainers = [ maintainers.jhhuh ];
+  };
+}
diff --git a/pkgs/development/python-modules/python-jose/pycryptodome.patch b/pkgs/development/python-modules/python-jose/pycryptodome.patch
new file mode 100644
index 000000000000..665ad5980343
--- /dev/null
+++ b/pkgs/development/python-modules/python-jose/pycryptodome.patch
@@ -0,0 +1,37 @@
+diff -ru python-jose-1.3.2/requirements.txt python-jose-1.3.2.new/requirements.txt
+--- python-jose-1.3.2/requirements.txt	2016-09-05 15:13:49.000000000 +0200
++++ python-jose-1.3.2.new/requirements.txt	2017-03-15 11:35:47.118001810 +0100
+@@ -1,3 +1,3 @@
+-pycrypto
++pycryptodome
+ six
+ future
+diff -ru python-jose-1.3.2/setup.py python-jose-1.3.2.new/setup.py
+--- python-jose-1.3.2/setup.py	2016-09-05 15:13:49.000000000 +0200
++++ python-jose-1.3.2.new/setup.py	2017-03-15 11:37:15.725077184 +0100
+@@ -25,12 +25,8 @@
+ 
+ 
+ def get_install_requires():
+-    if platform.python_implementation() == 'PyPy':
+-        crypto_lib = 'pycryptodome >=3.3.1, <3.4.0'
+-    else:
+-        crypto_lib = 'pycrypto >=2.6.0, <2.7.0'
+     return [
+-        crypto_lib,
++        'pycryptodome >=3.3.1, <3.5.0',
+         'six <2.0',
+         'ecdsa <1.0',
+         'future <1.0',
+diff -ru python-jose-1.3.2/tox.ini python-jose-1.3.2.new/tox.ini
+--- python-jose-1.3.2/tox.ini	2016-09-05 15:13:49.000000000 +0200
++++ python-jose-1.3.2.new/tox.ini	2017-03-15 11:36:50.423055657 +0100
+@@ -6,7 +6,7 @@
+     py.test --cov-report term-missing --cov jose
+ deps =
+     future
+-    pycrypto
++    pycryptodome
+     ecdsa
+     pytest
+     pytest-cov
diff --git a/pkgs/development/python-modules/pyudev.nix b/pkgs/development/python-modules/pyudev.nix
new file mode 100644
index 000000000000..98607501e032
--- /dev/null
+++ b/pkgs/development/python-modules/pyudev.nix
@@ -0,0 +1,26 @@
+{ lib, fetchurl, buildPythonPackage
+, six, systemd
+}:
+
+buildPythonPackage rec {
+  name = "pyudev-${version}";
+  version = "0.21.0";
+
+  src = fetchurl {
+    url = "mirror://pypi/p/pyudev/${name}.tar.gz";
+    sha256 = "0arz0dqp75sszsmgm6vhg92n1lsx91ihddx3m944f4ah0487ljq9";
+  };
+
+  postPatch = ''
+    substituteInPlace src/pyudev/_ctypeslib/libudev.py \
+      --replace "find_library('udev')" "'${systemd.lib}/lib/libudev.so'"
+    '';
+
+  propagatedBuildInputs = [ systemd six ];
+
+  meta = {
+    homepage = "http://pyudev.readthedocs.org/";
+    description = "Pure Python libudev binding";
+    license = lib.licenses.lgpl21Plus;
+  };
+}
diff --git a/pkgs/development/python-modules/trezor.nix b/pkgs/development/python-modules/trezor.nix
new file mode 100644
index 000000000000..36bf0c15de25
--- /dev/null
+++ b/pkgs/development/python-modules/trezor.nix
@@ -0,0 +1,26 @@
+{ lib, fetchurl, buildPythonPackage, protobuf3_0, hidapi, ecdsa, mnemonic }:
+
+buildPythonPackage rec {
+  pname = "trezor";
+  version = "0.7.12";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://pypi/t/${pname}/${name}.tar.gz";
+    sha256 = "0ryqdk13x60qq5s68i9dfc1na4dka66kdxqycxignzg9k9ykaa8g";
+  };
+
+  propagatedBuildInputs = [ protobuf3_0 hidapi ];
+
+  buildInputs = [ ecdsa mnemonic ];
+
+  # There are no actual tests: "ImportError: No module named tests"
+  doCheck = false;
+
+  meta = {
+    description = "Python library for communicating with TREZOR Bitcoin Hardware Wallet";
+    homepage = https://github.com/trezor/python-trezor;
+    license = lib.licenses.gpl3;
+    maintainers = with lib.maintainers; [ np ];
+  };
+}
diff --git a/pkgs/development/python-modules/typed-ast/default.nix b/pkgs/development/python-modules/typed-ast/default.nix
index 8d36d3c3a61f..02a603234205 100644
--- a/pkgs/development/python-modules/typed-ast/default.nix
+++ b/pkgs/development/python-modules/typed-ast/default.nix
@@ -1,13 +1,16 @@
-{ buildPythonPackage, fetchzip, isPy3k, lib, pythonOlder }:
+{ buildPythonPackage, fetchPypi, isPy3k, lib, pythonOlder }:
 buildPythonPackage rec {
-  name = "typed-ast-${version}";
-  version = "1.0.1";
-  src = fetchzip {
-    url = "mirror://pypi/t/typed-ast/${name}.zip";
-    sha256 = "1q69czr9ghnbd81hay71kgynn6mqi5nsgand9yw6dyw5bim5l154";
+  pname = "typed-ast";
+  version = "1.0.2";
+  name = "${pname}-${version}";
+  src = fetchPypi{
+    inherit pname version;
+    sha256 = "13e02b10479ddff07eb546f9638743702ab9b175bfa3cdf2482688df91b5766d";
   };
   # Only works with Python 3.3 and newer;
-  disabled = !isPy3k && !(pythonOlder "3.3");
+  disabled = pythonOlder "3.3";
+  # No tests in archive
+  doCheck = false;
   meta = {
     homepage = "https://pypi.python.org/pypi/typed-ast";
     description = "a fork of Python 2 and 3 ast modules with type comment support";
diff --git a/pkgs/development/python-modules/zeep/default.nix b/pkgs/development/python-modules/zeep/default.nix
new file mode 100644
index 000000000000..c6ae3881f1f4
--- /dev/null
+++ b/pkgs/development/python-modules/zeep/default.nix
@@ -0,0 +1,91 @@
+{ fetchPypi
+, lib
+, buildPythonPackage
+, python
+, isPy3k
+, appdirs
+, cached-property
+, defusedxml
+, isodate
+, lxml
+, pytz
+, requests_toolbelt
+, six
+# test dependencies
+, freezegun
+, mock
+, nose
+, pretend
+, pytest
+, pytestcov
+, requests-mock
+, testtools
+}:
+
+let
+  pname = "zeep";
+  version = "1.1.0";
+in buildPythonPackage {
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "83e82b6cb59e84bf4725add3771ed442bb099fad5959c887efe7c49a8a940ea5";
+  };
+
+  propagatedBuildInputs = [
+    appdirs
+    cached-property
+    defusedxml
+    isodate
+    lxml
+    pytz
+    requests_toolbelt
+    six
+  ];
+
+  # testtools dependency not supported for py3k
+  doCheck = !isPy3k;
+
+  buildInputs = if isPy3k then [] else [
+    freezegun
+    mock
+    nose
+    pretend
+    pytest
+    pytestcov
+    requests-mock
+  ];
+
+  patchPhase = ''
+    # remove overly strict bounds and lint requirements
+    sed -e "s/freezegun==.*'/freezegun'/" \
+        -e "s/pytest-cov==.*'/pytest-cov'/" \
+        -e "s/'isort.*//" \
+        -e "s/'flake8.*//" \
+        -i setup.py
+
+    # locale.preferredencoding() != 'utf-8'
+    sed -e "s/xsd', 'r')/xsd', 'r', encoding='utf-8')/" -i tests/*.py
+
+    # cache defaults to home directory, which doesn't exist
+    sed -e "s|SqliteCache()|SqliteCache(path='./zeeptest.db')|" \
+        -i tests/test_transports.py
+
+    # requires xmlsec python module
+    rm tests/test_wsse_signature.py
+  '';
+
+  checkPhase = ''
+    runHook preCheck
+    ${python.interpreter} -m pytest tests
+    runHook postCheck
+  '';
+
+  meta = with lib; {
+    homepage = "http://docs.python-zeep.org";
+    license = licenses.mit;
+    description = "A modern/fast Python SOAP client based on lxml / requests";
+    maintainers = with maintainers; [ rvl ];
+  };
+}
diff --git a/pkgs/development/ruby-modules/bundler/default.nix b/pkgs/development/ruby-modules/bundler/default.nix
index f3737afdb222..9251c4d2a415 100644
--- a/pkgs/development/ruby-modules/bundler/default.nix
+++ b/pkgs/development/ruby-modules/bundler/default.nix
@@ -4,8 +4,8 @@ buildRubyGem rec {
   inherit ruby;
   name = "${gemName}-${version}";
   gemName = "bundler";
-  version = "1.14.4";
-  sha256 = "1hafmb7p41pm40a2z7f4x5zpgrb72xvgwlvkxnflmzqkvq2prkfv";
+  version = "1.14.6";
+  sha256 = "0h3x2csvlz99v2ryj1w72vn6kixf7rl35lhdryvh7s49brnj0cgl";
   dontPatchShebangs = true;
 
   postFixup = ''
diff --git a/pkgs/development/tools/analysis/flow/default.nix b/pkgs/development/tools/analysis/flow/default.nix
index c1cb4412b9ca..1b41a10bb9c4 100644
--- a/pkgs/development/tools/analysis/flow/default.nix
+++ b/pkgs/development/tools/analysis/flow/default.nix
@@ -3,14 +3,14 @@
 with lib;
 
 stdenv.mkDerivation rec {
-  version = "0.39.0";
+  version = "0.41.0";
   name = "flow-${version}";
 
   src = fetchFromGitHub {
     owner = "facebook";
     repo = "flow";
     rev = "v${version}";
-    sha256 = "05a0kvhlakm7c7n19npg77rj52cz6282290126sfn0qq2059zhli";
+    sha256 = "0v3dhvvj4k35h7g42rmpwc9hqi2z0ccg7rmk8ad00l0djs13l18z";
   };
 
   installPhase = ''
diff --git a/pkgs/development/tools/analysis/radare2/default.nix b/pkgs/development/tools/analysis/radare2/default.nix
index 1c1dace284f1..5befd5e620d5 100644
--- a/pkgs/development/tools/analysis/radare2/default.nix
+++ b/pkgs/development/tools/analysis/radare2/default.nix
@@ -13,12 +13,12 @@ let
   optional = stdenv.lib.optional;
 in
 stdenv.mkDerivation rec {
-  version = "0.10.6";
+  version = "1.3.0";
   name = "radare2-${version}";
 
   src = fetchurl {
-    url = "http://radare.org/get/${name}.tar.xz";
-    sha256 = "0icxd8zilygnggxc50lkk6jmcq8xl66rqxqhzqwpiprbn8k7b24f";
+    url = "http://cloud.radare.org/get/${version}/${name}.tar.gz";
+    sha256 = "08p2vhv6vkqvknwq18xl5wgf843lbpbmb111x23gkkxm6vxvpydd";
   };
 
 
@@ -29,10 +29,10 @@ stdenv.mkDerivation rec {
     ++ optional luaBindings [lua];
 
   meta = {
-    description = "Free advanced command line hexadecimal editor";
+    description = "unix-like reverse engineering framework and commandline tools";
     homepage = http://radare.org/;
     license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [raskin];
+    maintainers = with stdenv.lib.maintainers; [raskin makefu];
     platforms = with stdenv.lib.platforms; linux;
     inherit version;
   };
diff --git a/pkgs/development/tools/analysis/valgrind/default.nix b/pkgs/development/tools/analysis/valgrind/default.nix
index 2ecb5eaa1329..80e3fdfc8072 100644
--- a/pkgs/development/tools/analysis/valgrind/default.nix
+++ b/pkgs/development/tools/analysis/valgrind/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, perl, gdb }:
+{ stdenv, fetchurl, fetchpatch, perl, gdb, llvm, cctools, xnu, bootstrap_cmds }:
 
 stdenv.mkDerivation rec {
   name = "valgrind-3.12.0";
@@ -14,11 +14,13 @@ stdenv.mkDerivation rec {
 
   # Perl is needed for `cg_annotate'.
   # GDB is needed to provide a sane default for `--db-command'.
-  buildInputs = [ perl ] ++ stdenv.lib.optional (!stdenv.isDarwin) gdb;
+  buildInputs = [ perl gdb ]  ++ stdenv.lib.optionals (stdenv.isDarwin) [ bootstrap_cmds xnu ];
 
   enableParallelBuilding = true;
 
-  postPatch =
+  patches = stdenv.lib.optionals (stdenv.isDarwin) [ ./valgrind-bzero.patch ];
+
+  postPatch = stdenv.lib.optionalString (stdenv.isDarwin)
     # Apple's GCC doesn't recognize `-arch' (as of version 4.2.1, build 5666).
     ''
       echo "getting rid of the \`-arch' GCC option..."
@@ -27,6 +29,23 @@ stdenv.mkDerivation rec {
 
       sed -i coregrind/link_tool_exe_darwin.in \
           -e 's/^my \$archstr = .*/my $archstr = "x86_64";/g'
+
+      echo "substitute hardcoded /usr/include/mach with ${xnu}/include/mach"
+      substituteInPlace coregrind/Makefile.in \
+         --replace /usr/include/mach ${xnu}/include/mach
+
+      echo "substitute hardcoded dsymutil with ${llvm}/bin/llvm-dsymutil"
+      find -name "Makefile.in" | while read file; do
+         substituteInPlace "$file" \
+           --replace dsymutil ${llvm}/bin/llvm-dsymutil
+      done
+
+      substituteInPlace coregrind/m_debuginfo/readmacho.c \
+         --replace /usr/bin/dsymutil ${llvm}/bin/llvm-dsymutil
+
+      echo "substitute hardcoded /usr/bin/ld with ${cctools}/bin/ld"
+      substituteInPlace coregrind/link_tool_exe_darwin.in \
+        --replace /usr/bin/ld ${cctools}/bin/ld
     '';
 
   configureFlags =
@@ -58,6 +77,6 @@ stdenv.mkDerivation rec {
     license = stdenv.lib.licenses.gpl2Plus;
 
     maintainers = [ stdenv.lib.maintainers.eelco ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/tools/analysis/valgrind/valgrind-bzero.patch b/pkgs/development/tools/analysis/valgrind/valgrind-bzero.patch
new file mode 100644
index 000000000000..f56a277ad717
--- /dev/null
+++ b/pkgs/development/tools/analysis/valgrind/valgrind-bzero.patch
@@ -0,0 +1,37 @@
+Index: coregrind/m_main.c
+===================================================================
+--- a/coregrind/m_main.c (revision 16102)
++++ b/coregrind/m_main.c (revision 16103)
+@@ -3489,6 +3489,10 @@
+     // skip check
+   return VG_(memset)(s,c,n);
+ }
++void __bzero(void* s, UWord n);
++void __bzero(void* s, UWord n) {
++    (void)VG_(memset)(s,0,n);
++}
+ void bzero(void *s, SizeT n);
+ void bzero(void *s, SizeT n) {
+     VG_(memset)(s,0,n);
+@@ -4058,20 +4062,7 @@
+ 
+ #endif
+ 
+-#if defined(VGO_darwin) && DARWIN_VERS == DARWIN_10_10
+ 
+-/* This might also be needed for > DARWIN_10_10, but I have no way
+-   to test for that.  Hence '==' rather than '>=' in the version
+-   test above. */
+-void __bzero ( void* s, UWord n );
+-void __bzero ( void* s, UWord n )
+-{
+-   (void) VG_(memset)( s, 0, n );
+-}
+-
+-#endif
+-
+-
+ /*--------------------------------------------------------------------*/
+ /*--- end                                                          ---*/
+ /*--------------------------------------------------------------------*/
+
diff --git a/pkgs/development/tools/build-managers/gradle/default.nix b/pkgs/development/tools/build-managers/gradle/default.nix
index 8d119371aa86..28b6601cab6f 100644
--- a/pkgs/development/tools/build-managers/gradle/default.nix
+++ b/pkgs/development/tools/build-managers/gradle/default.nix
@@ -52,12 +52,12 @@ rec {
   };
 
   gradle_latest = gradleGen rec {
-    name = "gradle-3.4";
+    name = "gradle-3.4.1";
     nativeVersion = "0.13";
 
     src = fetchurl {
       url = "http://services.gradle.org/distributions/${name}-bin.zip";
-      sha256 = "0192yz1j59mvn6d3sch0yjx6i2fg4nyppkdpbqbbxqymrm6wvl3j";
+      sha256 = "1cpria3qry4778pxcmqvnaqcyq36abj1fgw4pq115k3rsj9v27fv";
     };
   };
 
diff --git a/pkgs/development/tools/build-managers/jam/default.nix b/pkgs/development/tools/build-managers/jam/default.nix
index 18cbe7731c00..c0d152ee7a2f 100644
--- a/pkgs/development/tools/build-managers/jam/default.nix
+++ b/pkgs/development/tools/build-managers/jam/default.nix
@@ -1,29 +1,32 @@
-{stdenv, fetchurl, yacc}:
+{ stdenv, fetchurl, yacc }:
 
-let
-  bindir = if stdenv.system == "i686-linux" then "bin.linuxx86"
-    else if stdenv.system == "x86_64-linux" then "bin.linux"
-    else throw "Unsupported platform by now";
-in
+stdenv.mkDerivation rec {
+  name = "jam-2.6";
 
-stdenv.mkDerivation {
-  name = "jam-2.5";
   src = fetchurl {
-    url = ftp://ftp.perforce.com/jam/jam-2.5.tar;
-    sha256 = "04c6khd7gdkqkvx4h3nbz99lyz7waid4fd221hq5chcygyx1sj3i";
+    url = "https://swarm.workshop.perforce.com/projects/perforce_software-jam/download/main/${name}.tar";
+    sha256 = "0j4r7xcjz15ksnnpjw56qi99q4lpjmx097pkwwkl1hq3hqml1zhn";
   };
 
-  buildInputs = [ yacc ];
+  nativeBuildInputs = [ yacc ];
+
+  buildPhase = ''
+    make jam0
+    ./jam0 -j$NIX_BUILD_CORES -sBINDIR=$out/bin install
+  '';
 
   installPhase = ''
-    mkdir -p $out/bin
-    cp ${bindir}/jam $out/bin
+    mkdir -p $out/doc/jam
+    cp *.html $out/doc/jam
   '';
 
-  meta = {
-    homepage = http://public.perforce.com/wiki/Jam;
-    license = stdenv.lib.licenses.free;
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = https://www.perforce.com/resources/documentation/jam;
+    license = licenses.free;
     description = "Just Another Make";
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = with maintainers; [ orivej ];
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/tools/build-managers/redo-sh/default.nix b/pkgs/development/tools/build-managers/redo-sh/default.nix
new file mode 100644
index 000000000000..95a49dc167aa
--- /dev/null
+++ b/pkgs/development/tools/build-managers/redo-sh/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  version = "1.2.6";
+  name = "redo-sh-${version}";
+
+  src = fetchurl {
+    url = "http://news.dieweltistgarnichtso.net/bin/archives/redo-sh.tar.gz";
+    sha256 = "1cwrk4v22rb9410rzyb4py4ncg01n6850l80s74bk3sflbw974wp";
+  };
+
+  buildInputs = [ makeWrapper ];
+
+  sourceRoot = ".";
+  installPhase = ''
+    mkdir -p "$out/share"
+    mv man "$out/share"
+    mv bin "$out"
+    for p in $out/bin/*; do
+      wrapProgram "$p" --set PATH '$PATH:'"$out/bin"
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Redo implementation in Bourne Shell";
+    homepage = "http://news.dieweltistgarnichtso.net/bin/redo-sh.html";
+    license  = licenses.agpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ sternenseemann ];
+  };
+}
diff --git a/pkgs/development/tools/build-managers/sbt/0.12.4.nix b/pkgs/development/tools/build-managers/sbt/0.12.4.nix
new file mode 100644
index 000000000000..9c02fcd0b3fb
--- /dev/null
+++ b/pkgs/development/tools/build-managers/sbt/0.12.4.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, jre }:
+
+stdenv.mkDerivation rec {
+  name = "sbt-${version}";
+  version = "0.12.14";
+
+  src = fetchurl {
+    url = "https://dl.bintray.com/sbt/native-packages/sbt/${version}/${name}.tgz";
+    sha256 = "5907af5a3db5e9090024c91e8b6189cd2143841b08c4688542a2efbc9023ac1a";
+  };
+
+  patchPhase = ''
+    echo -java-home ${jre.home} >>conf/sbtopts
+  '';
+
+  installPhase = ''
+    mkdir -p $out/share/sbt $out/bin
+    cp -ra . $out/share/sbt
+    ln -s $out/share/sbt/bin/sbt $out/bin/
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://www.scala-sbt.org/;
+    license = licenses.bsd3;
+    description = "A build tool for Scala, Java and more";
+    maintainers = with maintainers; [ heel ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/tools/clog-cli/default.nix b/pkgs/development/tools/clog-cli/default.nix
index 1d6ac8493f19..f64ead3e1078 100644
--- a/pkgs/development/tools/clog-cli/default.nix
+++ b/pkgs/development/tools/clog-cli/default.nix
@@ -4,16 +4,16 @@ with rustPlatform;
 
 buildRustPackage rec {
   name = "clog-cli-${version}";
-  version = "0.9.2";
+  version = "0.9.3";
 
   src = fetchFromGitHub {
     owner = "clog-tool";
     repo = "clog-cli";
-    rev = "${version}";
-    sha256 = "00sfbchyf50z6mb5dq1837hlrki88rrf043idy6qd1r90488jsbv";
+    rev = "v${version}";
+    sha256 = "1wxglc4n1dar5qphhj5pab7ps34cjr7jy611fwn72lz0f6c7jp3z";
   };
 
-  depsSha256 = "0czv190r6xhbw33l0jhlri6rgspxb8f6dakcamh52qr3z9m0xs2x";
+  depsSha256 = "0gkg3bxx7nxsvff33n7pif731djfvlzk0msia27h0wq0mazq7kw3";
 
   meta = {
     description = "Generate changelogs from local git metadata";
diff --git a/pkgs/development/tools/continuous-integration/jenkins/default.nix b/pkgs/development/tools/continuous-integration/jenkins/default.nix
index 3196b6728e05..7b42e5877520 100644
--- a/pkgs/development/tools/continuous-integration/jenkins/default.nix
+++ b/pkgs/development/tools/continuous-integration/jenkins/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "jenkins-${version}";
-  version = "2.44";
+  version = "2.49";
 
   src = fetchurl {
     url = "http://mirrors.jenkins-ci.org/war/${version}/jenkins.war";
-    sha256 = "01v9p0p27czwsk7ljv1879b5qcrhgy7zan6dj8klr9rci1id8x0d";
+    sha256 = "0c7qnrx87wrgxgh4im1i6sqlxq3hsrs119krh5vwjzx5wp6daa93";
   };
 
   buildCommand = ''
diff --git a/pkgs/development/tools/github/cligh/default.nix b/pkgs/development/tools/github/cligh/default.nix
new file mode 100644
index 000000000000..ded0aaa92424
--- /dev/null
+++ b/pkgs/development/tools/github/cligh/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, pythonPackages }:
+
+pythonPackages.buildPythonApplication rec {
+  name = "cligh-${version}";
+  version = "0.3";
+
+  doCheck = false; # no tests
+
+  src = fetchFromGitHub {
+    owner = "CMB";
+    repo = "cligh";
+    rev = "v${version}";
+    sha256 = "0d1fd78rzl2n75xpmy1gnxh1shvcs4qm0j4qqszqvfriwkg2flxn";
+  };
+
+  propagatedBuildInputs = with pythonPackages; [ pyxdg PyGithub ];
+
+  meta = with stdenv.lib; {
+    homepage = "http://the-brannons.com/software/cligh.html";
+    description = "A simple command-line interface to the facilities of Github";
+    longDescription = ''
+        Cligh is a simple command-line interface to the facilities of GitHub.
+        It is written by Christopher Brannon chris@the-brannons.com. The
+        current version is 0.3, released July 23, 2016. This program is still
+        in the early stage of development. It is by no means feature-complete.
+        A friend and I consider it useful, but others may not.
+    '';
+    platforms = platforms.all;
+    license = licenses.bsd3;
+    maintainers = [ maintainers.jhhuh ];
+  };
+}
diff --git a/pkgs/development/tools/go2nix/default.nix b/pkgs/development/tools/go2nix/default.nix
index 5a77ec7eaa6a..a6f5d62e29e3 100644
--- a/pkgs/development/tools/go2nix/default.nix
+++ b/pkgs/development/tools/go2nix/default.nix
@@ -3,7 +3,7 @@
 
 buildGoPackage rec {
   name = "go2nix-${version}";
-  version = "1.1.1";
+  version = "1.2.0";
   rev = "v${version}";
 
   goPackagePath = "github.com/kamilchm/go2nix";
@@ -12,11 +12,13 @@ buildGoPackage rec {
     inherit rev;
     owner = "kamilchm";
     repo = "go2nix";
-    sha256 = "1idxgn9yf8shw4mq4d7rhf8fvb2s1lli4r4ck0h8ddf1s9q8p63s";
+    sha256 = "1hlanw56r1phj89sicpsfcz6sdjba9qjwhiblcsqka4wfqkai8pn";
   };
 
   goDeps = ./deps.nix;
 
+  outputs = [ "bin" "out" "man" ];
+
   buildInputs = [ go-bindata goimports makeWrapper ];
   preBuild = ''go generate ./...'';
 
@@ -24,6 +26,9 @@ buildGoPackage rec {
     wrapProgram $bin/bin/go2nix \
       --prefix PATH : ${nix-prefetch-git}/bin \
       --prefix PATH : ${git}/bin
+
+    mkdir -p $man/share/man/man1
+    cp $src/go2nix.1 $man/share/man/man1
   '';
 
   allowGoReference = true;
diff --git a/pkgs/development/tools/heroku/default.nix b/pkgs/development/tools/heroku/default.nix
index f9c43ee841ba..6334bb2e5ddf 100644
--- a/pkgs/development/tools/heroku/default.nix
+++ b/pkgs/development/tools/heroku/default.nix
@@ -6,7 +6,7 @@ with stdenv.lib;
 let
   cli = buildGoPackage rec {
     name = "cli-${version}";
-    version = "5.6.14";
+    version = "5.6.32";
 
     goPackagePath = "github.com/heroku/cli";
 
@@ -14,8 +14,21 @@ let
       owner  = "heroku";
       repo   = "cli";
       rev    = "v${version}";
-      sha256 = "11jccham1vkmh5284l6i30na4a4y7b1jhi2ci2z2wwx8m3gkypq9";
+      sha256 = "062aa79mv2njjb0ix7isbz6646wxmsldv27bsz5v2pbv597km0vz";
     };
+
+    buildFlagsArray = ''
+      -ldflags=
+        -X=main.Version=${version}
+        -X=main.Channel=stable
+        -X=main.Autoupdate=no
+    '';
+
+    preCheck = ''
+      export HOME=/tmp
+    '';
+
+    doCheck = true;
   };
 
 in stdenv.mkDerivation rec {
diff --git a/pkgs/development/tools/kube-aws/default.nix b/pkgs/development/tools/kube-aws/default.nix
index 0a6d0ba32210..11f4a5c8bd0a 100644
--- a/pkgs/development/tools/kube-aws/default.nix
+++ b/pkgs/development/tools/kube-aws/default.nix
@@ -4,20 +4,26 @@ with lib;
 
 buildGoPackage rec {
   name = "kube-aws-${version}";
-  version = "0.8.1";
+  version = "0.9.4";
 
-  goPackagePath = "github.com/coreos/coreos-kubernetes";
+  goPackagePath = "github.com/coreos/kube-aws";
 
   src = fetchFromGitHub {
     owner = "coreos";
-    repo = "coreos-kubernetes";
+    repo = "kube-aws";
     rev = "v${version}";
-    sha256 = "067nc525km0f37w5km44fs5pr22a6zz3lkdwwg2akb4hhg6f45c2";
+    sha256 = "11h14fsnflbx76rmpp0fxahbxi2qgcamgyxy9s4rmw83j2m8csxp";
   };
 
-  preBuild = ''
-    (cd go/src/github.com/coreos/coreos-kubernetes
-     go generate multi-node/aws/pkg/config/config.go)
+  preBuild = ''(
+    cd go/src/${goPackagePath}
+    go generate ./core/controlplane/config
+    go generate ./core/nodepool/config
+    go generate ./core/root/config
+  )'';
+
+  buildFlagsArray = ''
+    -ldflags=-X github.com/coreos/kube-aws/core/controlplane/cluster.VERSION=v${version}
   '';
 
   meta = {
@@ -25,6 +31,6 @@ buildGoPackage rec {
     license = licenses.asl20;
     homepage = https://github.com/coreos/coreos-kubernetes;
     maintainers = with maintainers; [offline];
-    platforms = with platforms; linux;
+    platforms = with platforms; unix;
   };
 }
diff --git a/pkgs/development/tools/misc/autogen/default.nix b/pkgs/development/tools/misc/autogen/default.nix
index 251387e7bd51..28034f9d5492 100644
--- a/pkgs/development/tools/misc/autogen/default.nix
+++ b/pkgs/development/tools/misc/autogen/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "autogen-${version}";
-  version = "5.18.7";
+  version = "5.18.12";
 
   src = fetchurl {
-    url = "mirror://gnu/autogen/autogen-${version}.tar.xz";
-    sha256 = "01d4m8ckww12sy50vgyxlnz83z9dxqpyqp153cscncc9w6jq19d7";
+    url = "mirror://gnu/autogen/rel${version}/autogen-${version}.tar.xz";
+    sha256 = "1n5zq4872sakvz9c7ncsdcfp0z8rsybsxvbmhkpbd19ii0pacfxy";
   };
 
   outputs = [ "bin" "dev" "lib" "out" "man" "info" ];
diff --git a/pkgs/development/tools/misc/gede/build.patch b/pkgs/development/tools/misc/gede/build.patch
new file mode 100644
index 000000000000..bdd8b7ff5f96
--- /dev/null
+++ b/pkgs/development/tools/misc/gede/build.patch
@@ -0,0 +1,11 @@
+--- a/build.py	2017-01-16 21:12:43.000000000 +0100
++++ b/build.py	2017-02-26 22:03:11.394625315 +0100
+@@ -71,7 +71,7 @@
+         if do_build:
+             if not os.path.exists("Makefile"):
+                 print("Generating makefile")
+-                if subprocess.call(['qmake-qt4']):
++                if subprocess.call(['qmake']):
+                     exit(1)
+ 
+             print("Compiling (please wait)")
diff --git a/pkgs/development/tools/misc/gede/default.nix b/pkgs/development/tools/misc/gede/default.nix
new file mode 100644
index 000000000000..5667e496a70a
--- /dev/null
+++ b/pkgs/development/tools/misc/gede/default.nix
@@ -0,0 +1,31 @@
+{stdenv, fetchurl, ctags, qt4, python}:
+
+stdenv.mkDerivation rec {
+
+  version = "2.0.3";
+  name = "gede-${version}";
+  src = fetchurl {
+    url = "http://gede.acidron.com/uploads/source/${name}.tar.xz";
+    sha256 = "1znlmkjgrmjl79q73xaa9ybp1xdc3k4h4ynv3jj5z8f92gjnj3kk";
+  };
+
+  buildInputs = [ ctags qt4 python ];
+  patches = [ ./build.patch ];
+
+  unpackPhase = ''
+    tar xf ${src}
+    cd ${name}
+  '';
+  configurePhase = "";
+  buildPhase = "";
+  installPhase = "./build.py install --prefix=$out";
+
+  meta = with stdenv.lib; {
+    description = "Graphical frontend (GUI) to GDB";
+    homepage = "http://gede.acidron.com";
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ juliendehos ];
+  };
+}
+
diff --git a/pkgs/development/tools/misc/global/default.nix b/pkgs/development/tools/misc/global/default.nix
index bd111c4ffbbd..62d96b2158f9 100644
--- a/pkgs/development/tools/misc/global/default.nix
+++ b/pkgs/development/tools/misc/global/default.nix
@@ -34,8 +34,10 @@ stdenv.mkDerivation rec {
     cp -v *.el "$out/share/emacs/site-lisp"
 
     wrapProgram $out/bin/gtags \
+      --prefix GTAGSCONF : "$out/share/gtags/gtags.conf" \
       --prefix PYTHONPATH : "$(toPythonPath ${pythonPackages.pygments})"
     wrapProgram $out/bin/global \
+      --prefix GTAGSCONF : "$out/share/gtags/gtags.conf" \
       --prefix PYTHONPATH : "$(toPythonPath ${pythonPackages.pygments})"
   '';
 
diff --git a/pkgs/development/tools/misc/lit/default.nix b/pkgs/development/tools/misc/lit/default.nix
new file mode 100644
index 000000000000..adc5ba967583
--- /dev/null
+++ b/pkgs/development/tools/misc/lit/default.nix
@@ -0,0 +1,22 @@
+{ lib, python2 }:
+
+python2.pkgs.buildPythonApplication rec {
+  pname = "lit";
+  version = "0.5.0";
+  name = "${pname}-${version}";
+
+  src = python2.pkgs.fetchPypi {
+    inherit pname version;
+    sha256 = "3ea4251e78ebeb2e07be2feb33243d1f8931d956efc96ccc2b0846ced212b58c";
+  };
+
+  # Non-standard test suite. Needs custom checkPhase.
+  doCheck = false;
+
+  meta = {
+    description = "Portable tool for executing LLVM and Clang style test suites";
+    homepage = "http://llvm.org/docs/CommandGuide/lit.html";
+    license = lib.licenses.ncsa;
+    maintainers = with lib.maintainers; [ dtzWill ];
+  };
+}
diff --git a/pkgs/development/tools/misc/objconv/default.nix b/pkgs/development/tools/misc/objconv/default.nix
index bae9f07bda48..3c309493a33b 100644
--- a/pkgs/development/tools/misc/objconv/default.nix
+++ b/pkgs/development/tools/misc/objconv/default.nix
@@ -1,26 +1,39 @@
-{ stdenv, fetchFromGitHub }:
+{ stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation rec {
   name = "objconv-${version}";
-  version = "2.16";
+  version = "2.44";
 
-  src = fetchFromGitHub {
-    owner  = "vertis";
-    repo   = "objconv";
-    rev    = "${version}";
-    sha256 = "1by2bbrampwv0qy8vn4hhs49rykczyj7q8g373ym38da3c95bym2";
+  src = fetchurl {
+    # Versioned archive of objconv sources maintained by orivej.
+    url = "https://archive.org/download/objconv/${name}.zip";
+    sha256 = "1dlnpv8qwz0rwivpbgk84kmsjz3vh1i149z44ha2dvg8afzyfhjl";
   };
 
-  buildPhase = "c++ -o objconv -O2 src/*.cpp";
+  nativeBuildInputs = [ unzip ];
 
-  installPhase = "mkdir -p $out/bin && mv objconv $out/bin";
+  outputs = [ "out" "doc" ];
+
+  unpackPhase = ''
+    mkdir -p "$name"
+    cd "$name"
+    unpackFile "$src"
+    unpackFile source.zip
+  '';
+
+  buildPhase = "c++ -o objconv -O2 *.cpp";
+
+  installPhase = ''
+    mkdir -p $out/bin $out/doc/objconv
+    mv objconv $out/bin
+    mv objconv-instructions.pdf $out/doc/objconv
+  '';
 
   meta = with stdenv.lib; {
-    description = "Used for converting object files between COFF/PE, OMF, ELF and Mach-O formats for all 32-bit and 64-bit x86 platforms.";
+    description = "Object and executable file converter, modifier and disassembler";
     homepage = http://www.agner.org/optimize/;
     license = licenses.gpl2;
-    maintainers = with maintainers; [ vrthra ];
-    platforms = with platforms; unix;
+    maintainers = with maintainers; [ orivej vrthra ];
+    platforms = platforms.unix;
   };
-
 }
diff --git a/pkgs/development/tools/misc/sipp/default.nix b/pkgs/development/tools/misc/sipp/default.nix
index 266a9824ed2a..a506831cd8ea 100644
--- a/pkgs/development/tools/misc/sipp/default.nix
+++ b/pkgs/development/tools/misc/sipp/default.nix
@@ -1,28 +1,41 @@
-{stdenv, fetchurl, ncurses, libpcap }:
+{stdenv, fetchFromGitHub, autoreconfHook, ncurses, libpcap }:
 
 stdenv.mkDerivation rec {
-
-  version = "3.4-beta2";
+  version = "3.5.1";
 
   name = "sipp-${version}";
 
-  src = fetchurl {
-    url = "https://github.com/SIPp/sipp/archive/${version}.tar.gz";
-    sha256 = "0rr3slarh5dhpinif5aqji9c9krnpvl7z49w7qahvsww1niawwdv";
+  src = fetchFromGitHub {
+    owner = "SIPp";
+    repo = "sipp";
+    rev = "v${version}";
+    sha256 = "179a1fvqyk3jpxbi28l1xfw22cw9vgvxrn19w5f38w74x0jwqg5k";
   };
 
-  configurePhase = ''
-    export ac_cv_lib_curses_initscr=yes
-    export ac_cv_lib_pthread_pthread_mutex_init=yes
+  patchPhase = ''
     sed -i "s@pcap/\(.*\).pcap@$out/share/pcap/\1.pcap@g" src/scenario.cpp
-    ./configure --prefix=$out --with-pcap
+    sed -i -e "s|AC_CHECK_LIB(curses|AC_CHECK_LIB(ncurses|" configure.ac
+    echo "#define SIPP_VERSION \"v${version}\"" > include/version.h
   '';
 
+  configureFlags = [
+    "--with-pcap"
+  ];
+
   postInstall = ''
     mkdir -pv $out/share/pcap
     cp pcap/* $out/share/pcap
   '';
 
   buildInputs = [ncurses libpcap];
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  meta = with stdenv.lib; {
+    homepage = http://sipp.sf.net;
+    description = "The SIPp testing tool";
+    license = licenses.gpl3;
+    platforms = platforms.unix;
+  };
 }
 
diff --git a/pkgs/development/tools/misc/travis/Gemfile.lock b/pkgs/development/tools/misc/travis/Gemfile.lock
index e84e87fb5232..529be0793605 100644
--- a/pkgs/development/tools/misc/travis/Gemfile.lock
+++ b/pkgs/development/tools/misc/travis/Gemfile.lock
@@ -3,32 +3,32 @@ GEM
   specs:
     addressable (2.4.0)
     backports (3.6.8)
-    ethon (0.8.1)
+    ethon (0.10.1)
       ffi (>= 1.3.0)
-    faraday (0.9.2)
+    faraday (0.11.0)
       multipart-post (>= 1.2, < 3)
-    faraday_middleware (0.10.0)
-      faraday (>= 0.7.4, < 0.10)
-    ffi (1.9.10)
-    gh (0.14.0)
-      addressable
+    faraday_middleware (0.11.0.1)
+      faraday (>= 0.7.4, < 1.0)
+    ffi (1.9.18)
+    gh (0.15.1)
+      addressable (~> 2.4.0)
       backports
       faraday (~> 0.8)
       multi_json (~> 1.0)
-      net-http-persistent (>= 2.7)
+      net-http-persistent (~> 2.9)
       net-http-pipeline
     highline (1.7.8)
-    json (1.8.3)
+    json (2.0.3)
     launchy (2.4.3)
       addressable (~> 2.3)
-    multi_json (1.11.2)
+    multi_json (1.12.1)
     multipart-post (2.0.0)
     net-http-persistent (2.9.4)
     net-http-pipeline (1.0.1)
     pusher-client (0.6.2)
       json
       websocket (~> 1.0)
-    travis (1.8.2)
+    travis (1.8.8)
       backports
       faraday (~> 0.9)
       faraday_middleware (~> 0.9, >= 0.9.1)
@@ -39,7 +39,7 @@ GEM
       typhoeus (~> 0.6, >= 0.6.8)
     typhoeus (0.8.0)
       ethon (>= 0.8.0)
-    websocket (1.2.2)
+    websocket (1.2.4)
 
 PLATFORMS
   ruby
@@ -48,4 +48,4 @@ DEPENDENCIES
   travis
 
 BUNDLED WITH
-   1.11.2
+   1.14.4
diff --git a/pkgs/development/tools/misc/travis/gemset.nix b/pkgs/development/tools/misc/travis/gemset.nix
index abfd352e90ec..148923848beb 100644
--- a/pkgs/development/tools/misc/travis/gemset.nix
+++ b/pkgs/development/tools/misc/travis/gemset.nix
@@ -18,42 +18,42 @@
   ethon = {
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "0afvvv4sxs330jhk4xz9kj6qgj70yvd4zsjnb9yvxhmaq49k8yij";
+      sha256 = "1i873cvma4j52xmij7kasjylh66vf60cy5prkp4cz4hcn9jlkznl";
       type = "gem";
     };
-    version = "0.8.1";
+    version = "0.10.1";
   };
   faraday = {
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1kplqkpn2s2yl3lxdf6h7sfldqvkbkpxwwxhyk7mdhjplb5faqh6";
+      sha256 = "18p1csdivgwmshfw3mb698a3bn0yrykg30khk5qxjf6n168g91jr";
       type = "gem";
     };
-    version = "0.9.2";
+    version = "0.11.0";
   };
   faraday_middleware = {
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "0nxia26xzy8i56qfyz1bg8dg9yb26swpgci8n5jry8mh4bnx5r5h";
+      sha256 = "0bcarc90brm1y68bl957w483bddsy9idj2gghqnysk6bbxpsvm00";
       type = "gem";
     };
-    version = "0.10.0";
+    version = "0.11.0.1";
   };
   ffi = {
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1m5mprppw0xcrv2mkim5zsk70v089ajzqiq5hpyb0xg96fcyzyxj";
+      sha256 = "034f52xf7zcqgbvwbl20jwdyjwznvqnwpbaps9nk18v9lgb1dpx0";
       type = "gem";
     };
-    version = "1.9.10";
+    version = "1.9.18";
   };
   gh = {
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "0j7m6jmxzkxvnqgnhmci33a89qpaxxcrm55kk5vz4bcpply04hx2";
+      sha256 = "0g4df0jsscq16g6f27flfmvk7p4sbq81d5mdylbz4ikqq60kywzg";
       type = "gem";
     };
-    version = "0.14.0";
+    version = "0.15.1";
   };
   highline = {
     source = {
@@ -66,10 +66,10 @@
   json = {
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1nsby6ry8l9xg3yw4adlhk2pnc7i0h0rznvcss4vk3v74qg0k8lc";
+      sha256 = "0cpw154il64w6q20rrnsbjx1cdfz1yrzz1lgdbpn59lcwc6mprql";
       type = "gem";
     };
-    version = "1.8.3";
+    version = "2.0.3";
   };
   launchy = {
     source = {
@@ -82,10 +82,10 @@
   multi_json = {
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1rf3l4j3i11lybqzgq2jhszq7fh7gpmafjzd14ymp9cjfxqg596r";
+      sha256 = "1wpc23ls6v2xbk3l1qncsbz16npvmw8p0b38l8czdzri18mp51xk";
       type = "gem";
     };
-    version = "1.11.2";
+    version = "1.12.1";
   };
   multipart-post = {
     source = {
@@ -122,10 +122,10 @@
   travis = {
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "0ph83whzw5hjkp1kgbkjd2g0vi6kdr9sif6vxvxgjf186id43q0s";
+      sha256 = "02bjz73f6r9b7nskwzcvcbr4hlvgwrf9rnr6d218d2i1rk4ww936";
       type = "gem";
     };
-    version = "1.8.2";
+    version = "1.8.8";
   };
   typhoeus = {
     source = {
@@ -138,9 +138,9 @@
   websocket = {
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1frcsgj4f984db920xwapflqwgrwncw86c1rv94pp5gs2q1iaap4";
+      sha256 = "1shymfaw14p8jdi74nwz4nsgc9cmpli166lkp5g5wbhjmhmpvrnh";
       type = "gem";
     };
-    version = "1.2.2";
+    version = "1.2.4";
   };
 }
\ No newline at end of file
diff --git a/pkgs/development/tools/misc/xxdiff/tip.nix b/pkgs/development/tools/misc/xxdiff/tip.nix
new file mode 100644
index 000000000000..b613508c5c05
--- /dev/null
+++ b/pkgs/development/tools/misc/xxdiff/tip.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromBitbucket, qt5, flex, bison, docutils }:
+
+stdenv.mkDerivation rec {
+  name = "xxdiff-4.0.1.20170101";
+
+  src = fetchFromBitbucket {
+    owner = "blais";
+    repo = "xxdiff";
+    rev = "1cf6b23ad30a845daba28a3409c65f93aec7f5e8";
+    sha256 = "0rq7grpndj85i7qzlj93jpzpfzk7bwsi55033fc63hb55rbdzz6z";
+  };
+
+  nativeBuildInputs = [ flex bison qt5.qtbase docutils ];
+
+  buildInputs = [ qt5.qtbase ];
+
+  preConfigure = ''
+    ln -s ${qt5.qtbase.dev}/mkspecs/* ../__nix_qt*__/mkspecs
+    ln -s ${qt5.qtbase.dev}/bin/* ../__nix_qt*__/bin || true
+  '';
+
+  NIX_CFLAGS_COMPILE="-I${qt5.qtbase.dev}/include/QtCore -I${qt5.qtbase.dev}/include/QtGui -I${qt5.qtbase.dev}/include/QtWidgets";
+  
+  configurePhase = "${preConfigure} cd src; make -f Makefile.bootstrap";
+
+  installPhase = "mkdir -pv $out/bin; cp -v ../bin/xxdiff $out/bin";
+
+
+  meta = with stdenv.lib; {
+    homepage = http://furius.ca/xxdiff/;
+    description = "Graphical file and directories comparator and merge tool";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ pSub raskin ];
+  };
+}
diff --git a/pkgs/development/tools/ocaml/jbuilder/default.nix b/pkgs/development/tools/ocaml/jbuilder/default.nix
new file mode 100644
index 000000000000..9d6485841fae
--- /dev/null
+++ b/pkgs/development/tools/ocaml/jbuilder/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchzip, ocaml, opam }:
+
+stdenv.mkDerivation {
+  name = "jbuilder-1.0+beta2";
+  src = fetchzip {
+    url = http://github.com/janestreet/jbuilder/archive/1.0+beta2.tar.gz;
+    sha256 = "0xbq6p0n4a740l3jvq4a0a58mwfcal0q37vi8ix053f3jiqki6ng";
+  };
+
+  buildInputs = [ ocaml ];
+
+  installPhase = "${opam}/bin/opam-installer -i --prefix=$out --libdir=$OCAMLFIND_DESTDIR";
+
+  preFixup = "rm -rf $out/jbuilder";
+
+  meta = {
+    homepage = https://github.com/janestreet/jbuilder;
+    description = "Fast, portable and opinionated build system";
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+    license = stdenv.lib.licenses.asl20;
+    inherit (ocaml.meta) platforms;
+  };
+}
diff --git a/pkgs/development/tools/ocaml/ocaml-top/default.nix b/pkgs/development/tools/ocaml/ocaml-top/default.nix
index 5f3a2b884b16..e194a77fbe81 100644
--- a/pkgs/development/tools/ocaml/ocaml-top/default.nix
+++ b/pkgs/development/tools/ocaml/ocaml-top/default.nix
@@ -1,15 +1,16 @@
 { stdenv, fetchzip, ncurses
-, ocaml, ocpBuild, findlib, lablgtk, ocp-index
+, ocamlPackages
 , opam }:
 
 stdenv.mkDerivation {
-  name = "ocaml-top-1.1.2";
+  name = "ocaml-top-1.1.3";
   src = fetchzip {
-    url = https://github.com/OCamlPro/ocaml-top/archive/1.1.2.tar.gz;
-    sha256 = "10wfz8d6c1lbh31kayvlb5fj7qmgh5c6xhs3q595dnf9skrf091j";
+    url = https://github.com/OCamlPro/ocaml-top/archive/1.1.3.tar.gz;
+    sha256 = "0islyinv7lwhg8hkg4xn30wwz1nv50rj0wpsis8jpimw6jdsnax3";
   };
 
-  buildInputs = [ ncurses opam ocaml ocpBuild findlib lablgtk ocp-index ];
+  buildInputs = [ ncurses opam ]
+  ++ (with ocamlPackages; [ ocaml ocpBuild findlib lablgtk ocp-index ]);
 
   configurePhase = ''
     export TERM=xterm
@@ -18,15 +19,13 @@ stdenv.mkDerivation {
 
   buildPhase = "ocp-build ocaml-top";
 
-  installPhase = ''
-    opam-installer --script --prefix=$out ocaml-top.install | sh
-  '';
+  installPhase = "opam-installer --prefix=$out";
 
   meta = {
     homepage = http://www.typerex.org/ocaml-top.html;
     license = stdenv.lib.licenses.gpl3;
     description = "A simple cross-platform OCaml code editor built for top-level evaluation";
-    platforms = ocaml.meta.platforms or [];
+    platforms = ocamlPackages.ocaml.meta.platforms or [];
     maintainers = with stdenv.lib.maintainers; [ vbgl ];
   };
 }
diff --git a/pkgs/development/tools/parsing/jshon/default.nix b/pkgs/development/tools/parsing/jshon/default.nix
index 4b35ba0cce29..5406b4e9a0e5 100644
--- a/pkgs/development/tools/parsing/jshon/default.nix
+++ b/pkgs/development/tools/parsing/jshon/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchFromGitHub, jansson }:
+{ stdenv, lib, fetchFromGitHub, fetchpatch, jansson }:
 
 stdenv.mkDerivation rec {
   name = "jshon-20140712";
@@ -12,14 +12,23 @@ stdenv.mkDerivation rec {
     repo = "jshon";
   };
 
+  patches = [
+    # Fix null termination in read_stream.
+    # https://github.com/keenerd/jshon/issues/53
+    (fetchpatch {
+      url = https://github.com/mbrock/jshon/commit/32288dd186573ceb58164f30be1782d4580466d8.patch;
+      sha256 = "04rss2nprl9nqblc7smq0477n54hm801xgnnmvyzni313i1n6vhl";
+    })
+  ];
+
   buildInputs = [ jansson ];
 
-  patchPhase = 
+  patchPhase =
     ''
       substituteInPlace Makefile --replace "/usr/" "/"
     '';
 
-  preInstall = 
+  preInstall =
     ''
       export DESTDIR=$out
     '';
diff --git a/pkgs/development/tools/scalafmt/default.nix b/pkgs/development/tools/scalafmt/default.nix
index c7d26fc79ddb..59a16bfc27cb 100644
--- a/pkgs/development/tools/scalafmt/default.nix
+++ b/pkgs/development/tools/scalafmt/default.nix
@@ -1,13 +1,13 @@
 { stdenv, fetchurl, unzip, jre }:
 
 stdenv.mkDerivation rec {
-  version = "0.5.8";
+  version = "0.6.2";
   baseName = "scalafmt";
   name = "${baseName}-${version}";
 
   src = fetchurl {
     url = "https://github.com/olafurpg/scalafmt/releases/download/v${version}/${baseName}.tar.gz";
-    sha256 = "0pwmmn5k5wscmpidxpc88yrgm7gkpk9ssdh97lz0fjqln99gwp8r";
+    sha256 = "0xafl7vmncdycapi9shxqf73nhb24llgxjd2x98irmr9bvzg844q";
   };
 
   unpackPhase = "tar xvzf $src";
diff --git a/pkgs/development/tools/simavr/default.nix b/pkgs/development/tools/simavr/default.nix
index 82c2c131f07f..9fa6b8b5716c 100644
--- a/pkgs/development/tools/simavr/default.nix
+++ b/pkgs/development/tools/simavr/default.nix
@@ -4,7 +4,6 @@
 stdenv.mkDerivation rec {
   name = "simavr-${version}";
   version = "1.5";
-  enableParallelBuilding = true;
 
   src = fetchFromGitHub {
     owner = "buserror";
@@ -13,6 +12,9 @@ stdenv.mkDerivation rec {
     sha256 = "0b2lh6l2niv80dmbm9xkamvnivkbmqw6v97sy29afalrwfxylxla";
   };
 
+  # ld: cannot find -lsimavr
+  enableParallelBuilding = false;
+
   buildFlags = "AVR_ROOT=${avrgcclibc}/avr SIMAVR_VERSION=${version}";
   installFlags = buildFlags + " DESTDIR=$(out)";
 
diff --git a/pkgs/development/tools/slimerjs/default.nix b/pkgs/development/tools/slimerjs/default.nix
index cb6c4614a1a4..b3049736b710 100644
--- a/pkgs/development/tools/slimerjs/default.nix
+++ b/pkgs/development/tools/slimerjs/default.nix
@@ -1,13 +1,14 @@
-{stdenv, fetchurl, fetchgit, zip, unzip, firefox, bash}:
+{stdenv, fetchurl, fetchgit, fetchFromGitHub, zip, unzip, firefox, bash}:
 let
   s = # Generated upstream information
   rec {
     baseName="slimerjs";
-    version="0.10.2";
+    version="0.10.3";
     name="${baseName}-${version}";
-    hash="16pg12bvfqls707nsdqi3bl1c833kncsvnd0qiq5692lrh93x529";
-    url="http://download.slimerjs.org/releases/0.10.2/slimerjs-0.10.2.zip";
-    sha256="16pg12bvfqls707nsdqi3bl1c833kncsvnd0qiq5692lrh93x529";
+    owner = "laurentj";
+    repo = "${baseName}";
+    sha256="16v6a1kcq8il4snbrgsq5xmxs35alzf4qlmscr2yli95xq5fnl5y";
+    rev = "${version}";
   };
   buildInputs = [
     unzip zip
@@ -16,12 +17,15 @@ in
 stdenv.mkDerivation {
   inherit (s) name version;
   inherit buildInputs;
-  src = fetchurl {
-    inherit (s) url sha256;
-  };
+  #src = fetchurl {
+  #  inherit (s) url sha256;
+  #};
   #src = fetchgit {
   #  inherit (s) url sha256 rev;
   #};
+  src = fetchFromGitHub {
+    inherit (s) owner repo rev sha256;
+  };
   preConfigure = ''
     test -d src && cd src
     test -f omni.ja || zip omni.ja -r */
diff --git a/pkgs/development/tools/vndr/default.nix b/pkgs/development/tools/vndr/default.nix
index 7cc77bd1bb39..14f01863c8a4 100644
--- a/pkgs/development/tools/vndr/default.nix
+++ b/pkgs/development/tools/vndr/default.nix
@@ -18,6 +18,6 @@ buildGoPackage rec {
     description = "Stupid golang vendoring tool, inspired by docker vendor script";
     homepage = "https://github.com/LK4D4/vndr";
     maintainers = with lib.maintainers; [ vdemeester ];
-    licence = lib.licenses.asl20;
+    license = lib.licenses.asl20;
   };
 }
diff --git a/pkgs/development/web/nodejs/v7.nix b/pkgs/development/web/nodejs/v7.nix
index b34d84ac851a..a93cd16e00e1 100644
--- a/pkgs/development/web/nodejs/v7.nix
+++ b/pkgs/development/web/nodejs/v7.nix
@@ -10,11 +10,11 @@ let
   baseName = if enableNpm then "nodejs" else "nodejs-slim";
 in
   stdenv.mkDerivation (nodejs // rec {
-    version = "7.7.1";
+    version = "7.7.2";
     name = "${baseName}-${version}";
     src = fetchurl {
       url = "https://nodejs.org/download/release/v${version}/node-v${version}.tar.xz";
-      sha256 = "04bn7c2hvhs6dqjz3khrlqyspljbxiw7y7g4fkjkn8k7lwmchpwn";
+      sha256 = "117mqhvnvipyaq02knq75ikbk1swrw42b0kw6iijqb6k8j78si77";
     };
 
   })