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/julia/shared.nix2
-rw-r--r--pkgs/development/compilers/sbcl/default.nix4
-rw-r--r--pkgs/development/coq-modules/QuickChick/default.nix2
-rw-r--r--pkgs/development/coq-modules/category-theory/default.nix2
-rw-r--r--pkgs/development/coq-modules/coq-haskell/default.nix2
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix8
-rw-r--r--pkgs/development/interpreters/racket/default.nix2
-rw-r--r--pkgs/development/interpreters/spidermonkey/52.nix2
-rw-r--r--pkgs/development/libraries/clutter/default.nix6
-rw-r--r--pkgs/development/libraries/cogl/default.nix19
-rw-r--r--pkgs/development/libraries/gssdp/default.nix18
-rw-r--r--pkgs/development/libraries/gupnp-av/default.nix25
-rw-r--r--pkgs/development/libraries/gupnp-dlna/default.nix30
-rw-r--r--pkgs/development/libraries/gupnp-igd/default.nix29
-rw-r--r--pkgs/development/libraries/gupnp/default.nix41
-rw-r--r--pkgs/development/libraries/gupnp/fix-requires.patch9
-rw-r--r--pkgs/development/libraries/libmediainfo/default.nix4
-rw-r--r--pkgs/development/libraries/mono-addins/default.nix6
-rw-r--r--pkgs/development/libraries/mtxclient/default.nix31
-rw-r--r--pkgs/development/libraries/nix-plugins/default.nix4
-rw-r--r--pkgs/development/libraries/oniguruma/default.nix4
-rw-r--r--pkgs/development/libraries/openbsm/default.nix2
-rw-r--r--pkgs/development/libraries/physics/geant4/default.nix167
-rw-r--r--pkgs/development/libraries/physics/geant4/fetch.nix29
-rw-r--r--pkgs/development/libraries/physics/geant4/g4py/configure.patch12
-rw-r--r--pkgs/development/libraries/physics/geant4/g4py/default.nix113
-rw-r--r--pkgs/development/libraries/spdlog/default.nix60
-rw-r--r--pkgs/development/libraries/webkitgtk/2.4.nix9
-rw-r--r--pkgs/development/mobile/androidenv/androidndk.nix164
-rw-r--r--pkgs/development/python-modules/confluent-kafka/default.nix4
-rw-r--r--pkgs/development/python-modules/cozy/default.nix4
-rw-r--r--pkgs/development/python-modules/django-raster/default.nix8
-rw-r--r--pkgs/development/python-modules/fiona/default.nix2
-rw-r--r--pkgs/development/python-modules/flask-ldap-login/default.nix21
-rw-r--r--pkgs/development/python-modules/genanki/default.nix38
-rw-r--r--pkgs/development/python-modules/geopandas/default.nix10
-rw-r--r--pkgs/development/python-modules/joblib/default.nix4
-rw-r--r--pkgs/development/python-modules/jupyterlab_launcher/default.nix3
-rw-r--r--pkgs/development/python-modules/kubernetes/default.nix4
-rw-r--r--pkgs/development/python-modules/libusb1/default.nix10
-rw-r--r--pkgs/development/python-modules/locustio/default.nix20
-rw-r--r--pkgs/development/python-modules/mahotas/default.nix33
-rw-r--r--pkgs/development/python-modules/mahotas/disable-impure-tests.patch34
-rw-r--r--pkgs/development/python-modules/markerlib/default.nix30
-rw-r--r--pkgs/development/python-modules/ncclient/default.nix3
-rw-r--r--pkgs/development/python-modules/ordered-set/default.nix7
-rw-r--r--pkgs/development/python-modules/persistent/default.nix2
-rw-r--r--pkgs/development/python-modules/phonopy/default.nix8
-rw-r--r--pkgs/development/python-modules/pycaption/default.nix2
-rw-r--r--pkgs/development/python-modules/pyslurm/default.nix6
-rw-r--r--pkgs/development/python-modules/selectors2/default.nix29
-rw-r--r--pkgs/development/python-modules/sniffio/default.nix30
-rw-r--r--pkgs/development/python-modules/spacy/models.json78
-rw-r--r--pkgs/development/python-modules/tifffile/default.nix4
-rw-r--r--pkgs/development/python-modules/trio/default.nix2
-rw-r--r--pkgs/development/python-modules/urlgrabber/default.nix2
-rw-r--r--pkgs/development/r-modules/default.nix8
-rw-r--r--pkgs/development/tools/analysis/pmd/default.nix4
-rw-r--r--pkgs/development/tools/build-managers/bazel/default.nix10
-rw-r--r--pkgs/development/tools/build-managers/bear/default.nix4
-rw-r--r--pkgs/development/tools/castxml/default.nix10
-rw-r--r--pkgs/development/tools/govendor/default.nix22
-rw-r--r--pkgs/development/tools/hcloud/default.nix13
-rw-r--r--pkgs/development/tools/jbake/default.nix2
-rw-r--r--pkgs/development/tools/misc/kconfig-frontends/default.nix14
-rw-r--r--pkgs/development/tools/misc/lttng-ust/default.nix4
-rw-r--r--pkgs/development/tools/ocaml/opam/1.2.2.nix92
-rw-r--r--pkgs/development/tools/ocaml/opam/default.nix100
-rw-r--r--pkgs/development/tools/ocaml/opam/opam-mccs-darwin.patch18
-rw-r--r--pkgs/development/tools/ocaml/opam/opam-pull-3487.patch23
-rw-r--r--pkgs/development/tools/ocaml/opam/opam-shebangs.patch128
-rwxr-xr-xpkgs/development/tools/ocaml/opam/opam.nix.pl130
-rw-r--r--pkgs/development/tools/pyre/default.nix80
-rw-r--r--pkgs/development/tools/pyre/pyre-bdist-wheel.patch43
74 files changed, 1397 insertions, 512 deletions
diff --git a/pkgs/development/compilers/julia/shared.nix b/pkgs/development/compilers/julia/shared.nix
index 41c9c57bd034..e07c2c04b92d 100644
--- a/pkgs/development/compilers/julia/shared.nix
+++ b/pkgs/development/compilers/julia/shared.nix
@@ -211,7 +211,7 @@ stdenv.mkDerivation rec {
     description = "High-level performance-oriented dynamical language for technical computing";
     homepage = https://julialang.org/;
     license = stdenv.lib.licenses.mit;
-    maintainers = with stdenv.lib.maintainers; [ raskin rob ];
+    maintainers = with stdenv.lib.maintainers; [ raskin rob garrison ];
     platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
     broken = stdenv.isi686;
   };
diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix
index a860aa7dc734..34855838fe8b 100644
--- a/pkgs/development/compilers/sbcl/default.nix
+++ b/pkgs/development/compilers/sbcl/default.nix
@@ -9,11 +9,11 @@
 
 stdenv.mkDerivation rec {
   name    = "sbcl-${version}";
-  version = "1.4.7";
+  version = "1.4.10";
 
   src = fetchurl {
     url    = "mirror://sourceforge/project/sbcl/sbcl/${version}/${name}-source.tar.bz2";
-    sha256 = "1wmxly94pn8527092hyzg5mq58mg7qlc46nm31f268wb2dm67rvm";
+    sha256 = "1j9wb608pkihpwgzl4qvnr4jl6mb7ngfqy559pxnvmnn1zlyfklh";
   };
 
   patchPhase = ''
diff --git a/pkgs/development/coq-modules/QuickChick/default.nix b/pkgs/development/coq-modules/QuickChick/default.nix
index 35cf63af8627..fc88a1c33eed 100644
--- a/pkgs/development/coq-modules/QuickChick/default.nix
+++ b/pkgs/development/coq-modules/QuickChick/default.nix
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
   '';
 
   meta = with stdenv.lib; {
-    homepage = git://github.com/QuickChick/QuickChick.git;
+    homepage = https://github.com/QuickChick/QuickChick;
     description = "Randomized property-based testing plugin for Coq; a clone of Haskell QuickCheck";
     maintainers = with maintainers; [ jwiegley ];
     platforms = coq.meta.platforms;
diff --git a/pkgs/development/coq-modules/category-theory/default.nix b/pkgs/development/coq-modules/category-theory/default.nix
index 795c177bc80d..c707fcdbd6be 100644
--- a/pkgs/development/coq-modules/category-theory/default.nix
+++ b/pkgs/development/coq-modules/category-theory/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
   '';
 
   meta = with stdenv.lib; {
-    homepage = git://github.com/jwiegley/category-theory.git;
+    homepage = https://github.com/jwiegley/category-theory;
     description = "A formalization of category theory in Coq for personal study and practical work";
     maintainers = with maintainers; [ jwiegley ];
     platforms = coq.meta.platforms;
diff --git a/pkgs/development/coq-modules/coq-haskell/default.nix b/pkgs/development/coq-modules/coq-haskell/default.nix
index a66e941a8c9c..9d9a4cb5f1a1 100644
--- a/pkgs/development/coq-modules/coq-haskell/default.nix
+++ b/pkgs/development/coq-modules/coq-haskell/default.nix
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
   '';
 
   meta = with stdenv.lib; {
-    homepage = git://github.com/jwiegley/coq-haskell.git;
+    homepage = https://github.com/jwiegley/coq-haskell;
     description = "A library for formalizing Haskell types and functions in Coq";
     maintainers = with maintainers; [ jwiegley ];
     platforms = coq.meta.platforms;
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index ef55272d6e97..2e293f1031b0 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -1130,4 +1130,12 @@ self: super: {
 
   # https://github.com/snapframework/xmlhtml/pull/37
   xmlhtml = doJailbreak super.xmlhtml;
+
+  # https://github.com/NixOS/nixpkgs/issues/46467
+  safe-money-aeson = super.safe-money-aeson.override { safe-money = self.safe-money_0_7; };
+  safe-money-store = super.safe-money-store.override { safe-money = self.safe-money_0_7; };
+  safe-money-cereal = super.safe-money-cereal.override { safe-money = self.safe-money_0_7; };
+  safe-money-serialise = super.safe-money-serialise.override { safe-money = self.safe-money_0_7; };
+  safe-money-xmlbf = super.safe-money-xmlbf.override { safe-money = self.safe-money_0_7; };
+
 } // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super
diff --git a/pkgs/development/interpreters/racket/default.nix b/pkgs/development/interpreters/racket/default.nix
index e8b6cc93c2c1..1f2a28cb8fb8 100644
--- a/pkgs/development/interpreters/racket/default.nix
+++ b/pkgs/development/interpreters/racket/default.nix
@@ -36,7 +36,7 @@ in
 
 stdenv.mkDerivation rec {
   name = "racket-${version}";
-  version = "7.0";
+  version = "7.0"; # always change at once with ./minimal.nix
 
   src = (stdenv.lib.makeOverridable ({ name, sha256 }:
     fetchurl rec {
diff --git a/pkgs/development/interpreters/spidermonkey/52.nix b/pkgs/development/interpreters/spidermonkey/52.nix
index ecbb1abb40ca..7c6844fdec09 100644
--- a/pkgs/development/interpreters/spidermonkey/52.nix
+++ b/pkgs/development/interpreters/spidermonkey/52.nix
@@ -45,7 +45,7 @@ in stdenv.mkDerivation rec {
     "--with-intl-api"
     "--enable-readline"
     "--enable-shared-js"
-  ];
+  ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-jemalloc";
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/clutter/default.nix b/pkgs/development/libraries/clutter/default.nix
index 705aa7252d1f..d8150fd11508 100644
--- a/pkgs/development/libraries/clutter/default.nix
+++ b/pkgs/development/libraries/clutter/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, pkgconfig, libGLU_combined, libX11, libXext, libXfixes
-, libXdamage, libXcomposite, libXi, libxcb, cogl, pango, atk, json-glib,
-gobjectIntrospection, gtk3, gnome3
+, libXdamage, libXcomposite, libXi, libxcb, cogl, pango, atk, json-glib
+, gobjectIntrospection, gtk3, gnome3, libinput, libgudev, libxkbcommon
 }:
 
 let
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   propagatedBuildInputs =
     [ libX11 libGLU_combined libXext libXfixes libXdamage libXcomposite libXi cogl pango
-      atk json-glib gobjectIntrospection libxcb
+      atk json-glib gobjectIntrospection libxcb libinput libgudev libxkbcommon
     ];
 
   configureFlags = [ "--enable-introspection" ]; # needed by muffin AFAIK
diff --git a/pkgs/development/libraries/cogl/default.nix b/pkgs/development/libraries/cogl/default.nix
index e06c71c15db4..c624f9537fb3 100644
--- a/pkgs/development/libraries/cogl/default.nix
+++ b/pkgs/development/libraries/cogl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, libGL, glib, gdk_pixbuf, xorg, libintl
+{ stdenv, fetchurl, fetchpatch, pkgconfig, libGL, glib, gdk_pixbuf, xorg, libintl
 , pangoSupport ? true, pango, cairo, gobjectIntrospection, wayland, gnome3
 , mesa_noglu
 , gstreamerSupport ? true, gst_all_1 }:
@@ -14,6 +14,23 @@ in stdenv.mkDerivation rec {
     sha256 = "03f0ha3qk7ca0nnkkcr1garrm1n1vvfqhkz9lwjm592fnv6ii9rr";
   };
 
+  patches = [
+    # Some deepin packages need the following patches. They have been
+    # submitted by Fedora on the GNOME Bugzilla
+    # (https://bugzilla.gnome.org/787443). Upstream thinks the patch
+    # could be merged, but dev can not make a new release.
+
+    (fetchpatch {
+      url = https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=359589;
+      sha256 = "0f0d9iddg8zwy853phh7swikg4yzhxxv71fcag36f8gis0j5p998";
+    })
+
+    (fetchpatch {
+      url = https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=361056;
+      sha256 = "09fyrdci4727fg6qm5aaapsbv71sf4wgfaqz8jqlyy61dibgg490";
+    })
+  ];
+
   nativeBuildInputs = [ pkgconfig libintl ];
 
   configureFlags = [
diff --git a/pkgs/development/libraries/gssdp/default.nix b/pkgs/development/libraries/gssdp/default.nix
index d48ba9082af2..0d77018eee5f 100644
--- a/pkgs/development/libraries/gssdp/default.nix
+++ b/pkgs/development/libraries/gssdp/default.nix
@@ -1,22 +1,30 @@
-{ stdenv, fetchurl, pkgconfig, libsoup, glib }:
+{ stdenv, fetchurl, pkgconfig, gobjectIntrospection, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_412, libsoup, gtk3, glib }:
 
 stdenv.mkDerivation rec {
   name = "gssdp-${version}";
   version = "1.0.2";
 
+  outputs = [ "out" "bin" "dev" "devdoc" ];
+
   src = fetchurl {
-    url = "mirror://gnome/sources/gssdp/1.0/${name}.tar.xz";
+    url = "mirror://gnome/sources/gssdp/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "1p1m2m3ndzr2whipqw4vfb6s6ia0g7rnzzc4pnq8b8g1qw4prqd1";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ libsoup ];
+  nativeBuildInputs = [ pkgconfig gobjectIntrospection vala gtk-doc docbook_xsl docbook_xml_dtd_412 ];
+  buildInputs = [ libsoup gtk3 ];
   propagatedBuildInputs = [ glib ];
 
+  configureFlags = [
+    "--enable-gtk-doc"
+  ];
+
+  doCheck = true;
+
   meta = with stdenv.lib; {
     description = "GObject-based API for handling resource discovery and announcement over SSDP";
     homepage = http://www.gupnp.org/;
-    license = licenses.lgpl2;
+    license = licenses.lgpl2Plus;
     platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/gupnp-av/default.nix b/pkgs/development/libraries/gupnp-av/default.nix
index 9b61f4b648e1..7491da7c3e2f 100644
--- a/pkgs/development/libraries/gupnp-av/default.nix
+++ b/pkgs/development/libraries/gupnp-av/default.nix
@@ -1,22 +1,29 @@
-{ stdenv, fetchurl, pkgconfig, gupnp, glib, libxml2 }:
+{ stdenv, fetchurl, pkgconfig, gobjectIntrospection, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_412, gupnp, glib, libxml2 }:
 
 stdenv.mkDerivation rec {
   name = "gupnp-av-${version}";
-  majorVersion = "0.12";
-  version = "${majorVersion}.10";
+  version = "0.12.10";
+
+  outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gupnp-av/${majorVersion}/${name}.tar.xz";
+    url = "mirror://gnome/sources/gupnp-av/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "0nmq6wlbfsssanv3jgv2z0nhfkv8vzfr3gq5qa8svryvvn2fyf40";
   };
-  
-  nativeBuildInputs = [ pkgconfig ];
+
+  nativeBuildInputs = [ pkgconfig gobjectIntrospection vala gtk-doc docbook_xsl docbook_xml_dtd_412 ];
   buildInputs = [ gupnp glib libxml2 ];
 
-  meta = {
+  configureFlags = [
+    "--enable-gtk-doc"
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
     homepage = http://gupnp.org/;
     description = "A collection of helpers for building AV (audio/video) applications using GUPnP";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/gupnp-dlna/default.nix b/pkgs/development/libraries/gupnp-dlna/default.nix
index 75818f756921..aba95889b698 100644
--- a/pkgs/development/libraries/gupnp-dlna/default.nix
+++ b/pkgs/development/libraries/gupnp-dlna/default.nix
@@ -1,22 +1,34 @@
-{ stdenv, fetchurl, pkgconfig,  gobjectIntrospection, gupnp, gst-plugins-base }:
+{ stdenv, fetchurl, pkgconfig, gobjectIntrospection, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_412, gupnp, gst_all_1 }:
 
 stdenv.mkDerivation rec {
   name = "gupnp-dlna-${version}";
-  majorVersion = "0.10";
-  version = "${majorVersion}.5";
+  version = "0.10.5";
+
+  outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gupnp-dlna/${majorVersion}/${name}.tar.xz";
+    url = "mirror://gnome/sources/gupnp-dlna/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
     sha256 = "0spzd2saax7w776p5laixdam6d7smyynr9qszhbmq7f14y13cghj";
   };
 
-  nativeBuildInputs = [ pkgconfig gobjectIntrospection ];
-  buildInputs = [ gupnp gst-plugins-base ];
+  nativeBuildInputs = [ pkgconfig gobjectIntrospection vala gtk-doc docbook_xsl docbook_xml_dtd_412 ];
+  buildInputs = [ gupnp gst_all_1.gst-plugins-base ];
+
+  configureFlags = [
+    "--enable-gtk-doc"
+  ];
+
+  doCheck = true;
+
+  postPatch = ''
+    chmod +x tests/test-discoverer.sh.in
+    patchShebangs tests/test-discoverer.sh.in
+  '';
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = https://wiki.gnome.org/Projects/GUPnP/;
     description = "Library to ease DLNA-related bits for applications using GUPnP";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/gupnp-igd/default.nix b/pkgs/development/libraries/gupnp-igd/default.nix
index 182905e9546a..50107959786d 100644
--- a/pkgs/development/libraries/gupnp-igd/default.nix
+++ b/pkgs/development/libraries/gupnp-igd/default.nix
@@ -1,22 +1,29 @@
-{ stdenv, fetchurl, pkgconfig, glib, gupnp }:
- 
+{ stdenv, fetchurl, pkgconfig, gettext, gobjectIntrospection, gtk-doc, docbook_xsl, docbook_xml_dtd_412, glib, gupnp }:
+
 stdenv.mkDerivation rec {
   name = "gupnp-igd-${version}";
-  majorVersion = "0.2";
-  version = "${majorVersion}.4";
+  version = "0.2.5";
+
+  outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gupnp-igd/${majorVersion}/${name}.tar.xz";
-    sha256 = "38c4a6d7718d17eac17df95a3a8c337677eda77e58978129ad3182d769c38e44";
+    url = "mirror://gnome/sources/gupnp-igd/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
+    sha256 = "081v1vhkbz3wayv49xfiskvrmvnpx93k25am2wnarg5cifiiljlb";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig gettext gobjectIntrospection gtk-doc docbook_xsl docbook_xml_dtd_412 ];
   propagatedBuildInputs = [ glib gupnp ];
 
-  meta = {
+  configureFlags = [
+    "--enable-gtk-doc"
+  ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Library to handle UPnP IGD port mapping";
     homepage = http://www.gupnp.org/;
-    license = stdenv.lib.licenses.lgpl21;
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
   };
 }
-
diff --git a/pkgs/development/libraries/gupnp/default.nix b/pkgs/development/libraries/gupnp/default.nix
index 963b93ef6917..45adf46ff36f 100644
--- a/pkgs/development/libraries/gupnp/default.nix
+++ b/pkgs/development/libraries/gupnp/default.nix
@@ -1,28 +1,39 @@
-{ stdenv, fetchurl, pkgconfig, glib, gssdp, libsoup, libxml2, libuuid }:
- 
+{ stdenv, fetchurl, pkgconfig, gobjectIntrospection, vala, gtk-doc, docbook_xsl, docbook_xml_dtd_412, docbook_xml_dtd_44, glib, gssdp, libsoup, libxml2, libuuid }:
+
 stdenv.mkDerivation rec {
   name = "gupnp-${version}";
-  majorVersion = "1.0";
-  version = "${majorVersion}.2";
+  version = "1.0.3";
+
+  outputs = [ "out" "dev" "devdoc" ];
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gupnp/${majorVersion}/gupnp-${version}.tar.xz";
-    sha256 = "043nqxlj030a3wvd6x4c9z8fjarjjjsl2pjarl0nn70ig6kzswsi";
+    url = "mirror://gnome/sources/gupnp/${stdenv.lib.versions.majorMinor version}/gupnp-${version}.tar.xz";
+    sha256 = "1fyb6yn75vf2y1b8nbc1df572swzr74yiwy3v3g5xn36wlp1cjvr";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
+  patches = [
+    # Nix’s pkg-config ignores Requires.private
+    # https://github.com/NixOS/nixpkgs/commit/1e6622f4d5d500d6e701bd81dd4a22977d10637d
+    # We are essentialy reverting the following patch for now
+    # https://bugzilla.gnome.org/show_bug.cgi?id=685477
+    # at least until Requires.internal or something is implemented
+    # https://gitlab.freedesktop.org/pkg-config/pkg-config/issues/7
+    ./fix-requires.patch
+  ];
+
+  nativeBuildInputs = [ pkgconfig gobjectIntrospection vala gtk-doc docbook_xsl docbook_xml_dtd_412 docbook_xml_dtd_44 ];
   propagatedBuildInputs = [ glib gssdp libsoup libxml2 libuuid ];
 
-  postInstall = ''
-    ln -sv ${libsoup.dev}/include/libsoup-2*/libsoup $out/include
-    ln -sv ${libxml2.dev}/include/*/libxml $out/include
-    ln -sv ${gssdp}/include/*/libgssdp $out/include
-  '';
+  configureFlags = [
+    "--enable-gtk-doc"
+  ];
+
+  doCheck = true;
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = http://www.gupnp.org/;
     description = "An implementation of the UPnP specification";
-    license = stdenv.lib.licenses.gpl2;
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.lgpl2Plus;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/gupnp/fix-requires.patch b/pkgs/development/libraries/gupnp/fix-requires.patch
new file mode 100644
index 000000000000..4538fc55460f
--- /dev/null
+++ b/pkgs/development/libraries/gupnp/fix-requires.patch
@@ -0,0 +1,9 @@
+--- a/gupnp-1.0.pc.in
++++ b/gupnp-1.0.pc.in
+@@ -8,4 +8,5 @@
+ Version: @VERSION@
+ Libs: -L${libdir} -lgupnp-1.0
+ Cflags: -I${includedir}/gupnp-1.0
+-Requires.private: gssdp-1.0 libxml-2.0 libsoup-2.4 @UUID_LIBS@
++Requires: glib-2.0 gobject-2.0 gssdp-1.0 libxml-2.0 libsoup-2.4
++Requires.private: @UUID_LIBS@
diff --git a/pkgs/development/libraries/libmediainfo/default.nix b/pkgs/development/libraries/libmediainfo/default.nix
index 3ba513f90781..c4f41663c848 100644
--- a/pkgs/development/libraries/libmediainfo/default.nix
+++ b/pkgs/development/libraries/libmediainfo/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, autoreconfHook, pkgconfig, libzen, zlib }:
 
 stdenv.mkDerivation rec {
-  version = "18.05";
+  version = "18.08";
   name = "libmediainfo-${version}";
   src = fetchurl {
     url = "https://mediaarea.net/download/source/libmediainfo/${version}/libmediainfo_${version}.tar.xz";
-    sha256 = "08ajrmbvqn2cvfq3jjdh64lma77kx4di5vg632c6bmbir89rcxbn";
+    sha256 = "0h9fkfkil9y5xjxa7q4gxxihkn9kv9hak6ral2isvks5x3sy0ca8";
   };
 
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
diff --git a/pkgs/development/libraries/mono-addins/default.nix b/pkgs/development/libraries/mono-addins/default.nix
index e68661b44ec3..780f68e7d485 100644
--- a/pkgs/development/libraries/mono-addins/default.nix
+++ b/pkgs/development/libraries/mono-addins/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, mono, gtk-sharp-2_0 }:
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, mono48, gtk-sharp-2_0 }:
 
 stdenv.mkDerivation rec {
   name = "mono-addins-${version}";
@@ -13,7 +13,9 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkgconfig autoreconfHook ];
-  buildInputs = [ mono gtk-sharp-2_0 ];
+
+  # Use msbuild when https://github.com/NixOS/nixpkgs/pull/43680 is merged
+  buildInputs = [ mono48 gtk-sharp-2_0 ];
 
   dontStrip = true;
 
diff --git a/pkgs/development/libraries/mtxclient/default.nix b/pkgs/development/libraries/mtxclient/default.nix
new file mode 100644
index 000000000000..465a70576356
--- /dev/null
+++ b/pkgs/development/libraries/mtxclient/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig
+, boost, openssl, zlib, libsodium, olm, gtest, spdlog, nlohmann_json }:
+
+stdenv.mkDerivation rec {
+  name = "mtxclient-${version}";
+  version = "0.1.0";
+
+  src = fetchFromGitHub {
+    owner = "mujx";
+    repo = "mtxclient";
+    rev = "v${version}";
+    sha256 = "0i58y45diysayjzy5ick15356972z67dfxm0w41ay88nm42x1imp";
+  };
+
+  postPatch = ''
+    ln -s ${nlohmann_json}/include/nlohmann/json.hpp include/json.hpp
+  '';
+
+  cmakeFlags = [ "-DBUILD_LIB_TESTS=OFF" "-DBUILD_LIB_EXAMPLES=OFF" ];
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+  buildInputs = [ boost openssl zlib libsodium olm ];
+
+  meta = with stdenv.lib; {
+    description = "Client API library for Matrix, built on top of Boost.Asio";
+    homepage = https://github.com/mujx/mtxclient;
+    license = licenses.mit;
+    maintainers = with maintainers; [ fpletz ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/libraries/nix-plugins/default.nix b/pkgs/development/libraries/nix-plugins/default.nix
index ff8a54f87f2a..d3a4b21b4b61 100644
--- a/pkgs/development/libraries/nix-plugins/default.nix
+++ b/pkgs/development/libraries/nix-plugins/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub, nix, cmake, pkgconfig, boost }:
-let version = "4.0.5"; in
+let version = "5.0.0"; in
 stdenv.mkDerivation {
   name = "nix-plugins-${version}";
 
@@ -7,7 +7,7 @@ stdenv.mkDerivation {
     owner = "shlevy";
     repo = "nix-plugins";
     rev = version;
-    sha256 = "170f365rnik62fp9wllbqlspr8lf1yb96pmn2z708i2wjlkdnrny";
+    sha256 = "0231j92504vx0f4wax9hwjdni1j4z0g8bx9wbakg6rbghl4svmdv";
   };
 
   nativeBuildInputs = [ cmake pkgconfig ];
diff --git a/pkgs/development/libraries/oniguruma/default.nix b/pkgs/development/libraries/oniguruma/default.nix
index f9a75801e101..956c8b58ffc1 100644
--- a/pkgs/development/libraries/oniguruma/default.nix
+++ b/pkgs/development/libraries/oniguruma/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "onig-${version}";
-  version = "6.8.2";
+  version = "6.9.0";
 
   src = fetchFromGitHub {
     owner = "kkos";
     repo = "oniguruma";
     rev = "v${version}";
-    sha256 = "00ly5i26n7wajhyhq3xadsc7dxrf7qllhwilk8dza2qj5dhld4nd";
+    sha256 = "064nk8nxygqrk5b6n7zvrksf5shrsapn12zdi6crbbfbw0s7pn8h";
   };
 
   nativeBuildInputs = [ cmake ];
diff --git a/pkgs/development/libraries/openbsm/default.nix b/pkgs/development/libraries/openbsm/default.nix
index a9559c6abfba..136665425280 100644
--- a/pkgs/development/libraries/openbsm/default.nix
+++ b/pkgs/development/libraries/openbsm/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "0b98359hd8mm585sh145ss828pg2y8vgz38lqrb7nypapiyqdnd1";
   };
 
-  patches = [ ./bsm-add-audit_token_to_pid.patch ];
+  patches = lib.optional stdenv.isDarwin [ ./bsm-add-audit_token_to_pid.patch ];
 
   meta = {
     homepage = http://www.openbsm.org/;
diff --git a/pkgs/development/libraries/physics/geant4/default.nix b/pkgs/development/libraries/physics/geant4/default.nix
index 87af069c18a5..7123858b8edc 100644
--- a/pkgs/development/libraries/physics/geant4/default.nix
+++ b/pkgs/development/libraries/physics/geant4/default.nix
@@ -1,128 +1,101 @@
-{ enableMultiThreading ? false
+{ enableMultiThreading ? true
 , enableG3toG4         ? false
 , enableInventor       ? false
 , enableGDML           ? false
 , enableQT             ? false
 , enableXM             ? false
-, enableOpenGLX11      ? false
+, enableOpenGLX11      ? true
 , enableRaytracerX11   ? false
 
 # Standard build environment with cmake.
 , stdenv, fetchurl, cmake
 
 # Optional system packages, otherwise internal GEANT4 packages are used.
-, clhep ? null
-, expat ? null
-, zlib  ? null
+, clhep ? null # not packaged currently
+, expat
+, zlib
 
 # For enableGDML.
-, xercesc ? null
+, xercesc
 
 # For enableQT.
-, qt ? null # qt4SDK or qt5SDK
+, qtbase
 
 # For enableXM.
-, motif ? null # motif or lesstif
+, motif
 
 # For enableInventor
 , coin3d
 , soxt
-, libXpm ? null
+, libXpm
 
 # For enableQT, enableXM, enableOpenGLX11, enableRaytracerX11.
-, libGLU_combined ? null
-, xlibsWrapper ? null
-, libXmu ? null
+, libGLU_combined
+, xlibsWrapper
+, libXmu
 }:
 
-# G4persistency library with support for GDML
-assert enableGDML -> xercesc != null;
-
-# If enableQT, Qt4/5 User Interface and Visualization drivers.
-assert enableQT -> qt != null;
-
-# Motif User Interface and Visualisation drivers.
-assert enableXM -> motif != null;
-
-# OpenGL/X11 User Interface and Visualisation drivers.
-assert enableQT || enableXM || enableOpenGLX11 || enableRaytracerX11 -> libGLU_combined   != null;
-assert enableQT || enableXM || enableOpenGLX11 || enableRaytracerX11 -> xlibsWrapper    != null;
-assert enableQT || enableXM || enableOpenGLX11 || enableRaytracerX11 -> libXmu != null;
-assert enableInventor -> libXpm != null;
-
-let
-  buildGeant4 =
-    { version, src, multiThreadingCapable ? false }:
-
-    stdenv.mkDerivation rec {
-      inherit version src;
-      name = "geant4-${version}";
-
-      multiThreadingFlag = if multiThreadingCapable then "-DGEANT4_BUILD_MULTITHREADED=${if enableMultiThreading then "ON" else "OFF"}" else "";
-
-      cmakeFlags = ''
-        ${multiThreadingFlag}
-        -DGEANT4_INSTALL_DATA=OFF
-        -DGEANT4_USE_GDML=${if enableGDML then "ON" else "OFF"}
-        -DGEANT4_USE_G3TOG4=${if enableG3toG4 then "ON" else "OFF"}
-        -DGEANT4_USE_QT=${if enableQT then "ON" else "OFF"}
-        -DGEANT4_USE_XM=${if enableXM then "ON" else "OFF"}
-        -DGEANT4_USE_OPENGL_X11=${if enableOpenGLX11 then "ON" else "OFF"}
-        -DGEANT4_USE_INVENTOR=${if enableInventor then "ON" else "OFF"}
-        -DGEANT4_USE_RAYTRACER_X11=${if enableRaytracerX11 then "ON" else "OFF"}
-        -DGEANT4_USE_SYSTEM_CLHEP=${if clhep != null then "ON" else "OFF"}
-        -DGEANT4_USE_SYSTEM_EXPAT=${if expat != null then "ON" else "OFF"}
-        -DGEANT4_USE_SYSTEM_ZLIB=${if zlib != null then "ON" else "OFF"}
-        -DINVENTOR_INCLUDE_DIR=${coin3d}/include
-        -DINVENTOR_LIBRARY_RELEASE=${coin3d}/lib/libCoin.so
-      '';
-
-      enableParallelBuilding = true;
-      buildInputs = [ cmake clhep expat zlib xercesc qt motif libGLU_combined xlibsWrapper libXmu libXpm coin3d soxt ];
-      propagatedBuildInputs = [ clhep expat zlib xercesc qt motif libGLU_combined xlibsWrapper libXmu libXpm coin3d soxt ];
-
-      postFixup = ''
-        # Don't try to export invalid environment variables.
-        sed -i 's/export G4\([A-Z]*\)DATA/#export G4\1DATA/' "$out"/bin/geant4.sh
-      '';
-
-      setupHook = ./geant4-hook.sh;
-
-      passthru = {
-        data = import ./datasets.nix { inherit stdenv fetchurl; };
-      };
-
-      # Set the myriad of envars required by Geant4 if we use a nix-shell.
-      shellHook = ''
-        source $out/nix-support/setup-hook
-      '';
-
-      meta = with stdenv.lib; {
-        description = "A toolkit for the simulation of the passage of particles through matter";
-        longDescription = ''
-          Geant4 is a toolkit for the simulation of the passage of particles through matter.
-          Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science.
-          The two main reference papers for Geant4 are published in Nuclear Instruments and Methods in Physics Research A 506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278.
-        '';
-        homepage = http://www.geant4.org;
-        license = licenses.g4sl;
-        maintainers = with maintainers; [ tmplt ];
-        platforms = platforms.all;
-      };
-    };
-
-  fetchGeant4 = import ./fetch.nix {
-    inherit stdenv fetchurl;
+stdenv.mkDerivation rec {
+  version = "10.4.1";
+  name = "geant4-${version}";
+
+  src = fetchurl{
+    url = "http://cern.ch/geant4-data/releases/geant4.10.04.p01.tar.gz";
+    sha256 = "a3eb13e4f1217737b842d3869dc5b1fb978f761113e74bd4eaf6017307d234dd";
   };
 
-in {
-  v10_0_2 = buildGeant4 {
-    inherit (fetchGeant4.v10_0_2) version src;
-    multiThreadingCapable = true;
+  cmakeFlags = [
+    "-DGEANT4_INSTALL_DATA=OFF"
+    "-DGEANT4_USE_GDML=${if enableGDML then "ON" else "OFF"}"
+    "-DGEANT4_USE_G3TOG4=${if enableG3toG4 then "ON" else "OFF"}"
+    "-DGEANT4_USE_QT=${if enableQT then "ON" else "OFF"}"
+    "-DGEANT4_USE_XM=${if enableXM then "ON" else "OFF"}"
+    "-DGEANT4_USE_OPENGL_X11=${if enableOpenGLX11 then "ON" else "OFF"}"
+    "-DGEANT4_USE_INVENTOR=${if enableInventor then "ON" else "OFF"}"
+    "-DGEANT4_USE_RAYTRACER_X11=${if enableRaytracerX11 then "ON" else "OFF"}"
+    "-DGEANT4_USE_SYSTEM_CLHEP=${if clhep != null then "ON" else "OFF"}"
+    "-DGEANT4_USE_SYSTEM_EXPAT=${if expat != null then "ON" else "OFF"}"
+    "-DGEANT4_USE_SYSTEM_ZLIB=${if zlib != null then "ON" else "OFF"}"
+    "-DGEANT4_BUILD_MULTITHREADED=${if enableMultiThreading then "ON" else "OFF"}"
+  ] ++ stdenv.lib.optionals enableInventor [
+    "-DINVENTOR_INCLUDE_DIR=${coin3d}/include"
+    "-DINVENTOR_LIBRARY_RELEASE=${coin3d}/lib/libCoin.so"
+  ];
+
+  enableParallelBuilding = true;
+  nativeBuildInputs =  [ cmake ];
+  buildInputs = [ clhep expat zlib libGLU_combined xlibsWrapper libXmu ]
+    ++ stdenv.lib.optionals enableGDML [ xercesc ]
+    ++ stdenv.lib.optionals enableXM [ motif ]
+    ++ stdenv.lib.optionals enableQT [ qtbase ]
+    ++ stdenv.lib.optionals enableInventor [ libXpm coin3d soxt ];
+
+  postFixup = ''
+    # Don't try to export invalid environment variables.
+    sed -i 's/export G4\([A-Z]*\)DATA/#export G4\1DATA/' "$out"/bin/geant4.sh
+  '';
+
+  setupHook = ./geant4-hook.sh;
+
+  passthru = {
+    data = import ./datasets.nix { inherit stdenv fetchurl; };
   };
 
-  v10_4_1 = buildGeant4 {
-    inherit (fetchGeant4.v10_4_1) version src;
-    multiThreadingCapable = true;
+  # Set the myriad of envars required by Geant4 if we use a nix-shell.
+  shellHook = ''
+    source $out/nix-support/setup-hook
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A toolkit for the simulation of the passage of particles through matter";
+    longDescription = ''
+      Geant4 is a toolkit for the simulation of the passage of particles through matter.
+      Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science.
+      The two main reference papers for Geant4 are published in Nuclear Instruments and Methods in Physics Research A 506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278.
+    '';
+    homepage = http://www.geant4.org;
+    license = licenses.g4sl;
+    maintainers = with maintainers; [ tmplt ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/physics/geant4/fetch.nix b/pkgs/development/libraries/physics/geant4/fetch.nix
deleted file mode 100644
index 5d539b480d7d..000000000000
--- a/pkgs/development/libraries/physics/geant4/fetch.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{ stdenv, fetchurl }:
-
-let
-  fetch = { version, src ? builtins.getAttr stdenv.hostPlatform.system sources, sources ? null }:
-  {
-    inherit version src;
-  };
-
-in {
-  v10_0_2 = fetch {
-    version = "10.0.2";
-
-    src = fetchurl{
-      url = "http://geant4.cern.ch/support/source/geant4.10.00.p02.tar.gz";
-      sha256 = "9d615200901f1a5760970e8f5970625ea146253e4f7c5ad9df2a9cf84549e848";
-    };
-  };
-
-  v10_4_1 = fetch {
-    version = "10.4.1";
-
-    src = fetchurl{
-      url = "http://cern.ch/geant4-data/releases/geant4.10.04.p01.tar.gz";
-      sha256 = "a3eb13e4f1217737b842d3869dc5b1fb978f761113e74bd4eaf6017307d234dd";
-    };
-  };
-
-}
-
diff --git a/pkgs/development/libraries/physics/geant4/g4py/configure.patch b/pkgs/development/libraries/physics/geant4/g4py/configure.patch
deleted file mode 100644
index 886618abd34a..000000000000
--- a/pkgs/development/libraries/physics/geant4/g4py/configure.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- environments/g4py/configure	2014-03-17 22:47:05.000000000 +1100
-+++ environments/g4py/configure	2014-09-01 15:33:46.523637686 +1000
-@@ -4,9 +4,6 @@
- # ======================================================================
- export LANG=C
- 
--PATH=/bin:/usr/bin
--export PATH
--
- # ======================================================================
- # testing the echo features
- # ======================================================================
diff --git a/pkgs/development/libraries/physics/geant4/g4py/default.nix b/pkgs/development/libraries/physics/geant4/g4py/default.nix
index ee332171158d..551d61af3ada 100644
--- a/pkgs/development/libraries/physics/geant4/g4py/default.nix
+++ b/pkgs/development/libraries/physics/geant4/g4py/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ stdenv, fetchurl, cmake, xercesc
 
 # The target version of Geant4
 , geant4
@@ -9,66 +9,55 @@
 }:
 
 let
-  buildG4py = 
-    { version, src, geant4}:
-
-    stdenv.mkDerivation rec {
-      inherit version src geant4;
-      name = "g4py-${version}";
-
-      # ./configure overwrites $PATH, which clobbers everything.
-      patches = [ ./configure.patch ];
-      patchFlags = "-p0";
-
-      configurePhase = ''
-        export PYTHONPATH=$PYTHONPATH:${geant4}/lib64:$prefix
-
-        source ${geant4}/share/Geant4-*/geant4make/geant4make.sh
-        cd environments/g4py
-
-        ./configure linux64 --prefix=$prefix \
-                            --with-g4install-dir=${geant4} \
-                            --with-python-incdir=${python}/include/python${python.majorVersion} \
-                            --with-python-libdir=${python}/lib \
-                            --with-boost-incdir=${boost.dev}/include \
-                            --with-boost-libdir=${boost.out}/lib
-      '';
-
-      enableParallelBuilding = true;
-      buildInputs = [ geant4 boost python ];
-
-      setupHook = ./setup-hook.sh;
-
-      # Make sure we set PYTHONPATH
-      shellHook = ''
-        source $out/nix-support/setup-hook
-      '';
-
-      meta = {
-        description = "Python bindings and utilities for Geant4";
-        longDescription = ''
-          Geant4 is a toolkit for the simulation of the passage of particles
-          through matter.  Its areas of application include high energy,
-          nuclear and accelerator physics, as well as studies in medical and
-          space science.  The two main reference papers for Geant4 are
-          published in Nuclear Instruments and Methods in Physics Research A
-          506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1
-          (2006) 270-278.
-        '';
-        homepage = http://www.geant4.org;
-        license = stdenv.lib.licenses.g4sl;
-        maintainers = [ ];
-        platforms = stdenv.lib.platforms.all;
-      };
-    };
-
-    fetchGeant4 = import ../fetch.nix {
-      inherit stdenv fetchurl;
-    };
-
-in {
-  v10_0_2 = buildG4py {
-    inherit (fetchGeant4.v10_0_2) version src;
-    geant4 = geant4.v10_0_2;
+  # g4py does not support MT and will fail to build against MT geant
+  geant4_nomt = geant4.override { enableMultiThreading = false; };
+  boost_python = boost.override { enablePython = true; inherit python; };
+in
+
+stdenv.mkDerivation rec {
+  inherit (geant4_nomt) version src;
+  name = "g4py-${version}";
+
+  sourceRoot = "geant4.10.04.p01/environments/g4py";
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ geant4_nomt xercesc boost_python python ];
+
+  GEANT4_INSTALL = geant4_nomt;
+
+  preConfigure = ''
+    # Fix for boost 1.67+
+    substituteInPlace CMakeLists.txt \
+    --replace "find_package(Boost)" "find_package(Boost 1.40 REQUIRED COMPONENTS python${builtins.replaceStrings ["."] [""] python.majorVersion})"
+    for f in `find . -name CMakeLists.txt`; do
+      substituteInPlace "$f" \
+        --replace "boost_python" "\''${Boost_LIBRARIES}"
+    done
+  '';
+
+  enableParallelBuilding = true;
+
+  setupHook = ./setup-hook.sh;
+
+  # Make sure we set PYTHONPATH
+  shellHook = ''
+    source $out/nix-support/setup-hook
+  '';
+
+  meta = {
+    description = "Python bindings and utilities for Geant4";
+    longDescription = ''
+      Geant4 is a toolkit for the simulation of the passage of particles
+      through matter.  Its areas of application include high energy,
+      nuclear and accelerator physics, as well as studies in medical and
+      space science.  The two main reference papers for Geant4 are
+      published in Nuclear Instruments and Methods in Physics Research A
+      506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1
+      (2006) 270-278.
+    '';
+    homepage = http://www.geant4.org;
+    license = stdenv.lib.licenses.g4sl;
+    maintainers = [ ];
+    platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/spdlog/default.nix b/pkgs/development/libraries/spdlog/default.nix
index 1c9e67f87675..a96cd455f554 100644
--- a/pkgs/development/libraries/spdlog/default.nix
+++ b/pkgs/development/libraries/spdlog/default.nix
@@ -1,32 +1,46 @@
 { stdenv, fetchFromGitHub, cmake }:
 
-stdenv.mkDerivation rec {
-  name = "spdlog-${version}";
-  version = "0.14.0";
-
-  src = fetchFromGitHub {
-    owner  = "gabime";
-    repo   = "spdlog";
-    rev    = "v${version}";
-    sha256 = "13730429gwlabi432ilpnja3sfvy0nn2719vnhhmii34xcdyc57q";
-  };
+let
+  generic = { version, sha256 }:
+    stdenv.mkDerivation {
+      name = "spdlog-${version}";
+      inherit version;
+
+      src = fetchFromGitHub {
+        owner  = "gabime";
+        repo   = "spdlog";
+        rev    = "v${version}";
+        inherit sha256;
+      };
 
-  nativeBuildInputs = [ cmake ];
+      nativeBuildInputs = [ cmake ];
 
-  # cmakeFlags = [ "-DSPDLOG_BUILD_EXAMPLES=ON" ];
+      # cmakeFlags = [ "-DSPDLOG_BUILD_EXAMPLES=ON" ];
 
-  outputs = [ "out" "doc" ];
+      outputs = [ "out" "doc" ];
 
-  postInstall = ''
-    mkdir -p $out/share/doc/spdlog
-    cp -rv ../example $out/share/doc/spdlog
-  '';
+      postInstall = ''
+        mkdir -p $out/share/doc/spdlog
+        cp -rv ../example $out/share/doc/spdlog
+      '';
 
-  meta = with stdenv.lib; {
-    description    = "Very fast, header only, C++ logging library.";
-    homepage       = https://github.com/gabime/spdlog;
-    license        = licenses.mit;
-    maintainers    = with maintainers; [ obadz ];
-    platforms      = platforms.all;
+      meta = with stdenv.lib; {
+        description    = "Very fast, header only, C++ logging library.";
+        homepage       = https://github.com/gabime/spdlog;
+        license        = licenses.mit;
+        maintainers    = with maintainers; [ obadz ];
+        platforms      = platforms.all;
+      };
+    };
+in
+{
+  spdlog_1 = generic {
+    version = "1.1.0";
+    sha256 = "0yckz5w02v8193jhxihk9v4i8f6jafyg2a33amql0iclhk17da8f";
+  };
+
+  spdlog_0 = generic {
+    version = "0.14.0";
+    sha256 = "13730429gwlabi432ilpnja3sfvy0nn2719vnhhmii34xcdyc57q";
   };
 }
diff --git a/pkgs/development/libraries/webkitgtk/2.4.nix b/pkgs/development/libraries/webkitgtk/2.4.nix
index 1a17ae53313b..7b62de69123d 100644
--- a/pkgs/development/libraries/webkitgtk/2.4.nix
+++ b/pkgs/development/libraries/webkitgtk/2.4.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, fetchpatch, perl, python, ruby, bison, gperf, flex
-, pkgconfig, which, gettext, gobjectIntrospection
+, pkgconfig, which, gettext, gobjectIntrospection, pruneLibtoolFiles
 , gtk2, gtk3, wayland, libwebp, enchant, sqlite
 , libxml2, libsoup, libsecret, libxslt, harfbuzz, xorg
 , gst-plugins-base, libobjc
@@ -77,13 +77,16 @@ stdenv.mkDerivation rec {
     "--disable-credential-storage"
   ];
 
-  NIX_CFLAGS_COMPILE = "-DU_NOEXCEPT=";
+  NIX_CFLAGS_COMPILE = [
+    "-DU_NOEXCEPT="
+    "-Wno-expansion-to-defined"
+  ];
 
   dontAddDisableDepTrack = true;
 
   nativeBuildInputs = [
     perl python ruby bison gperf flex
-    pkgconfig which gettext gobjectIntrospection
+    pkgconfig which gettext gobjectIntrospection pruneLibtoolFiles
   ];
 
   buildInputs = [
diff --git a/pkgs/development/mobile/androidenv/androidndk.nix b/pkgs/development/mobile/androidenv/androidndk.nix
index b79741fca23d..dc693accbf4b 100644
--- a/pkgs/development/mobile/androidenv/androidndk.nix
+++ b/pkgs/development/mobile/androidenv/androidndk.nix
@@ -1,96 +1,110 @@
 { stdenv, fetchurl, zlib, ncurses5, unzip, lib, makeWrapper
 , coreutils, file, findutils, gawk, gnugrep, gnused, jdk, which
-, platformTools, python3, libcxx, version, sha256
+, platformTools, python3, libcxx, version, sha256, bash, runCommand
 , fullNDK ? false # set to true if you want other parts of the NDK
                   # that is not used by Nixpkgs like sources,
                   # examples, docs, or LLVM toolchains
 }:
 
-stdenv.mkDerivation rec {
-  name = "android-ndk-r${version}";
-  inherit version;
+let
+  makeStandaloneToolchain = api: arch: let
+      full_ndk = (ndk true);
+    in runCommand "makeStandaloneToolchain-${version}" {} ''
+      ${full_ndk}/libexec/${full_ndk.name}/build/tools/make_standalone_toolchain.py --api ${toString api} --arch ${arch} --install-dir $out
+    '';
+  ndk = fullNDK: stdenv.mkDerivation rec {
+    name = "android-ndk-r${version}";
+    inherit version;
 
-  src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl {
+    src = if stdenv.hostPlatform.system == "x86_64-linux" then fetchurl {
       url = "https://dl.google.com/android/repository/${name}-linux-x86_64.zip";
       inherit sha256;
     } else throw "platform ${stdenv.hostPlatform.system} not supported!";
 
-  phases = "buildPhase";
+    phases = "buildPhase";
 
-  nativeBuildInputs = [ unzip makeWrapper file ];
+    nativeBuildInputs = [ unzip makeWrapper file ];
 
-  buildCommand = let
-    bin_path = "$out/bin";
-    pkg_path = "$out/libexec/${name}";
-    sed_script_1 =
-      "'s|^PROGDIR=`dirname $0`" +
-      "|PROGDIR=`dirname $(readlink -f $(which $0))`|'";
-    runtime_paths = (lib.makeBinPath [
-      coreutils file findutils
-      gawk gnugrep gnused
-      jdk python3 which
-    ]) + ":${platformTools}/platform-tools";
-  in ''
-    mkdir -pv $out/libexec
-    cd $out/libexec
-    unzip -qq $src
+    buildCommand = let
+      bin_path = "$out/bin";
+      pkg_path = "$out/libexec/${name}";
+      sed_script_1 =
+        "'s|^PROGDIR=`dirname $0`" +
+        "|PROGDIR=`dirname $(readlink -f $(which $0))`|'";
+      runtime_paths = (lib.makeBinPath [
+        coreutils file findutils
+        gawk gnugrep gnused
+        jdk python3 which
+      ]) + ":${platformTools}/platform-tools";
+    in ''
+      mkdir -pv $out/libexec
+      cd $out/libexec
+      unzip -qq $src
 
-    patchShebangs ${pkg_path}
+      # so that it doesn't fail because of read-only permissions set
+      cd -
+      ${if (version == "10e") then
+          ''
+            patch -p1 \
+              --no-backup-if-mismatch \
+              -d $out/libexec/${name} < ${ ./make-standalone-toolchain_r10e.patch }
+          ''
+        else
+          ''
+            patch -p1 \
+              --no-backup-if-mismatch \
+              -d $out/libexec/${name} < ${ ./. + "/make_standalone_toolchain.py_" + "${version}" + ".patch" }
 
-    # so that it doesn't fail because of read-only permissions set
-    cd -
-    ${if (version == "10e") then
-        ''
-          patch -p1 \
-            --no-backup-if-mismatch \
-            -d $out/libexec/${name} < ${ ./make-standalone-toolchain_r10e.patch }
-        ''
-      else
-        ''
-          patch -p1 \
-            --no-backup-if-mismatch \
-            -d $out/libexec/${name} < ${ ./. + "/make_standalone_toolchain.py_${version}.patch" }
-          wrapProgram ${pkg_path}/build/tools/make_standalone_toolchain.py --prefix PATH : "${runtime_paths}"
-        ''
-    }
-    cd ${pkg_path}
+            sed -i 's,#!/usr/bin/env python,#!${python3}/bin/python,g' ${pkg_path}/build/tools/make_standalone_toolchain.py
+            sed -i 's,#!/bin/bash,#!${bash}/bin/bash,g' ${pkg_path}/build/tools/make_standalone_toolchain.py
+            wrapProgram ${pkg_path}/build/tools/make_standalone_toolchain.py --prefix PATH : "${runtime_paths}"
+          ''
+      }
 
-  '' + lib.optionalString (!fullNDK) ''
-    # Steps to reduce output size
-    rm -rf docs sources tests
-    # We only support cross compiling with gcc for now
-    rm -rf toolchains/*-clang* toolchains/llvm*
-  '' +
+      patchShebangs ${pkg_path}
 
-  ''
-    find ${pkg_path}/toolchains \( \
-        \( -type f -a -name "*.so*" \) -o \
-        \( -type f -a -perm -0100 \) \
-        \) -exec patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-*so.? \
-                          --set-rpath ${stdenv.lib.makeLibraryPath [ libcxx zlib ncurses5 ]} {} \;
-    # fix ineffective PROGDIR / MYNDKDIR determination
-    for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py"}
-    do
-        sed -i -e ${sed_script_1} $i
-    done
+      cd ${pkg_path}
 
-    # wrap
-    for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py ndk-which"}
-    do
-        wrapProgram "$(pwd)/$i" --prefix PATH : "${runtime_paths}"
-    done
-    # make some executables available in PATH
-    mkdir -pv ${bin_path}
-    for i in \
-        ndk-build ${lib.optionalString (version == "10e") "ndk-depends ndk-gdb ndk-gdb-py ndk-gdb.py ndk-stack ndk-which"}
-    do
-        ln -sf ${pkg_path}/$i ${bin_path}/$i
-    done
-  '';
+    '' + lib.optionalString (!fullNDK) ''
+      # Steps to reduce output size
+      rm -rf docs sources tests
+      # We only support cross compiling with gcc for now
+      rm -rf toolchains/*-clang* toolchains/llvm*
+    '' +
 
-  meta = {
-    platforms = stdenv.lib.platforms.linux;
-    hydraPlatforms = [];
-    license = stdenv.lib.licenses.asl20;
+    ''
+      find ${pkg_path}/toolchains \( \
+          \( -type f -a -name "*.so*" \) -o \
+          \( -type f -a -perm -0100 \) \
+          \) -exec patchelf --set-interpreter ${stdenv.cc.libc.out}/lib/ld-*so.? \
+                            --set-rpath ${stdenv.lib.makeLibraryPath [ libcxx zlib ncurses5 ]} {} \;
+      # fix ineffective PROGDIR / MYNDKDIR determination
+      for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py"}
+      do
+          sed -i -e ${sed_script_1} $i
+      done
+
+      # wrap
+      for i in ndk-build ${lib.optionalString (version == "10e") "ndk-gdb ndk-gdb-py ndk-which"}
+      do
+          wrapProgram "$(pwd)/$i" --prefix PATH : "${runtime_paths}"
+      done
+      # make some executables available in PATH
+      mkdir -pv ${bin_path}
+      for i in \
+          ndk-build ${lib.optionalString (version == "10e") "ndk-depends ndk-gdb ndk-gdb-py ndk-gdb.py ndk-stack ndk-which"}
+      do
+          ln -sf ${pkg_path}/$i ${bin_path}/$i
+      done
+    '';
+
+    meta = {
+      platforms = stdenv.lib.platforms.linux;
+      hydraPlatforms = [];
+      license = stdenv.lib.licenses.asl20;
+    };
+  };
+  passthru = {
+    inherit makeStandaloneToolchain;
   };
-}
+in lib.extendDerivation true passthru (ndk fullNDK)
diff --git a/pkgs/development/python-modules/confluent-kafka/default.nix b/pkgs/development/python-modules/confluent-kafka/default.nix
index 0638ea3a36d2..a0183e4595c4 100644
--- a/pkgs/development/python-modules/confluent-kafka/default.nix
+++ b/pkgs/development/python-modules/confluent-kafka/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPythonPackage, fetchPypi, isPy3k, rdkafka, requests, avro3k, avro}:
+{ stdenv, buildPythonPackage, fetchPypi, isPy3k, rdkafka, requests, avro3k, avro, futures}:
 
 buildPythonPackage rec {
   version = "0.11.5";
@@ -9,7 +9,7 @@ buildPythonPackage rec {
     sha256 = "bfb5807bfb5effd74f2cfe65e4e3e8564a9e72b25e099f655d8ad0d362a63b9f";
   };
 
-  buildInputs = [ rdkafka requests ] ++ (if isPy3k then [ avro3k ] else [ avro ]) ;
+  buildInputs = [ rdkafka requests ] ++ (if isPy3k then [ avro3k ] else [ avro futures ]) ;
 
   # Tests fail for python3 under this pypi release
   doCheck = if isPy3k then false else true;
diff --git a/pkgs/development/python-modules/cozy/default.nix b/pkgs/development/python-modules/cozy/default.nix
index 0feca2773b37..7515891456e9 100644
--- a/pkgs/development/python-modules/cozy/default.nix
+++ b/pkgs/development/python-modules/cozy/default.nix
@@ -1,4 +1,4 @@
-{ buildPythonPackage, fetchFromGitHub, lib,
+{ buildPythonPackage, isPy3k, fetchFromGitHub, lib,
   z3, ply, python-igraph, oset, ordered-set, dictionaries }:
 
 buildPythonPackage {
@@ -29,6 +29,8 @@ buildPythonPackage {
     $out/bin/cozy --help
   '';
 
+  disabled = !isPy3k;
+
   meta = {
     description = "The collection synthesizer";
     homepage = https://cozy.uwplse.org/;
diff --git a/pkgs/development/python-modules/django-raster/default.nix b/pkgs/development/python-modules/django-raster/default.nix
index 19ef783fe759..39634b8d293a 100644
--- a/pkgs/development/python-modules/django-raster/default.nix
+++ b/pkgs/development/python-modules/django-raster/default.nix
@@ -1,11 +1,13 @@
-{ stdenv, buildPythonPackage, fetchPypi,
+{ stdenv, buildPythonPackage, fetchPypi, isPy3k,
   numpy, django_colorful, pillow, psycopg2,
-  pyparsing, django, celery
+  pyparsing, django_2_1, celery, boto3
 }:
 buildPythonPackage rec {
   version = "0.6";
   pname = "django-raster";
 
+  disabled = !isPy3k;
+
   src = fetchPypi {
     inherit pname version;
     sha256 = "9a0f8e71ebeeeb5380c6ca68e027e9de335f43bc15e89dd22e7a470c4eb7aeb8";
@@ -15,7 +17,7 @@ buildPythonPackage rec {
   doCheck = false;
 
   propagatedBuildInputs = [ numpy django_colorful pillow psycopg2
-                            pyparsing django celery ];
+                            pyparsing django_2_1 celery boto3 ];
 
   meta = with stdenv.lib; {
     description = "Basic raster data integration for Django";
diff --git a/pkgs/development/python-modules/fiona/default.nix b/pkgs/development/python-modules/fiona/default.nix
index e6d347b440d3..0e6ab256d0d8 100644
--- a/pkgs/development/python-modules/fiona/default.nix
+++ b/pkgs/development/python-modules/fiona/default.nix
@@ -12,6 +12,8 @@ buildPythonPackage rec {
     sha256 = "a156129f0904cb7eb24aa0745b6075da54f2c31db168ed3bcac8a4bd716d77b2";
   };
 
+  CXXFLAGS = stdenv.lib.optionalString stdenv.cc.isClang "-std=c++11";
+
   buildInputs = [
     gdal
   ];
diff --git a/pkgs/development/python-modules/flask-ldap-login/default.nix b/pkgs/development/python-modules/flask-ldap-login/default.nix
index b95e694a232f..99b57dac816f 100644
--- a/pkgs/development/python-modules/flask-ldap-login/default.nix
+++ b/pkgs/development/python-modules/flask-ldap-login/default.nix
@@ -1,16 +1,27 @@
-{ stdenv, buildPythonPackage, fetchPypi
+{ stdenv, buildPythonPackage, isPy3k, fetchFromGitHub, fetchpatch
 , flask, flask_wtf, flask_testing, ldap
 , mock, nose }:
 
 buildPythonPackage rec {
   pname = "flask-ldap-login";
-  version = "0.3.0";
+  version = "0.3.4";
+  disabled = isPy3k;
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "085rik7q8xrp5g95346p6jcp9m2yr8kamwb2kbiw4q0b0fpnnlgq";
+  src = fetchFromGitHub {
+    owner = "ContinuumIO";
+    repo = "flask-ldap-login";
+    rev = version;
+    sha256 = "1l6zahqhwn5g9fmhlvjv80288b5h2fk5mssp7amdkw5ysk570wzp";
   };
 
+  patches = [
+    # Fix flask_wtf>=0.9.0 incompatibility. See https://github.com/ContinuumIO/flask-ldap-login/issues/41
+    (fetchpatch {
+      url = https://github.com/ContinuumIO/flask-ldap-login/commit/ed08c03c818dc63b97b01e2e7c56862eaa6daa43.patch;
+      sha256 = "19pkhbldk8jq6m10kdylvjf1c8m84fvvj04v5qda4cjyks15aq48";
+    })
+  ];
+
   checkInputs = [ nose mock flask_testing ];
   propagatedBuildInputs = [ flask flask_wtf ldap ];
 
diff --git a/pkgs/development/python-modules/genanki/default.nix b/pkgs/development/python-modules/genanki/default.nix
new file mode 100644
index 000000000000..bcc462e7237d
--- /dev/null
+++ b/pkgs/development/python-modules/genanki/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, buildPythonPackage, fetchPypi, isPy3k
+, cached-property, frozendict, pystache, pyyaml, pytest, pytestrunner
+}:
+
+buildPythonPackage rec {
+  pname = "genanki";
+  version = "0.6.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0xj8yd3acl8h457sh42balvcd0z4mg5idd4q63f7qlfzc5wgbb74";
+  };
+
+  propagatedBuildInputs = [
+		pytestrunner
+    cached-property
+    frozendict
+    pystache
+    pyyaml
+  ];
+
+  checkInputs = [ pytest ];
+
+  disabled = !isPy3k;
+
+  # relies on upstream anki
+	doCheck = false;
+  checkPhase = ''
+    py.test
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = http://github.com/kerrickstaley/genanki;
+    description = "Generate Anki decks programmatically";
+    license = licenses.mit;
+    maintainers = with maintainers; [ teto ];
+  };
+}
diff --git a/pkgs/development/python-modules/geopandas/default.nix b/pkgs/development/python-modules/geopandas/default.nix
index cab25a60f3b4..976df0952615 100644
--- a/pkgs/development/python-modules/geopandas/default.nix
+++ b/pkgs/development/python-modules/geopandas/default.nix
@@ -1,23 +1,23 @@
 { stdenv, buildPythonPackage, fetchFromGitHub
 , pandas, shapely, fiona, descartes, pyproj
-, pytest }:
+, pytest, Rtree }:
 
 buildPythonPackage rec {
   pname = "geopandas";
-  version = "0.3.0";
+  version = "0.4.0";
   name = pname + "-" + version;
 
   src = fetchFromGitHub {
     owner = "geopandas";
     repo = "geopandas";
     rev = "v${version}";
-    sha256 = "0maafafr7sjjmlg2f19bizg06c8a5z5igmbcgq6kgmi7rklx8xxz";
+    sha256 = "025zpgck5pnmidvzk0805pr345rd7k6z66qb2m34gjh1814xjkhv";
   };
 
-  checkInputs = [ pytest ];
+  checkInputs = [ pytest Rtree ];
 
   checkPhase = ''
-    py.test geopandas
+    py.test geopandas -m "not web"
   '';
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/joblib/default.nix b/pkgs/development/python-modules/joblib/default.nix
index 7164fd1197b8..91406c5331fb 100644
--- a/pkgs/development/python-modules/joblib/default.nix
+++ b/pkgs/development/python-modules/joblib/default.nix
@@ -18,7 +18,9 @@ buildPythonPackage rec {
   checkInputs = [ sphinx numpydoc pytest ];
 
   checkPhase = ''
-    py.test -k 'not test_disk_used and not test_nested_parallel_warnings' joblib/test
+    py.test -k 'not test_disk_used and \
+                not test_nested_parallel_warnings and \
+                not test_nested_parallelism_limit' joblib/test
   '';
 
   meta = {
diff --git a/pkgs/development/python-modules/jupyterlab_launcher/default.nix b/pkgs/development/python-modules/jupyterlab_launcher/default.nix
index 1831b47ee792..af29b9155a58 100644
--- a/pkgs/development/python-modules/jupyterlab_launcher/default.nix
+++ b/pkgs/development/python-modules/jupyterlab_launcher/default.nix
@@ -1,7 +1,8 @@
-{ lib, buildPythonPackage, fetchPypi, jsonschema, notebook }:
+{ lib, buildPythonPackage, fetchPypi, jsonschema, notebook, pythonOlder }:
 buildPythonPackage rec {
   pname = "jupyterlab_launcher";
   version = "0.13.1";
+  disabled = pythonOlder "3.5";
 
   src = fetchPypi {
     inherit pname version;
diff --git a/pkgs/development/python-modules/kubernetes/default.nix b/pkgs/development/python-modules/kubernetes/default.nix
index 030766eb6982..55d29729db83 100644
--- a/pkgs/development/python-modules/kubernetes/default.nix
+++ b/pkgs/development/python-modules/kubernetes/default.nix
@@ -1,5 +1,5 @@
 { stdenv, buildPythonPackage, fetchPypi, pythonAtLeast,
-  ipaddress, websocket_client, urllib3, pyyaml, requests_oauthlib, python-dateutil, google_auth,
+  ipaddress, websocket_client, urllib3, pyyaml, requests_oauthlib, python-dateutil, google_auth, adal,
   isort, pytest, coverage, mock, sphinx, autopep8, pep8, codecov, recommonmark, nose }:
 
 buildPythonPackage rec {
@@ -27,7 +27,7 @@ buildPythonPackage rec {
   };
 
   checkInputs = [ isort coverage pytest mock sphinx autopep8 pep8 codecov recommonmark nose ];
-  propagatedBuildInputs = [ ipaddress websocket_client urllib3 pyyaml requests_oauthlib python-dateutil google_auth ];
+  propagatedBuildInputs = [ ipaddress websocket_client urllib3 pyyaml requests_oauthlib python-dateutil google_auth adal ];
 
   meta = with stdenv.lib; {
     description = "Kubernetes python client";
diff --git a/pkgs/development/python-modules/libusb1/default.nix b/pkgs/development/python-modules/libusb1/default.nix
index 245ea90038ea..8a9b5da68ef9 100644
--- a/pkgs/development/python-modules/libusb1/default.nix
+++ b/pkgs/development/python-modules/libusb1/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, buildPythonPackage, fetchPypi, python, libusb1 }:
+{ stdenv, lib, buildPythonPackage, fetchPypi, python, libusb1, pytest }:
 
 buildPythonPackage rec {
   pname = "libusb1";
@@ -9,7 +9,7 @@ buildPythonPackage rec {
     sha256 = "a49917a2262cf7134396f6720c8be011f14aabfc5cdc53f880cc672c0f39d271";
   };
 
-  postPatch = lib.optionalString stdenv.isLinux ''
+  postPatch = ''
     substituteInPlace usb1/libusb1.py --replace \
       "ctypes.util.find_library(base_name)" \
       "'${libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}'"
@@ -17,8 +17,12 @@ buildPythonPackage rec {
 
   buildInputs = [ libusb1 ];
 
+  checkInputs = [ pytest ];
+
   checkPhase = ''
-    ${python.interpreter} -m usb1.testUSB1
+    # USBPollerThread is unreliable. Let's not test it.
+    # See: https://github.com/vpelletier/python-libusb1/issues/16
+    py.test -k 'not testUSBPollerThreadExit' usb1/testUSB1.py
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/locustio/default.nix b/pkgs/development/python-modules/locustio/default.nix
index c3e27c8b36a0..18875f840644 100644
--- a/pkgs/development/python-modules/locustio/default.nix
+++ b/pkgs/development/python-modules/locustio/default.nix
@@ -1,8 +1,8 @@
 { buildPythonPackage
-, fetchPypi
+, fetchFromGitHub
 , mock
 , unittest2
-, msgpack-python
+, msgpack
 , requests
 , flask
 , gevent
@@ -11,18 +11,16 @@
 
 buildPythonPackage rec {
   pname = "locustio";
-  version = "0.8.1";
+  version = "0.9.0";
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "64583987ba1c330bb071aee3e29d2eedbfb7c8b342fa064bfb74fafcff660d61";
+  src = fetchFromGitHub {
+    owner = "locustio";
+    repo = "locust";
+    rev = "${version}";
+    sha256 = "1645d63ig4ymw716b6h53bhmjqqc13p9r95k1xfx66ck6vdqnisd";
   };
 
-  patchPhase = ''
-    sed -i s/"pyzmq=="/"pyzmq>="/ setup.py
-  '';
-
-  propagatedBuildInputs = [ msgpack-python requests flask gevent pyzmq ];
+  propagatedBuildInputs = [ msgpack requests flask gevent pyzmq ];
   buildInputs = [ mock unittest2 ];
 
   meta = {
diff --git a/pkgs/development/python-modules/mahotas/default.nix b/pkgs/development/python-modules/mahotas/default.nix
new file mode 100644
index 000000000000..a7e92e0b5b8e
--- /dev/null
+++ b/pkgs/development/python-modules/mahotas/default.nix
@@ -0,0 +1,33 @@
+{ buildPythonPackage, fetchFromGitHub, nose, pillow, scipy, numpy, imread, stdenv }:
+
+buildPythonPackage rec {
+  pname = "mahotas";
+  version = "1.4.2";
+
+  src = fetchFromGitHub {
+    owner = "luispedro";
+    repo = "mahotas";
+    rev = "v${version}";
+    sha256 = "1d2hciag5sxw00qj7qz7lbna477ifzmpgl0cv3xqzjkhkn5m4d7r";
+  };
+
+  # remove this as soon as https://github.com/luispedro/mahotas/issues/97 is fixed
+  patches = [ ./disable-impure-tests.patch ];
+
+  propagatedBuildInputs = [ numpy imread pillow scipy ];
+  checkInputs = [ nose ];
+
+  checkPhase= ''
+    python setup.py test
+  '';
+
+  disabled = stdenv.isi686; # Failing tests
+
+  meta = with stdenv.lib; {
+    description = "Computer vision package based on numpy";
+    homepage = http://mahotas.readthedocs.io/;
+    maintainers = with maintainers; [ luispedro ];
+    license = licenses.mit;
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/development/python-modules/mahotas/disable-impure-tests.patch b/pkgs/development/python-modules/mahotas/disable-impure-tests.patch
new file mode 100644
index 000000000000..a61503f9522e
--- /dev/null
+++ b/pkgs/development/python-modules/mahotas/disable-impure-tests.patch
@@ -0,0 +1,34 @@
+diff --git a/mahotas/tests/test_colors.py b/mahotas/tests/test_colors.py
+index 8a8183b..0d34c9f 100644
+--- a/mahotas/tests/test_colors.py
++++ b/mahotas/tests/test_colors.py
+@@ -2,7 +2,9 @@ import mahotas
+ import numpy as np
+ from mahotas.tests.utils import luispedro_jpg
+ from mahotas.colors import rgb2xyz, rgb2lab, xyz2rgb, rgb2grey, rgb2sepia
++from nose.tools import nottest
+ 
++@nottest
+ def test_colors():
+     f = luispedro_jpg()
+     lab = rgb2lab(f)
+diff --git a/mahotas/tests/test_features_shape.py b/mahotas/tests/test_features_shape.py
+index 462f467..2381793 100644
+--- a/mahotas/tests/test_features_shape.py
++++ b/mahotas/tests/test_features_shape.py
+@@ -2,6 +2,7 @@ import mahotas.features.shape
+ import numpy as np
+ import mahotas as mh
+ from mahotas.features.shape import roundness, eccentricity
++from nose.tools import nottest
+ 
+ def test_eccentricity():
+     D = mh.disk(32, 2)
+@@ -29,6 +30,7 @@ def test_zeros():
+     I[8:4:12] = 1
+     assert eccentricity(I) == 0
+ 
++@nottest
+ def test_ellipse_axes():
+     Y,X = np.mgrid[:1024,:1024]
+     Y = Y/1024.
diff --git a/pkgs/development/python-modules/markerlib/default.nix b/pkgs/development/python-modules/markerlib/default.nix
new file mode 100644
index 000000000000..640b11a6f280
--- /dev/null
+++ b/pkgs/development/python-modules/markerlib/default.nix
@@ -0,0 +1,30 @@
+{ stdenv
+, buildPythonPackage
+, fetchPypi
+, setuptools
+, nose
+}:
+
+buildPythonPackage rec {
+  version = "0.6.0";
+  pname = "markerlib";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "2fdb3939441f5bf4f090b1979a34f84a11d33eed6c0e3995de88ae5c06b6e3ae";
+  };
+
+  buildInputs = [ setuptools ];
+  checkInputs = [ nose ];
+
+  checkPhase = ''
+    nosetests
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://bitbucket.org/dholth/markerlib/;
+    description = "A compiler for PEP 345 environment markers";
+    license = licenses.mit;
+    maintainers = [ maintainers.costrouc ];
+  };
+}
diff --git a/pkgs/development/python-modules/ncclient/default.nix b/pkgs/development/python-modules/ncclient/default.nix
index 9dc7710ff28f..9933e849d0be 100644
--- a/pkgs/development/python-modules/ncclient/default.nix
+++ b/pkgs/development/python-modules/ncclient/default.nix
@@ -2,6 +2,7 @@
 , buildPythonPackage
 , fetchPypi
 , paramiko
+, selectors2
 , lxml
 , libxml2
 , libxslt
@@ -21,7 +22,7 @@ buildPythonPackage rec {
   checkInputs = [ nose rednose ];
 
   propagatedBuildInputs = [
-    paramiko lxml libxml2 libxslt
+    paramiko lxml libxml2 libxslt selectors2
   ];
 
   checkPhase = ''
diff --git a/pkgs/development/python-modules/ordered-set/default.nix b/pkgs/development/python-modules/ordered-set/default.nix
index bf20f7827be3..4044ad3f2fd1 100644
--- a/pkgs/development/python-modules/ordered-set/default.nix
+++ b/pkgs/development/python-modules/ordered-set/default.nix
@@ -1,10 +1,10 @@
-{ buildPythonPackage, fetchPypi, lib, pytest }:
+{ buildPythonPackage, fetchPypi, lib, pytest, pytestrunner }:
 
 buildPythonPackage rec {
   pname = "ordered-set";
   version = "3.0.1";
 
-  buildInputs = [ pytest ];
+  buildInputs = [ pytest pytestrunner ];
 
   src = fetchPypi {
     inherit pname version;
@@ -21,6 +21,3 @@ buildPythonPackage rec {
     maintainers = [ lib.maintainers.MostAwesomeDude ];
   };
 }
-
-
-
diff --git a/pkgs/development/python-modules/persistent/default.nix b/pkgs/development/python-modules/persistent/default.nix
index 542a68728af1..721385f3ed6a 100644
--- a/pkgs/development/python-modules/persistent/default.nix
+++ b/pkgs/development/python-modules/persistent/default.nix
@@ -1,12 +1,14 @@
 { buildPythonPackage
 , fetchPypi
 , zope_interface
+, sphinx, manuel
 }:
 
 buildPythonPackage rec {
   pname = "persistent";
   version = "4.4.2";
 
+  nativeBuildInputs = [ sphinx manuel ];
   propagatedBuildInputs = [ zope_interface ];
 
   src = fetchPypi {
diff --git a/pkgs/development/python-modules/phonopy/default.nix b/pkgs/development/python-modules/phonopy/default.nix
index cf15ccc18fce..903b2b90c300 100644
--- a/pkgs/development/python-modules/phonopy/default.nix
+++ b/pkgs/development/python-modules/phonopy/default.nix
@@ -10,9 +10,12 @@ buildPythonPackage rec {
   };
 
   propagatedBuildInputs = [ numpy pyyaml matplotlib h5py ];
-  
+
   checkPhase = ''
-    cd test/phonopy
+    cd test
+    # dynamic structure factor test ocassionally fails do to roundoff
+    # see issue https://github.com/atztogo/phonopy/issues/79
+    rm spectrum/test_dynamic_structure_factor.py
     ${python.interpreter} -m unittest discover -b
     cd ../..
   '';
@@ -24,4 +27,3 @@ buildPythonPackage rec {
     maintainers = with maintainers; [ psyanticy ];
   };
 }
-
diff --git a/pkgs/development/python-modules/pycaption/default.nix b/pkgs/development/python-modules/pycaption/default.nix
index d4ed6088409b..468011e2a807 100644
--- a/pkgs/development/python-modules/pycaption/default.nix
+++ b/pkgs/development/python-modules/pycaption/default.nix
@@ -17,7 +17,7 @@ buildPythonPackage rec {
   prePatch = ''
     substituteInPlace setup.py \
       --replace 'beautifulsoup4>=4.2.1,<4.5.0' \
-                'beautifulsoup4>=4.2.1,<=4.6.0'
+                'beautifulsoup4>=4.2.1,<=4.6.3'
   '';
 
   # don't require enum34 on python >= 3.4
diff --git a/pkgs/development/python-modules/pyslurm/default.nix b/pkgs/development/python-modules/pyslurm/default.nix
index 9057c3970e15..f004ab1054dd 100644
--- a/pkgs/development/python-modules/pyslurm/default.nix
+++ b/pkgs/development/python-modules/pyslurm/default.nix
@@ -2,13 +2,13 @@
 
 buildPythonPackage rec {
   pname = "pyslurm";
-  version = "20180604";
+  version = "20180908";
 
   src = fetchFromGitHub {
     repo = "pyslurm";
     owner = "PySlurm";
-    rev = "9dd4817e785fee138a9e29c3d71d2ea44898eedc";
-    sha256 = "14ivwc27sjnk0z0jpfgyy9bd91m2bhcz11lzp1kk9xn4495i7wvj";
+    rev = "50dc113e99d82e70e84fc2e812333733708be4ed";
+    sha256 = "1j2i4rvhmk2ihhcvsjdlqlxqb5a05jg8k9bqkv3zrvdj71yn4z9k";
   };
 
   buildInputs = [ cython slurm ];
diff --git a/pkgs/development/python-modules/selectors2/default.nix b/pkgs/development/python-modules/selectors2/default.nix
new file mode 100644
index 000000000000..030178fef830
--- /dev/null
+++ b/pkgs/development/python-modules/selectors2/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, buildPythonPackage, fetchPypi
+, nose, psutil, mock }:
+
+buildPythonPackage rec {
+  version = "2.0.1";
+  pname = "selectors2";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "81b77c4c6f607248b1d6bbdb5935403fef294b224b842a830bbfabb400c81884";
+  };
+
+  checkInputs = [ nose psutil mock ];
+
+  checkPhase = ''
+    # https://github.com/NixOS/nixpkgs/pull/46186#issuecomment-419450064
+    # Trick to disable certain tests that depend on timing which
+    # will always fail on hydra
+    export TRAVIS=""
+    nosetests tests/test_selectors2.py
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://www.github.com/SethMichaelLarson/selectors2;
+    description = "Back-ported, durable, and portable selectors";
+    license = licenses.mit;
+    maintainers = [ maintainers.costrouc ];
+  };
+}
diff --git a/pkgs/development/python-modules/sniffio/default.nix b/pkgs/development/python-modules/sniffio/default.nix
new file mode 100644
index 000000000000..9893bc5828a0
--- /dev/null
+++ b/pkgs/development/python-modules/sniffio/default.nix
@@ -0,0 +1,30 @@
+{ buildPythonPackage, lib, fetchPypi, glibcLocales, isPy3k, contextvars
+, pythonOlder
+}:
+
+buildPythonPackage rec {
+  pname = "sniffio";
+  version = "1.0.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1dzb0nx3m1hpjgsv6s6w5ac2jcmywcz6gqnfkw8rwz1vkr1836rf";
+  };
+
+  # breaks with the following error:
+  # > TypeError: 'encoding' is an invalid keyword argument for this function
+  disabled = !isPy3k;
+
+  buildInputs = [ glibcLocales ];
+
+  propagatedBuildInputs = lib.optionals (pythonOlder "3.7") [ contextvars ];
+
+  # no tests distributed with PyPI
+  doCheck = false;
+
+  meta = with lib; {
+    homepage = https://github.com/python-trio/sniffio;
+    license = licenses.asl20;
+    description = "Sniff out which async library your code is running under";
+  };
+}
diff --git a/pkgs/development/python-modules/spacy/models.json b/pkgs/development/python-modules/spacy/models.json
index e9c163c65259..34b8082872b7 100644
--- a/pkgs/development/python-modules/spacy/models.json
+++ b/pkgs/development/python-modules/spacy/models.json
@@ -1,42 +1,78 @@
 [{
-  "pname": "es_core_web_md",
-  "version": "1.0.0",
-  "sha256": "0ikyakdhnj6rrfpr8k83695d1gd3z9n60a245hwwchv94jmr7r6s",
+  "pname": "de_core_news_sm",
+  "version": "2.0.0",
+  "sha256": "13fs4f46qg9mlxd9ynmh81gxizm11kfq3g52pk8d2m7wp89xfc6a",
   "license": "cc-by-sa-40"
 },
 {
-  "pname": "fr_depvec_web_lg",
-  "version": "1.0.0",
-  "sha256": "0nxmdszs1s5by2874cz37azrmwamh1ngdsiylffkfihzq6s8bhka",
-  "license": "cc-by-nc-sa-40"
+  "pname": "en_core_web_lg",
+  "version": "2.0.0",
+  "sha256": "1r33l02jrkzjn78nd0bzzzd6rwjlz7qfgs3bg5yr2ki6q0m7qxvw",
+  "license": "cc-by-sa-40"
 },
 {
   "pname": "en_core_web_md",
-  "version": "1.2.1",
-  "sha256": "12prr4hcbfdaky9rcna1y1ykr417jkhkks2r8l06g8fb7am3pvp3",
+  "version": "2.0.0",
+  "sha256": "1b5g5gma1gzm8ffj0pgli1pllccx5jpjvb7a19n7c8bfswpifxzc",
   "license": "cc-by-sa-40"
 },
 {
-  "pname": "en_depent_web_md",
-  "version": "1.2.1",
-  "sha256": "0giyr35q5lpp5drpcamyvb5gsjnhj62mk3ndfr49nm1s6d5f6m52",
+  "pname": "en_core_web_sm",
+  "version": "2.0.0",
+  "sha256": "161298pl6kzc0cgf2g7ji84xbqv8ayrgsrmmg0hxiflwghfj77cx",
   "license": "cc-by-sa-40"
 },
 {
-  "pname": "en_core_web_sm",
-  "version": "1.2.0",
-  "sha256": "0vc4l77dcwa9lmzyqdci8ikjc0m2rhasl2zvyba547vf76qb0528",
+  "pname": "en_vectors_web_lg",
+  "version": "2.0.0",
+  "sha256": "15qfd8vzdv56x41fzghy7k5x1c8ql92ds70r37b6a8hkb87z9byw",
+  "license": "cc-by-sa-40"
+},
+{
+  "pname": "es_core_news_md",
+  "version": "2.0.0",
+  "sha256": "03056qz866r641q4nagymw6pc78qnn5vdvcp7p1ph2cvxh7081kp",
+  "license": "cc-by-sa-40"
+},
+{
+  "pname": "es_core_news_sm",
+  "version": "2.0.0",
+  "sha256": "1b91lcmw2kyqmcrxlfq7m5vlj1a57i3bb9a5h4y31smjgzmsr81s",
+  "license": "cc-by-sa-40"
+},
+{
+  "pname": "fr_core_news_md",
+  "version": "2.0.0",
+  "sha256": "06kva46l1nw819bidzj2vks69ap1a9fa7rnvpd28l3z2haci38ls",
+  "license": "cc-by-sa-40"
+},
+{
+  "pname": "fr_core_news_sm",
+  "version": "2.0.0",
+  "sha256": "1zlhm9646g3cwcv4cs33160f3v8gxmzdr02x8hx7jpw1fbnmc5mx",
+  "license": "cc-by-sa-40"
+},
+{
+  "pname": "it_core_news_sm",
+  "version": "2.0.0",
+  "sha256": "0fs68rdq19migb3x3hb510b96aabibsi01adlk1fipll1x48msaz",
+  "license": "cc-by-sa-40"
+},
+{
+  "pname": "nl_core_news_sm",
+  "version": "2.0.0",
+  "sha256": "0n5x61jp8rdxa3ki250ipbd68rjpp9li6xwbx3fbzycpngffwy8z",
   "license": "cc-by-sa-40"
 },
 {
-  "pname": "de_core_news_md",
-  "version": "1.0.0",
-  "sha256": "072jz2rdi1nckny7k16avp86vjg4didfdsw816kfl9zwr88iny6g",
+  "pname": "pt_core_news_sm",
+  "version": "2.0.0",
+  "sha256": "1sg500b3f3qnx1ga32hbq9p4qfynqhpdzhlmdjrxgqw8i58ys23g",
   "license": "cc-by-sa-40"
 },
 {
-  "pname": "en_vectors_glove_md",
-  "version": "1.0.0",
-  "sha256": "1jbr27xnh5fdww8yphpvk2brfnzb174wfnxkzdqwv3iyi02zsin6",
+  "pname": "xx_ent_wiki_sm",
+  "version": "2.0.0",
+  "sha256": "0mc3mm6nfjp31wbjysdj2x72akyi52hgprm1g54djxfypm3pmn35",
   "license": "cc-by-sa-40"
 }]
diff --git a/pkgs/development/python-modules/tifffile/default.nix b/pkgs/development/python-modules/tifffile/default.nix
index 159051b9a6a8..3910ddf07256 100644
--- a/pkgs/development/python-modules/tifffile/default.nix
+++ b/pkgs/development/python-modules/tifffile/default.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, fetchPypi, buildPythonPackage, isPy27, pythonOlder
-, numpy, nose, enum34, futures }:
+, numpy, nose, enum34, futures, pathlib }:
 
 buildPythonPackage rec {
   pname = "tifffile";
@@ -16,7 +16,7 @@ buildPythonPackage rec {
   '';
 
   propagatedBuildInputs = [ numpy ]
-    ++ lib.optional isPy27 futures
+    ++ lib.optional isPy27 [ futures pathlib ]
     ++ lib.optional (pythonOlder "3.0") enum34;
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/trio/default.nix b/pkgs/development/python-modules/trio/default.nix
index 4924fa527c62..89addb377dc4 100644
--- a/pkgs/development/python-modules/trio/default.nix
+++ b/pkgs/development/python-modules/trio/default.nix
@@ -8,6 +8,7 @@
 , pytest
 , pyopenssl
 , trustme
+, sniffio
 }:
 
 buildPythonPackage rec {
@@ -31,6 +32,7 @@ buildPythonPackage rec {
     async_generator
     idna
     outcome
+    sniffio
   ] ++ lib.optionals (pythonOlder "3.7") [ contextvars ];
 
   meta = {
diff --git a/pkgs/development/python-modules/urlgrabber/default.nix b/pkgs/development/python-modules/urlgrabber/default.nix
index f399f4d426ee..528846d72381 100644
--- a/pkgs/development/python-modules/urlgrabber/default.nix
+++ b/pkgs/development/python-modules/urlgrabber/default.nix
@@ -15,7 +15,7 @@ buildPythonPackage rec {
   propagatedBuildInputs = [ pycurl ];
 
   meta = with stdenv.lib; {
-    homepage = "urlgrabber.baseurl.org";
+    homepage = http://urlgrabber.baseurl.org;
     license = licenses.lgpl2Plus;
     description = "Python module for downloading files";
     maintainers = with maintainers; [ qknight ];
diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix
index 9bbab76d4a2f..a2c586c06a96 100644
--- a/pkgs/development/r-modules/default.nix
+++ b/pkgs/development/r-modules/default.nix
@@ -906,6 +906,14 @@ let
       TCLLIBPATH = "${pkgs.bwidget}/lib/bwidget${pkgs.bwidget.version}";
     });
 
+    RPostgres = old.RPostgres.overrideDerivation (attrs: {
+      preConfigure = ''
+        export INCLUDE_DIR=${pkgs.postgresql}/include
+        export LIB_DIR=${pkgs.postgresql.lib}/lib
+        patchShebangs configure
+        '';
+    });
+
     OpenMx = old.OpenMx.overrideDerivation (attrs: {
       preConfigure = ''
         patchShebangs configure
diff --git a/pkgs/development/tools/analysis/pmd/default.nix b/pkgs/development/tools/analysis/pmd/default.nix
index 78dd57789622..187b2d7b03f9 100644
--- a/pkgs/development/tools/analysis/pmd/default.nix
+++ b/pkgs/development/tools/analysis/pmd/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "pmd-${version}";
-  version = "6.5.0";
+  version = "6.7.0";
 
   buildInputs = [ unzip ];
 
   src = fetchurl {
     url = "mirror://sourceforge/pmd/pmd-bin-${version}.zip";
-    sha256 = "10jdgps1ikx75ljp2gi76ff7payg28pmiy5y3vp17gg47mv991aw";
+    sha256 = "0bnbr8zq28dgvwka563g5lbya5jhmjrahnbwagcs4afpsrm7zj6c";
   };
 
   installPhase = ''
diff --git a/pkgs/development/tools/build-managers/bazel/default.nix b/pkgs/development/tools/build-managers/bazel/default.nix
index 6a25aef8b36a..49d6abdc0098 100644
--- a/pkgs/development/tools/build-managers/bazel/default.nix
+++ b/pkgs/development/tools/build-managers/bazel/default.nix
@@ -1,11 +1,13 @@
 { stdenv, lib, fetchurl, fetchpatch, runCommand, makeWrapper
 , jdk, zip, unzip, bash, writeCBin, coreutils
 , which, python, perl, gnused, gnugrep, findutils
+# Apple dependencies
+, cctools, clang, libcxx, CoreFoundation, CoreServices, Foundation
+# Allow to independently override the jdks used to build and run respectively
+, buildJdk ? jdk, runJdk ? jdk
 # Always assume all markers valid (don't redownload dependencies).
 # Also, don't clean up environment variables.
 , enableNixHacks ? false
-# Apple dependencies
-, cctools, clang, libcxx, CoreFoundation, CoreServices, Foundation
 }:
 
 let
@@ -152,7 +154,7 @@ stdenv.mkDerivation rec {
      + genericPatches;
 
   buildInputs = [
-    jdk
+    buildJdk
   ];
 
   nativeBuildInputs = [
@@ -190,7 +192,7 @@ stdenv.mkDerivation rec {
   installPhase = ''
     mkdir -p $out/bin
     mv output/bazel $out/bin
-    wrapProgram "$out/bin/bazel" --set JAVA_HOME "${jdk}"
+    wrapProgram "$out/bin/bazel" --set JAVA_HOME "${runJdk}"
     mkdir -p $out/share/bash-completion/completions $out/share/zsh/site-functions
     mv output/bazel-complete.bash $out/share/bash-completion/completions/bazel
     cp scripts/zsh_completion/_bazel $out/share/zsh/site-functions/
diff --git a/pkgs/development/tools/build-managers/bear/default.nix b/pkgs/development/tools/build-managers/bear/default.nix
index fb12b5a9c14a..51e8d12d3147 100644
--- a/pkgs/development/tools/build-managers/bear/default.nix
+++ b/pkgs/development/tools/build-managers/bear/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "bear-${version}";
-  version = "2.3.12";
+  version = "2.3.13";
 
   src = fetchFromGitHub {
     owner = "rizsotto";
     repo = "Bear";
     rev = version;
-    sha256 = "1zzz2yiiny9pm4h6ayb82xzxc2j5djcpf8va2wagcw92m7w6miqw";
+    sha256 = "0imvvs22gyr1v6ydgp5yn2nq8fb8llmz0ra1m733ikjaczl3jm7z";
   };
 
   nativeBuildInputs = [ cmake ];
diff --git a/pkgs/development/tools/castxml/default.nix b/pkgs/development/tools/castxml/default.nix
index 603b155ee4f9..aea94633bae3 100644
--- a/pkgs/development/tools/castxml/default.nix
+++ b/pkgs/development/tools/castxml/default.nix
@@ -17,6 +17,11 @@ stdenv.mkDerivation rec {
     sha256 = "1hjh8ihjyp1m2jb5yypp5c45bpbz8k004f4p1cjw4gc7pxhjacdj";
   };
 
+  cmakeFlags = [
+    "-DCLANG_RESOURCE_DIR=${llvmPackages.clang-unwrapped}"
+    "-DSPHINX_MAN=${if withMan then "ON" else "OFF"}"
+  ];
+
   buildInputs = [
     cmake
     llvmPackages.clang-unwrapped
@@ -25,11 +30,6 @@ stdenv.mkDerivation rec {
 
   propagatedbuildInputs = [ llvmPackages.libclang ];
 
-  preConfigure = ''
-    cmakeFlagsArray+=(
-     ${if withMan then "-DSPHINX_MAN=ON" else ""}
-  )'';
-
   # 97% tests passed, 96 tests failed out of 2866
   # mostly because it checks command line and nix append -isystem and all
   doCheck=false;
diff --git a/pkgs/development/tools/govendor/default.nix b/pkgs/development/tools/govendor/default.nix
new file mode 100644
index 000000000000..2030c8ba444a
--- /dev/null
+++ b/pkgs/development/tools/govendor/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, buildGoPackage, fetchFromGitHub }:
+
+buildGoPackage rec {
+  name = "govendor-${version}";
+  version = "1.0.9";
+
+  goPackagePath = "github.com/kardianos/govendor";
+
+  src = fetchFromGitHub {
+    owner = "kardianos";
+    repo = "govendor";
+    rev = "v${version}";
+    sha256 = "0g02cd25chyijg0rzab4xr627pkvk5k33mscd6r0gf1v5xvadcfq";
+  };
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/kardianos/govendor";
+    description = "Go vendor tool that works with the standard vendor file";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ zimbatm ];
+  };
+}
diff --git a/pkgs/development/tools/hcloud/default.nix b/pkgs/development/tools/hcloud/default.nix
index 877080508d40..b3fa6f852f76 100644
--- a/pkgs/development/tools/hcloud/default.nix
+++ b/pkgs/development/tools/hcloud/default.nix
@@ -14,6 +14,19 @@ buildGoPackage rec {
 
   buildFlagsArray = [ "-ldflags=" "-w -X github.com/hetznercloud/cli/cli.Version=${version}" ];
 
+  postInstall = ''
+    mkdir -p \
+      $bin/etc/bash_completion.d \
+      $bin/share/zsh/vendor-completions
+
+    # Add bash completions
+    $bin/bin/hcloud completion bash > "$bin/etc/bash_completion.d/hcloud"
+
+    # Add zsh completions
+    echo "#compdef hcloud" > "$bin/share/zsh/vendor-completions/_hcloud"
+    $bin/bin/hcloud completion zsh >> "$bin/share/zsh/vendor-completions/_hcloud"
+  '';
+
   meta = {
     description = "A command-line interface for Hetzner Cloud, a provider for cloud virtual private servers";
     homepage = https://github.com/hetznercloud/cli;
diff --git a/pkgs/development/tools/jbake/default.nix b/pkgs/development/tools/jbake/default.nix
index 152cddc101d6..9c3094fb4fec 100644
--- a/pkgs/development/tools/jbake/default.nix
+++ b/pkgs/development/tools/jbake/default.nix
@@ -11,6 +11,8 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ makeWrapper jre ];
 
+  postPatch = "patchShebangs .";
+
   installPhase = ''
     mkdir -p $out
     cp -vr * $out
diff --git a/pkgs/development/tools/misc/kconfig-frontends/default.nix b/pkgs/development/tools/misc/kconfig-frontends/default.nix
index d1415569ca33..bceb15f11659 100644
--- a/pkgs/development/tools/misc/kconfig-frontends/default.nix
+++ b/pkgs/development/tools/misc/kconfig-frontends/default.nix
@@ -1,24 +1,26 @@
-{ stdenv, fetchurl, pkgconfig, bison, flex, gperf, ncurses }:
+{ stdenv, fetchurl, pkgconfig, bison, flex, gperf, ncurses, pythonPackages }:
 
 stdenv.mkDerivation rec {
   basename = "kconfig-frontends";
-  version = "3.12.0.0";
+  version = "4.11.0.1";
   name = "${basename}-${version}";
 
   src = fetchurl {
-    sha256 = "01zlph9bq2xzznlpmfpn0zrmhf2iqw02yh1q7g7adgkl5jk1a9pa";
+    sha256 = "1xircdw3k7aaz29snf96q2fby1cs48bidz5l1kkj0a5gbivw31i3";
     url = "http://ymorin.is-a-geek.org/download/${basename}/${name}.tar.xz";
   };
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ bison flex gperf ncurses ];
-
-  hardeningDisable = [ "format" ];
+  buildInputs = [ bison flex gperf ncurses pythonPackages.python pythonPackages.wrapPython ];
 
   configureFlags = [
     "--enable-frontends=conf,mconf,nconf"
   ];
 
+  postInstall = ''
+    wrapPythonPrograms
+  '';
+
   meta = with stdenv.lib; {
     description = "Out of Linux tree packaging of the kconfig infrastructure";
     longDescription = ''
diff --git a/pkgs/development/tools/misc/lttng-ust/default.nix b/pkgs/development/tools/misc/lttng-ust/default.nix
index b708ce490d29..039e5b1ec542 100644
--- a/pkgs/development/tools/misc/lttng-ust/default.nix
+++ b/pkgs/development/tools/misc/lttng-ust/default.nix
@@ -13,11 +13,11 @@
 
 stdenv.mkDerivation rec {
   name = "lttng-ust-${version}";
-  version = "2.10.1";
+  version = "2.10.2";
 
   src = fetchurl {
     url = "https://lttng.org/files/lttng-ust/${name}.tar.bz2";
-    sha256 = "17gfi1dn6bgg59qn4ihf8hag96lalx0g7dym2ccpzdz7f45krk07";
+    sha256 = "0if0hrs32r98sp85c8c63zpgy5xjw6cx8wrs65xq227b0jwj5jn4";
   };
 
   buildInputs = [ python ];
diff --git a/pkgs/development/tools/ocaml/opam/1.2.2.nix b/pkgs/development/tools/ocaml/opam/1.2.2.nix
new file mode 100644
index 000000000000..7e84719ae47d
--- /dev/null
+++ b/pkgs/development/tools/ocaml/opam/1.2.2.nix
@@ -0,0 +1,92 @@
+{ stdenv, lib, fetchurl, makeWrapper,
+  ocaml, unzip, ncurses, curl, aspcud
+}:
+
+assert lib.versionAtLeast ocaml.version "3.12.1";
+
+let
+  srcs = {
+    cudf = fetchurl {
+      url = "https://gforge.inria.fr/frs/download.php/file/33593/cudf-0.7.tar.gz";
+      sha256 = "92c8a9ed730bbac73f3513abab41127d966c9b9202ab2aaffcd02358c030a701";
+    };
+    extlib = fetchurl {
+      url = "http://ocaml-extlib.googlecode.com/files/extlib-1.5.3.tar.gz";
+      sha256 = "c095eef4202a8614ff1474d4c08c50c32d6ca82d1015387785cf03d5913ec021";
+    };
+    ocaml_re = fetchurl {
+      url = "https://github.com/ocaml/ocaml-re/archive/ocaml-re-1.2.0.tar.gz";
+      sha256 = "a34dd9d6136731436a963bbab5c4bbb16e5d4e21b3b851d34887a3dec451999f";
+    };
+    ocamlgraph = fetchurl {
+      url = "http://ocamlgraph.lri.fr/download/ocamlgraph-1.8.5.tar.gz";
+      sha256 = "d167466435a155c779d5ec25b2db83ad851feb42ebc37dca8ffa345ddaefb82f";
+    };
+    dose3 = fetchurl {
+      url = "https://gforge.inria.fr/frs/download.php/file/34277/dose3-3.3.tar.gz";
+      sha256 = "8dc4dae9b1a81bb3a42abb283df785ba3eb00ade29b13875821c69f03e00680e";
+    };
+    cmdliner = fetchurl {
+      url = "http://erratique.ch/software/cmdliner/releases/cmdliner-0.9.7.tbz";
+      sha256 = "9c19893cffb5d3c3469ee0cce85e3eeeba17d309b33b9ace31aba06f68f0bf7a";
+    };
+    uutf = fetchurl {
+      url = "http://erratique.ch/software/uutf/releases/uutf-0.9.3.tbz";
+      sha256 = "1f364f89b1179e5182a4d3ad8975f57389d45548735d19054845e06a27107877";
+    };
+    jsonm = fetchurl {
+      url = "http://erratique.ch/software/jsonm/releases/jsonm-0.9.1.tbz";
+      sha256 = "3fd4dca045d82332da847e65e981d8b504883571d299a3f7e71447d46bc65f73";
+    };
+    opam = fetchurl {
+      url = "https://github.com/ocaml/opam/archive/1.2.2.zip";
+      sha256 = "c590ce55ae69ec74f46215cf16a156a02b23c5f3ecb22f23a3ad9ba3d91ddb6e";
+    };
+  };
+in stdenv.mkDerivation rec {
+  name = "opam-${version}";
+  version = "1.2.2";
+
+  buildInputs = [ unzip curl ncurses ocaml makeWrapper ];
+
+  src = srcs.opam;
+
+  postUnpack = ''
+    ln -sv ${srcs.cudf} $sourceRoot/src_ext/${srcs.cudf.name}
+    ln -sv ${srcs.extlib} $sourceRoot/src_ext/${srcs.extlib.name}
+    ln -sv ${srcs.ocaml_re} $sourceRoot/src_ext/${srcs.ocaml_re.name}
+    ln -sv ${srcs.ocamlgraph} $sourceRoot/src_ext/${srcs.ocamlgraph.name}
+    ln -sv ${srcs.dose3} $sourceRoot/src_ext/${srcs.dose3.name}
+    ln -sv ${srcs.cmdliner} $sourceRoot/src_ext/${srcs.cmdliner.name}
+    ln -sv ${srcs.uutf} $sourceRoot/src_ext/${srcs.uutf.name}
+    ln -sv ${srcs.jsonm} $sourceRoot/src_ext/${srcs.jsonm.name}
+  '';
+
+  preConfigure = ''
+    substituteInPlace ./src_ext/Makefile --replace "%.stamp: %.download" "%.stamp:"
+  '';
+
+  postConfigure = "make lib-ext";
+
+  # Dirty, but apparently ocp-build requires a TERM
+  makeFlags = ["TERM=screen"];
+
+  # change argv0 to "opam" as a workaround for
+  # https://github.com/ocaml/opam/issues/2142
+  postInstall = ''
+    mv $out/bin/opam $out/bin/.opam-wrapped
+    makeWrapper $out/bin/.opam-wrapped $out/bin/opam \
+      --argv0 "opam" \
+      --suffix PATH : ${aspcud}/bin:${unzip}/bin:${curl}/bin
+  '';
+
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "A package manager for OCaml";
+    homepage = http://opam.ocamlpro.com/;
+    maintainers = [ maintainers.henrytill ];
+    platforms = platforms.all;
+    license = licenses.lgpl21Plus;
+  };
+}
diff --git a/pkgs/development/tools/ocaml/opam/default.nix b/pkgs/development/tools/ocaml/opam/default.nix
index 7e84719ae47d..8e89dd3fadd2 100644
--- a/pkgs/development/tools/ocaml/opam/default.nix
+++ b/pkgs/development/tools/ocaml/opam/default.nix
@@ -1,69 +1,87 @@
-{ stdenv, lib, fetchurl, makeWrapper,
-  ocaml, unzip, ncurses, curl, aspcud
+{ stdenv, lib, fetchurl, makeWrapper, getconf,
+  ocaml, unzip, ncurses, curl, aspcud, bubblewrap
 }:
 
-assert lib.versionAtLeast ocaml.version "3.12.1";
+assert lib.versionAtLeast ocaml.version "4.02.3";
 
 let
   srcs = {
+    cmdliner = fetchurl {
+      url = "http://erratique.ch/software/cmdliner/releases/cmdliner-1.0.2.tbz";
+      sha256 = "18jqphjiifljlh9jg8zpl6310p3iwyaqphdkmf89acyaix0s4kj1";
+    };
+    cppo = fetchurl {
+      url = "https://github.com/mjambon/cppo/archive/v1.6.4.tar.gz";
+      sha256 = "0jdb7d21lfa3ck4k59mrqs5pljzq5rb504jq57nnrc6klljm42j7";
+    };
     cudf = fetchurl {
-      url = "https://gforge.inria.fr/frs/download.php/file/33593/cudf-0.7.tar.gz";
-      sha256 = "92c8a9ed730bbac73f3513abab41127d966c9b9202ab2aaffcd02358c030a701";
+      url = "https://gforge.inria.fr/frs/download.php/36602/cudf-0.9.tar.gz";
+      sha256 = "0771lwljqwwn3cryl0plny5a5dyyrj4z6bw66ha5n8yfbpcy8clr";
+    };
+    dose3 = fetchurl {
+      url = "https://gforge.inria.fr/frs/download.php/file/36063/dose3-5.0.1.tar.gz";
+      sha256 = "00yvyfm4j423zqndvgc1ycnmiffaa2l9ab40cyg23pf51qmzk2jm";
     };
     extlib = fetchurl {
-      url = "http://ocaml-extlib.googlecode.com/files/extlib-1.5.3.tar.gz";
-      sha256 = "c095eef4202a8614ff1474d4c08c50c32d6ca82d1015387785cf03d5913ec021";
+      url = "http://ygrek.org.ua/p/release/ocaml-extlib/extlib-1.7.5.tar.gz";
+      sha256 = "19slqf5bdj0rrph2w41giwmn6df2qm07942jn058pjkjrnk30d4s";
     };
-    ocaml_re = fetchurl {
-      url = "https://github.com/ocaml/ocaml-re/archive/ocaml-re-1.2.0.tar.gz";
-      sha256 = "a34dd9d6136731436a963bbab5c4bbb16e5d4e21b3b851d34887a3dec451999f";
+    jbuilder = fetchurl {
+      url = "https://github.com/ocaml/dune/releases/download/1.0+beta20/jbuilder-1.0.beta20.tbz";
+      sha256 = "07hl9as5llffgd6hbw41rs76i1ibgn3n9r0dba5h0mdlkapcwb10";
     };
-    ocamlgraph = fetchurl {
-      url = "http://ocamlgraph.lri.fr/download/ocamlgraph-1.8.5.tar.gz";
-      sha256 = "d167466435a155c779d5ec25b2db83ad851feb42ebc37dca8ffa345ddaefb82f";
+    mccs = fetchurl {
+      url = "https://github.com/AltGr/ocaml-mccs/archive/1.1+8.tar.gz";
+      sha256 = "0xavfvxfrcf3lmry8ymma1yzy0hw3ijbx94c9zq3pzlwnylrapa4";
     };
-    dose3 = fetchurl {
-      url = "https://gforge.inria.fr/frs/download.php/file/34277/dose3-3.3.tar.gz";
-      sha256 = "8dc4dae9b1a81bb3a42abb283df785ba3eb00ade29b13875821c69f03e00680e";
+    ocamlgraph = fetchurl {
+      url = "http://ocamlgraph.lri.fr/download/ocamlgraph-1.8.8.tar.gz";
+      sha256 = "0m9g16wrrr86gw4fz2fazrh8nkqms0n863w7ndcvrmyafgxvxsnr";
     };
-    cmdliner = fetchurl {
-      url = "http://erratique.ch/software/cmdliner/releases/cmdliner-0.9.7.tbz";
-      sha256 = "9c19893cffb5d3c3469ee0cce85e3eeeba17d309b33b9ace31aba06f68f0bf7a";
+    opam-file-format = fetchurl {
+      url = "https://github.com/ocaml/opam-file-format/archive/2.0.0-rc2.tar.gz";
+      sha256 = "1mgk08msp7hxn0hs0m82vky3yv6hcq4pw5402b3vhx4c49431jsb";
     };
-    uutf = fetchurl {
-      url = "http://erratique.ch/software/uutf/releases/uutf-0.9.3.tbz";
-      sha256 = "1f364f89b1179e5182a4d3ad8975f57389d45548735d19054845e06a27107877";
+    re = fetchurl {
+      url = "https://github.com/ocaml/ocaml-re/releases/download/1.7.3/re-1.7.3.tbz";
+      sha256 = "0nv933qfl8y9i19cqvhsalwzif3dkm28vg478rpnr4hgfqjlfryr";
     };
-    jsonm = fetchurl {
-      url = "http://erratique.ch/software/jsonm/releases/jsonm-0.9.1.tbz";
-      sha256 = "3fd4dca045d82332da847e65e981d8b504883571d299a3f7e71447d46bc65f73";
+    result = fetchurl {
+      url = "https://github.com/janestreet/result/releases/download/1.3/result-1.3.tbz";
+      sha256 = "1lrnbxdq80gbhnp85mqp1kfk0bkh6q1c93sfz2qgnq2qyz60w4sk";
     };
     opam = fetchurl {
-      url = "https://github.com/ocaml/opam/archive/1.2.2.zip";
-      sha256 = "c590ce55ae69ec74f46215cf16a156a02b23c5f3ecb22f23a3ad9ba3d91ddb6e";
+      url = "https://github.com/ocaml/opam/archive/2.0.0.zip";
+      sha256 = "0m4ilsldrfkkn0vlvl119bk76j2pwvqvdi8mpg957z4kqflfbfp8";
     };
   };
 in stdenv.mkDerivation rec {
   name = "opam-${version}";
-  version = "1.2.2";
+  version = "2.0.0";
 
-  buildInputs = [ unzip curl ncurses ocaml makeWrapper ];
+  buildInputs = [ unzip curl ncurses ocaml makeWrapper getconf ] ++ lib.optional stdenv.isLinux bubblewrap;
 
   src = srcs.opam;
 
   postUnpack = ''
-    ln -sv ${srcs.cudf} $sourceRoot/src_ext/${srcs.cudf.name}
-    ln -sv ${srcs.extlib} $sourceRoot/src_ext/${srcs.extlib.name}
-    ln -sv ${srcs.ocaml_re} $sourceRoot/src_ext/${srcs.ocaml_re.name}
-    ln -sv ${srcs.ocamlgraph} $sourceRoot/src_ext/${srcs.ocamlgraph.name}
-    ln -sv ${srcs.dose3} $sourceRoot/src_ext/${srcs.dose3.name}
-    ln -sv ${srcs.cmdliner} $sourceRoot/src_ext/${srcs.cmdliner.name}
-    ln -sv ${srcs.uutf} $sourceRoot/src_ext/${srcs.uutf.name}
-    ln -sv ${srcs.jsonm} $sourceRoot/src_ext/${srcs.jsonm.name}
+    ln -sv ${srcs.cmdliner} $sourceRoot/src_ext/cmdliner.tbz
+    ln -sv ${srcs.cppo} $sourceRoot/src_ext/cppo.tar.gz
+    ln -sv ${srcs.cudf} $sourceRoot/src_ext/cudf.tar.gz
+    ln -sv ${srcs.dose3} $sourceRoot/src_ext/dose3.tar.gz
+    ln -sv ${srcs.extlib} $sourceRoot/src_ext/extlib.tar.gz
+    ln -sv ${srcs.jbuilder} $sourceRoot/src_ext/jbuilder.tbz
+    ln -sv ${srcs.mccs} $sourceRoot/src_ext/mccs.tar.gz
+    ln -sv ${srcs.ocamlgraph} $sourceRoot/src_ext/ocamlgraph.tar.gz
+    ln -sv ${srcs.opam-file-format} $sourceRoot/src_ext/opam-file-format.tar.gz
+    ln -sv ${srcs.re} $sourceRoot/src_ext/re.tbz
+    ln -sv ${srcs.result} $sourceRoot/src_ext/result.tbz
   '';
 
+  patches = [ ./opam-pull-3487.patch ./opam-shebangs.patch ./opam-mccs-darwin.patch ];
+
   preConfigure = ''
     substituteInPlace ./src_ext/Makefile --replace "%.stamp: %.download" "%.stamp:"
+    patchShebangs src/state/shellscripts
   '';
 
   postConfigure = "make lib-ext";
@@ -71,13 +89,17 @@ in stdenv.mkDerivation rec {
   # Dirty, but apparently ocp-build requires a TERM
   makeFlags = ["TERM=screen"];
 
+  outputs = [ "out" "installer" ];
+  setOutputFlags = false;
+
   # change argv0 to "opam" as a workaround for
   # https://github.com/ocaml/opam/issues/2142
   postInstall = ''
     mv $out/bin/opam $out/bin/.opam-wrapped
     makeWrapper $out/bin/.opam-wrapped $out/bin/opam \
       --argv0 "opam" \
-      --suffix PATH : ${aspcud}/bin:${unzip}/bin:${curl}/bin
+      --suffix PATH : ${aspcud}/bin:${unzip}/bin:${curl}/bin:${lib.optionalString stdenv.isLinux "${bubblewrap}/bin:"}${getconf}/bin
+    $out/bin/opam-installer --prefix=$installer opam-installer.install
   '';
 
   doCheck = false;
@@ -87,6 +109,6 @@ in stdenv.mkDerivation rec {
     homepage = http://opam.ocamlpro.com/;
     maintainers = [ maintainers.henrytill ];
     platforms = platforms.all;
-    license = licenses.lgpl21Plus;
   };
 }
+# Generated by: ./opam.nix.pl -v 2.0.0 -p opam-pull-3487.patch,opam-shebangs.patch,opam-mccs-darwin.patch
diff --git a/pkgs/development/tools/ocaml/opam/opam-mccs-darwin.patch b/pkgs/development/tools/ocaml/opam/opam-mccs-darwin.patch
new file mode 100644
index 000000000000..501242c40a01
--- /dev/null
+++ b/pkgs/development/tools/ocaml/opam/opam-mccs-darwin.patch
@@ -0,0 +1,18 @@
+diff --git a/src_ext/patches/mccs/build-on-darwin.patch b/src_ext/patches/mccs/build-on-darwin.patch
+new file mode 100644
+index 00000000..157e2094
+--- /dev/null
++++ b/src_ext/patches/mccs/build-on-darwin.patch
+@@ -0,0 +1,12 @@
++diff --git a/src/context_flags.ml b/src/context_flags.ml
++index 7470030..6e07370 100644
++--- a/src/context_flags.ml
+++++ b/src/context_flags.ml
++@@ -24,6 +24,7 @@ let ifc c x = if c then x else []
++ 
++ let cxxflags =
++   let flags =
+++    (ifc (Config.system = "macosx") ["-x"; "c++"]) @
++     (ifc (Sys.win32 && Config.ccomp_type = "msvc") ["/EHsc"]) @
++     (ifc useGLPK ["-DUSEGLPK"]) @
++     (ifc useCOIN ["-DUSECOIN"]) @
diff --git a/pkgs/development/tools/ocaml/opam/opam-pull-3487.patch b/pkgs/development/tools/ocaml/opam/opam-pull-3487.patch
new file mode 100644
index 000000000000..e047c8298bc3
--- /dev/null
+++ b/pkgs/development/tools/ocaml/opam/opam-pull-3487.patch
@@ -0,0 +1,23 @@
+diff --git a/src/state/shellscripts/bwrap.sh b/src/state/shellscripts/bwrap.sh
+index 6f5d7dbea..3e1a3e1b4 100755
+--- a/src/state/shellscripts/bwrap.sh
++++ b/src/state/shellscripts/bwrap.sh
+@@ -1,4 +1,6 @@
+-#!/bin/bash -ue
++#!/usr/bin/env bash
++
++set -ue
+ 
+ if ! command -v bwrap >/dev/null; then
+     echo "The 'bwrap' command was not found. Install 'bubblewrap' on your system, or" >&2
+@@ -11,7 +13,9 @@ fi
+ 
+ ARGS=(--unshare-net --new-session)
+ ARGS=("${ARGS[@]}" --proc /proc --dev /dev)
+-ARGS=("${ARGS[@]}" --bind /tmp /tmp --tmpfs /run --tmpfs /var)
++ARGS=("${ARGS[@]}" --bind "${TMPDIR:-/tmp}" /tmp)
++ARGS=("${ARGS[@]}" --setenv TMPDIR /tmp --setenv TMP /tmp --setenv TEMPDIR /tmp --setenv TEMP /tmp)
++ARGS=("${ARGS[@]}" --tmpfs /run --tmpfs /var)
+ 
+ add_mounts() {
+     case "$1" in
diff --git a/pkgs/development/tools/ocaml/opam/opam-shebangs.patch b/pkgs/development/tools/ocaml/opam/opam-shebangs.patch
new file mode 100644
index 000000000000..f74ac84ca6b2
--- /dev/null
+++ b/pkgs/development/tools/ocaml/opam/opam-shebangs.patch
@@ -0,0 +1,128 @@
+diff --git a/src/client/opamInitDefaults.ml b/src/client/opamInitDefaults.ml
+index eca13a7c..1fd66f43 100644
+--- a/src/client/opamInitDefaults.ml
++++ b/src/client/opamInitDefaults.ml
+@@ -35,11 +35,15 @@ let eval_variables = [
+ let os_filter os =
+   FOp (FIdent ([], OpamVariable.of_string "os", None), `Eq, FString os)
+ 
++let os_distribution_filter distro =
++  FOp (FIdent ([], OpamVariable.of_string "os-distribution", None), `Eq, FString distro)
++
+ let linux_filter = os_filter "linux"
+ let macos_filter = os_filter "macos"
+ let openbsd_filter = os_filter "openbsd"
+ let freebsd_filter = os_filter "freebsd"
+ let sandbox_filter = FOr (linux_filter, macos_filter)
++let nixos_filter = os_distribution_filter "nixos"
+ 
+ let gpatch_filter = FOr (openbsd_filter, freebsd_filter)
+ let patch_filter = FNot gpatch_filter
+@@ -50,6 +54,11 @@ let wrappers ~sandboxing () =
+     CString t, None;
+   ] in
+   let w = OpamFile.Wrappers.empty in
++  let w = { w with
++            OpamFile.Wrappers.
++            pre_build = [[CString "%{hooks}%/shebangs.sh", None], Some nixos_filter];
++          }
++  in
+   if sandboxing then
+     { w with
+       OpamFile.Wrappers.
+@@ -113,6 +122,7 @@ let required_tools ~sandboxing () =
+ let init_scripts () = [
+   ("sandbox.sh", OpamScript.bwrap), Some bwrap_filter;
+   ("sandbox.sh", OpamScript.sandbox_exec), Some macos_filter;
++  ("shebangs.sh", OpamScript.patch_shebangs), Some nixos_filter;
+ ]
+ 
+ module I = OpamFile.InitConfig
+diff --git a/src/state/opamScript.mli b/src/state/opamScript.mli
+index 03449970..83de0b53 100644
+--- a/src/state/opamScript.mli
++++ b/src/state/opamScript.mli
+@@ -20,3 +20,4 @@ val env_hook : string
+ val env_hook_zsh : string
+ val env_hook_csh : string
+ val env_hook_fish : string
++val patch_shebangs : string
+diff --git a/src/state/shellscripts/patch_shebangs.sh b/src/state/shellscripts/patch_shebangs.sh
+new file mode 100755
+index 00000000..3ea84e2d
+--- /dev/null
++++ b/src/state/shellscripts/patch_shebangs.sh
+@@ -0,0 +1,73 @@
++#!/usr/bin/env bash
++# This setup hook causes the fixup phase to rewrite all script
++# interpreter file names (`#!  /path') to paths found in $PATH.  E.g.,
++# /bin/sh will be rewritten to /nix/store/<hash>-some-bash/bin/sh.
++# /usr/bin/env gets special treatment so that ".../bin/env python" is
++# rewritten to /nix/store/<hash>/bin/python.  Interpreters that are
++# already in the store are left untouched.
++
++header() { echo "$1"; }
++stopNest() { true; }
++
++fixupOutputHooks+=('if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then patchShebangs "$prefix"; fi')
++
++patchShebangs() {
++    local dir="$1"
++    header "patching script interpreter paths in $dir"
++    local f
++    local oldPath
++    local newPath
++    local arg0
++    local args
++    local oldInterpreterLine
++    local newInterpreterLine
++
++    find "$dir" -type f -perm -0100 | while read f; do
++        if [ "$(head -1 "$f" | head -c+2)" != '#!' ]; then
++            # missing shebang => not a script
++            continue
++        fi
++
++        oldInterpreterLine=$(head -1 "$f" | tail -c+3)
++        read -r oldPath arg0 args <<< "$oldInterpreterLine"
++
++        if $(echo "$oldPath" | grep -q "/bin/env$"); then
++            # Check for unsupported 'env' functionality:
++            # - options: something starting with a '-'
++            # - environment variables: foo=bar
++            if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then
++                echo "unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
++                exit 1
++            fi
++            newPath="$(command -v "$arg0" || true)"
++        else
++            if [ "$oldPath" = "" ]; then
++                # If no interpreter is specified linux will use /bin/sh. Set
++                # oldpath="/bin/sh" so that we get /nix/store/.../sh.
++                oldPath="/bin/sh"
++            fi
++            newPath="$(command -v "$(basename "$oldPath")" || true)"
++            args="$arg0 $args"
++        fi
++
++        # Strip trailing whitespace introduced when no arguments are present
++        newInterpreterLine="$(echo "$newPath $args" | sed 's/[[:space:]]*$//')"
++
++        if [ -n "$oldPath" -a "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]; then
++            if [ -n "$newPath" -a "$newPath" != "$oldPath" ]; then
++                echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
++                # escape the escape chars so that sed doesn't interpret them
++                escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g')
++                # Preserve times, see: https://github.com/NixOS/nixpkgs/pull/33281
++                touch -r "$f" "$f.timestamp"
++                sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
++                touch -r "$f.timestamp" "$f"
++                rm "$f.timestamp"
++            fi
++        fi
++    done
++
++    stopNest
++}
++
++patchShebangs .
diff --git a/pkgs/development/tools/ocaml/opam/opam.nix.pl b/pkgs/development/tools/ocaml/opam/opam.nix.pl
new file mode 100755
index 000000000000..1862add452d6
--- /dev/null
+++ b/pkgs/development/tools/ocaml/opam/opam.nix.pl
@@ -0,0 +1,130 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings qw<all>;
+use Getopt::Std;
+
+my $gencmd = "# Generated by: " . join(" ", $0, @ARGV) . "\n";
+
+our $opt_v;
+our $opt_p;
+our $opt_r;
+our $opt_t;
+getopts "v:p:t:r:";
+
+my $OPAM_RELEASE = $opt_v // "2.0.0";
+my $OPAM_TAG = $opt_t // $OPAM_RELEASE;
+my $OPAM_GITHUB_REPO = $opt_r // "ocaml/opam";
+my $OPAM_RELEASE_URL = "https://github.com/$OPAM_GITHUB_REPO/archive/$OPAM_TAG.zip";
+my $OPAM_RELEASE_SHA256 = `nix-prefetch-url \Q$OPAM_RELEASE_URL\E`;
+chomp $OPAM_RELEASE_SHA256;
+
+my $OPAM_BASE_URL = "https://raw.githubusercontent.com/$OPAM_GITHUB_REPO/$OPAM_TAG";
+my $OPAM_OPAM = `curl -L --url \Q$OPAM_BASE_URL\E/opam-devel.opam`;
+my($OCAML_MIN_VERSION) = $OPAM_OPAM =~ /^available: ocaml-version >= "(.*)"$/m
+  or die "could not parse ocaml version bound\n";
+
+print <<"EOF";
+{ stdenv, lib, fetchurl, makeWrapper, getconf,
+  ocaml, unzip, ncurses, curl, aspcud, bubblewrap
+}:
+
+assert lib.versionAtLeast ocaml.version "$OCAML_MIN_VERSION";
+
+let
+  srcs = {
+EOF
+
+my %urls = ();
+my %md5s = ();
+
+open(SOURCES, "-|", "curl", "-L", "--url", "$OPAM_BASE_URL/src_ext/Makefile.sources");
+while (<SOURCES>) {
+  if (/^URL_(?!PKG_)([-\w]+)\s*=\s*(\S+)$/) {
+    $urls{$1} = $2;
+  } elsif (/^MD5_(?!PKG_)([-\w]+)\s*=\s*(\S+)$/) {
+    $md5s{$1} = $2;
+  }
+}
+for my $src (sort keys %urls) {
+  my ($sha256,$store_path) = split /\n/, `nix-prefetch-url --print-path \Q$urls{$src}\E`;
+  system "echo \Q$md5s{$src}\E' *'\Q$store_path\E | md5sum -c 1>&2";
+  die "md5 check failed for $urls{$src}\n" if $?;
+  print <<"EOF";
+    $src = fetchurl {
+      url = "$urls{$src}";
+      sha256 = "$sha256";
+    };
+EOF
+}
+
+print <<"EOF";
+    opam = fetchurl {
+      url = "$OPAM_RELEASE_URL";
+      sha256 = "$OPAM_RELEASE_SHA256";
+    };
+  };
+in stdenv.mkDerivation rec {
+  name = "opam-\${version}";
+  version = "$OPAM_RELEASE";
+
+  buildInputs = [ unzip curl ncurses ocaml makeWrapper getconf ] ++ lib.optional stdenv.isLinux bubblewrap;
+
+  src = srcs.opam;
+
+  postUnpack = ''
+EOF
+for my $src (sort keys %urls) {
+  my($ext) = $urls{$src} =~ /(\.(?:t(?:ar\.|)|)(?:gz|bz2?))$/
+    or die "could not find extension for $urls{$src}\n";
+  print <<"EOF";
+    ln -sv \${srcs.$src} \$sourceRoot/src_ext/$src$ext
+EOF
+}
+print <<'EOF';
+  '';
+
+EOF
+if (defined $opt_p) {
+  print "  patches = [ ";
+  for my $patch (split /[, ]/, $opt_p) {
+    $patch =~ s/^(?=[^\/]*$)/.\//;
+    print "$patch ";
+  }
+  print "];\n\n";
+}
+print <<'EOF';
+  preConfigure = ''
+    substituteInPlace ./src_ext/Makefile --replace "%.stamp: %.download" "%.stamp:"
+    patchShebangs src/state/shellscripts
+  '';
+
+  postConfigure = "make lib-ext";
+
+  # Dirty, but apparently ocp-build requires a TERM
+  makeFlags = ["TERM=screen"];
+
+  outputs = [ "out" "installer" ];
+  setOutputFlags = false;
+
+  # change argv0 to "opam" as a workaround for
+  # https://github.com/ocaml/opam/issues/2142
+  postInstall = ''
+    mv $out/bin/opam $out/bin/.opam-wrapped
+    makeWrapper $out/bin/.opam-wrapped $out/bin/opam \
+      --argv0 "opam" \
+      --suffix PATH : ${aspcud}/bin:${unzip}/bin:${curl}/bin:${lib.optionalString stdenv.isLinux "${bubblewrap}/bin:"}${getconf}/bin
+    $out/bin/opam-installer --prefix=$installer opam-installer.install
+  '';
+
+  doCheck = false;
+
+  meta = with stdenv.lib; {
+    description = "A package manager for OCaml";
+    homepage = http://opam.ocamlpro.com/;
+    maintainers = [ maintainers.henrytill ];
+    platforms = platforms.all;
+  };
+}
+EOF
+print $gencmd;
diff --git a/pkgs/development/tools/pyre/default.nix b/pkgs/development/tools/pyre/default.nix
index 1d7f8025bb0e..b51f6344c9b7 100644
--- a/pkgs/development/tools/pyre/default.nix
+++ b/pkgs/development/tools/pyre/default.nix
@@ -1,24 +1,30 @@
-{ stdenv, fetchFromGitHub, ocamlPackages, makeWrapper, writeScript }:
+{ stdenv, fetchFromGitHub, ocamlPackages, makeWrapper, writeScript
+, jbuilder, python3, rsync, fetchpatch }:
 let
   # Manually set version - the setup script requires
   # hg and git + keeping the .git directory around.
-  version = "0.0.10";
+  pyre-version = "0.0.11";
   versionFile = writeScript "version.ml" ''
     cat > "./version.ml" <<EOF
+    open Core
     let build_info () =
-    "pyre-nixpkgs ${version}"
+    "pyre-nixpkgs ${pyre-version}"
     let version () =
-    "${version}"
+    "${pyre-version}"
+
+    let log_version_banner () =
+      Log.info "Running as pid: %d" (Pid.to_int (Unix.getpid ()));
+      Log.info "Version: %s" (version ());
     EOF
   '';
-in stdenv.mkDerivation {
-  name = "pyre-${version}";
+ pyre-bin = stdenv.mkDerivation {
+  name = "pyre-${pyre-version}";
 
   src = fetchFromGitHub {
     owner = "facebook";
     repo = "pyre-check";
-    rev = "v${version}";
-    sha256 = "17fk2izq434jsr8dfz828754356qdwa6zv0lbzm6z1kgq4jg7brv";
+    rev = "v${pyre-version}";
+    sha256 = "0ig7bx2kfn2kbxw74wysh5365yp5gyby42l9l29iclrzdghgk32l";
   };
 
   nativeBuildInputs = [ makeWrapper ];
@@ -33,6 +39,8 @@ in stdenv.mkDerivation {
     ppx_deriving_yojson
     ocamlbuild
     ppxlib
+    jbuilder
+    ounit
     # python36Packages.python36Full # TODO
   ];
 
@@ -41,13 +49,15 @@ in stdenv.mkDerivation {
     export HOME=.
 
     # "external" because https://github.com/facebook/pyre-check/pull/8/files
-    sed "s/%VERSION%/external ${version}/" Makefile.template > Makefile
+    cp Makefile.template Makefile
+    sed "s/%VERSION%/external/" dune.in > dune
 
     cp ${versionFile} ./scripts/generate-version-number.sh
 
     mkdir $(pwd)/build
     export OCAMLFIND_DESTDIR=$(pwd)/build
     export OCAMLPATH=$OCAMLPATH:$(pwd)/build
+
     make release
   '';
 
@@ -60,7 +70,7 @@ in stdenv.mkDerivation {
   # Improvement for a future version.
   installPhase = ''
     mkdir -p $out/bin
-    cp _build/all/main.native $out/bin/pyre.bin
+    cp ./_build/default/main.exe $out/bin/pyre.bin
   '';
 
   meta = with stdenv.lib; {
@@ -70,4 +80,54 @@ in stdenv.mkDerivation {
     platforms = with platforms; linux;
     maintainers = with maintainers; [ teh ];
   };
+};
+typeshed = stdenv.mkDerivation {
+  name = "typeshed";
+  # typeshed doesn't have versions, it seems to be synchronized with
+  # mypy relases. I'm assigning a random version here (same as pyre).
+  version = pyre-version;
+  src = fetchFromGitHub {
+    owner = "python";
+    repo = "typeshed";
+    rev = "a08c6ea";
+    sha256 = "0wy8yh43vhyyc4g7iqnmlj66kz5in02y5qc0c4jdckhpa3mchaqk";
+  };
+  phases = [ "unpackPhase" "installPhase" ];
+  installPhase = "cp -r $src $out";
+};
+in python3.pkgs.buildPythonApplication rec {
+  pname = "pyre-check";
+  version = pyre-version;
+  src = fetchFromGitHub {
+    owner = "facebook";
+    repo = "pyre-check";
+    rev = "v${pyre-version}";
+    sha256 = "0ig7bx2kfn2kbxw74wysh5365yp5gyby42l9l29iclrzdghgk32l";
+  };
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/facebook/pyre-check/commit/b473d2ed9fc11e7c1cd0c7b8c42f521e5cdc2003.patch";
+      sha256 = "05xvyp7j4n6z92bxf64rxfq5pvaadxgx1c8c5qziy75vdz72lkcy";
+    })
+    ./pyre-bdist-wheel.patch
+  ];
+
+  # The build-pypi-package script does some funky stuff with build
+  # directories - easier to patch it a bit than to replace it
+  # completely though:
+  postPatch = ''
+    mkdir ./build
+    substituteInPlace scripts/build-pypi-package.sh \
+        --replace 'NIX_BINARY_FILE' '${pyre-bin}/bin/pyre.bin' \
+        --replace 'BUILD_ROOT="$(mktemp -d)"' "BUILD_ROOT=$(pwd)/build"
+  '';
+
+  buildInputs = [ pyre-bin rsync ];
+  propagatedBuildInputs = with python3.pkgs; [ docutils typeshed ];
+  buildPhase = ''
+    bash scripts/build-pypi-package.sh --version ${pyre-version} --bundle-typeshed ${typeshed}
+    cp -r build/dist dist
+  '';
+
+  doCheck = false; # can't open file 'nix_run_setup':
 }
diff --git a/pkgs/development/tools/pyre/pyre-bdist-wheel.patch b/pkgs/development/tools/pyre/pyre-bdist-wheel.patch
new file mode 100644
index 000000000000..1b6fea024e03
--- /dev/null
+++ b/pkgs/development/tools/pyre/pyre-bdist-wheel.patch
@@ -0,0 +1,43 @@
+diff --git a/scripts/build-pypi-package.sh b/scripts/build-pypi-package.sh
+index 1035591..bb8cbae 100755
+--- a/scripts/build-pypi-package.sh
++++ b/scripts/build-pypi-package.sh
+@@ -98,7 +98,7 @@ rsync -avm --filter='- tests/' --filter='+ */' --filter='-! *.py' "${SCRIPTS_DIR
+ sed -i -e "/__version__/s/= \".*\"/= \"${PACKAGE_VERSION}\"/" "${BUILD_ROOT}/${MODULE_NAME}/version.py"
+ 
+ # Copy binary files.
+-BINARY_FILE="${SCRIPTS_DIRECTORY}/../_build/default/main.exe"
++BINARY_FILE="NIX_BINARY_FILE"
+ if [[ ! -f "${BINARY_FILE}" ]]; then
+   echo "The binary file ${BINARY_FILE} does not exist."
+   echo "Have you run 'make' in the toplevel directory?"
+@@ -146,7 +146,7 @@ def find_typeshed_files(base):
+         result.append((target, files))
+     return result
+ 
+-with open('README.md') as f:
++with open('README.md', encoding='utf8') as f:
+     long_description = f.read()
+ 
+ setup(
+@@ -205,20 +205,3 @@ fi
+ 
+ # Build.
+ python3 setup.py bdist_wheel
+-
+-# Move artifact outside the build directory.
+-mkdir -p "${SCRIPTS_DIRECTORY}/dist"
+-files_count="$(find "${BUILD_ROOT}/dist/" -type f | wc -l | tr -d ' ')"
+-[[ "${files_count}" == '1' ]] || \
+-  die "${files_count} files created in ${BUILD_ROOT}/dist, but only one was expected"
+-source_file="$(find "${BUILD_ROOT}/dist/" -type f)"
+-destination="$(basename "${source_file}")"
+-destination="${destination/%-any.whl/-${WHEEL_DISTRIBUTION_PLATFORM}.whl}"
+-mv "${source_file}" "${SCRIPTS_DIRECTORY}/dist/${destination}"
+-
+-# Cleanup.
+-cd "${SCRIPTS_DIRECTORY}"
+-rm -rf "${BUILD_ROOT}"
+-
+-printf '\nAll done. Build artifact available at:\n  %s\n' "${SCRIPTS_DIRECTORY}/dist/${destination}"
+-exit 0