summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/aalib/default.nix2
-rw-r--r--pkgs/development/libraries/agg/default.nix2
-rw-r--r--pkgs/development/libraries/apr/default.nix5
-rw-r--r--pkgs/development/libraries/arb/git.nix4
-rw-r--r--pkgs/development/libraries/beecrypt/default.nix4
-rw-r--r--pkgs/development/libraries/buddy/default.nix2
-rw-r--r--pkgs/development/libraries/cddlib/default.nix2
-rw-r--r--pkgs/development/libraries/classads/default.nix6
-rw-r--r--pkgs/development/libraries/clearsilver/default.nix9
-rw-r--r--pkgs/development/libraries/cloog-ppl/default.nix2
-rw-r--r--pkgs/development/libraries/clucene-core/2.x.nix2
-rw-r--r--pkgs/development/libraries/codec2/default.nix25
-rw-r--r--pkgs/development/libraries/cppunit/default.nix5
-rw-r--r--pkgs/development/libraries/cracklib/default.nix1
-rw-r--r--pkgs/development/libraries/cwiid/default.nix2
-rw-r--r--pkgs/development/libraries/dbus-cplusplus/default.nix2
-rw-r--r--pkgs/development/libraries/dbus/default.nix4
-rw-r--r--pkgs/development/libraries/eclib/default.nix12
-rw-r--r--pkgs/development/libraries/fflas-ffpack/1.nix6
-rw-r--r--pkgs/development/libraries/ffmpeg/generic.nix10
-rw-r--r--pkgs/development/libraries/fftw/default.nix4
-rw-r--r--pkgs/development/libraries/flint/default.nix4
-rw-r--r--pkgs/development/libraries/fribidi/default.nix6
-rw-r--r--pkgs/development/libraries/gamin/default.nix6
-rw-r--r--pkgs/development/libraries/gd/default.nix2
-rw-r--r--pkgs/development/libraries/gdal/gdal-1_11.nix2
-rw-r--r--pkgs/development/libraries/gdbm/default.nix6
-rw-r--r--pkgs/development/libraries/gegl/3.0.nix2
-rw-r--r--pkgs/development/libraries/gegl/default.nix2
-rw-r--r--pkgs/development/libraries/geoclue/default.nix13
-rw-r--r--pkgs/development/libraries/gf2x/default.nix2
-rw-r--r--pkgs/development/libraries/givaro/default.nix14
-rw-r--r--pkgs/development/libraries/glibmm/default.nix3
-rw-r--r--pkgs/development/libraries/glog/default.nix5
-rw-r--r--pkgs/development/libraries/gmime/2.nix13
-rw-r--r--pkgs/development/libraries/gmime/3.nix9
-rw-r--r--pkgs/development/libraries/gmp/4.3.2.nix8
-rw-r--r--pkgs/development/libraries/gmp/5.1.x.nix13
-rw-r--r--pkgs/development/libraries/gmp/6.x.nix11
-rw-r--r--pkgs/development/libraries/gpgme/default.nix4
-rw-r--r--pkgs/development/libraries/granite/default.nix18
-rw-r--r--pkgs/development/libraries/gsasl/default.nix2
-rw-r--r--pkgs/development/libraries/gstreamer/base/default.nix2
-rw-r--r--pkgs/development/libraries/gstreamer/good/default.nix3
-rw-r--r--pkgs/development/libraries/gstreamer/legacy/gst-ffmpeg/default.nix2
-rw-r--r--pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix3
-rw-r--r--pkgs/development/libraries/gstreamer/legacy/gstreamer/default.nix21
-rw-r--r--pkgs/development/libraries/harfbuzz/default.nix12
-rw-r--r--pkgs/development/libraries/hunspell/default.nix4
-rw-r--r--pkgs/development/libraries/icu/base.nix6
-rw-r--r--pkgs/development/libraries/ilixi/default.nix9
-rw-r--r--pkgs/development/libraries/imlib/default.nix9
-rw-r--r--pkgs/development/libraries/jasper/default.nix2
-rw-r--r--pkgs/development/libraries/jbig2dec/default.nix9
-rw-r--r--pkgs/development/libraries/ldns/default.nix5
-rw-r--r--pkgs/development/libraries/lensfun/default.nix6
-rw-r--r--pkgs/development/libraries/libagar/libagar_test.nix2
-rw-r--r--pkgs/development/libraries/libantlr3c/default.nix2
-rw-r--r--pkgs/development/libraries/libappindicator/default.nix2
-rw-r--r--pkgs/development/libraries/libcanberra/default.nix2
-rw-r--r--pkgs/development/libraries/libcdio/default.nix7
-rw-r--r--pkgs/development/libraries/libcdr/default.nix3
-rw-r--r--pkgs/development/libraries/libcmis/default.nix2
-rw-r--r--pkgs/development/libraries/libdbusmenu/default.nix2
-rw-r--r--pkgs/development/libraries/libdevil/default.nix7
-rw-r--r--pkgs/development/libraries/libdrm/default.nix10
-rw-r--r--pkgs/development/libraries/libextractor/default.nix10
-rw-r--r--pkgs/development/libraries/libfaketime/default.nix12
-rw-r--r--pkgs/development/libraries/libgcrypt/default.nix2
-rw-r--r--pkgs/development/libraries/libglvnd/default.nix11
-rw-r--r--pkgs/development/libraries/libgpod/default.nix4
-rw-r--r--pkgs/development/libraries/libgsf/default.nix4
-rw-r--r--pkgs/development/libraries/libimobiledevice/default.nix67
-rw-r--r--pkgs/development/libraries/libinput/default.nix4
-rw-r--r--pkgs/development/libraries/libminc/default.nix17
-rw-r--r--pkgs/development/libraries/libmp3splt/default.nix2
-rw-r--r--pkgs/development/libraries/libmspack/default.nix4
-rw-r--r--pkgs/development/libraries/libndctl/default.nix4
-rw-r--r--pkgs/development/libraries/liboping/default.nix2
-rw-r--r--pkgs/development/libraries/libosinfo/default.nix4
-rw-r--r--pkgs/development/libraries/libphonenumber/default.nix38
-rw-r--r--pkgs/development/libraries/libplist/default.nix44
-rw-r--r--pkgs/development/libraries/libpng/12.nix2
-rw-r--r--pkgs/development/libraries/libpng/default.nix9
-rw-r--r--pkgs/development/libraries/libpqxx/default.nix2
-rw-r--r--pkgs/development/libraries/libqalculate/default.nix4
-rw-r--r--pkgs/development/libraries/librdf/redland.nix2
-rw-r--r--pkgs/development/libraries/librsync/0.9.nix5
-rw-r--r--pkgs/development/libraries/libseccomp/default.nix5
-rw-r--r--pkgs/development/libraries/libsecret/default.nix13
-rw-r--r--pkgs/development/libraries/libsoup/default.nix11
-rw-r--r--pkgs/development/libraries/libspatialite/default.nix2
-rw-r--r--pkgs/development/libraries/libtasn1/default.nix3
-rw-r--r--pkgs/development/libraries/libtensorflow/default.nix8
-rw-r--r--pkgs/development/libraries/libtiff/default.nix6
-rw-r--r--pkgs/development/libraries/libtoxcore/default.nix2
-rw-r--r--pkgs/development/libraries/liburcu/default.nix2
-rw-r--r--pkgs/development/libraries/libusbmuxd/default.nix35
-rw-r--r--pkgs/development/libraries/libvirt/default.nix4
-rw-r--r--pkgs/development/libraries/libxml2/default.nix28
-rw-r--r--pkgs/development/libraries/libzip/default.nix10
-rw-r--r--pkgs/development/libraries/libzmf/default.nix6
-rw-r--r--pkgs/development/libraries/lightning/default.nix2
-rw-r--r--pkgs/development/libraries/loudmouth/default.nix2
-rw-r--r--pkgs/development/libraries/mesa/default.nix1
-rw-r--r--pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch52
-rw-r--r--pkgs/development/libraries/mpir/default.nix2
-rw-r--r--pkgs/development/libraries/ncurses/default.nix4
-rw-r--r--pkgs/development/libraries/ncurses/st-0.7.patch13
-rw-r--r--pkgs/development/libraries/neon/0.29.nix13
-rw-r--r--pkgs/development/libraries/neon/default.nix13
-rw-r--r--pkgs/development/libraries/netcdf/default.nix9
-rw-r--r--pkgs/development/libraries/nlohmann_json/default.nix5
-rw-r--r--pkgs/development/libraries/nlopt/default.nix17
-rw-r--r--pkgs/development/libraries/nss/default.nix5
-rw-r--r--pkgs/development/libraries/ntl/default.nix4
-rw-r--r--pkgs/development/libraries/ntrack/default.nix2
-rw-r--r--pkgs/development/libraries/openldap/default.nix12
-rw-r--r--pkgs/development/libraries/openssl/default.nix37
-rw-r--r--pkgs/development/libraries/openssl/revert-relaxed-quoting.patch37
-rw-r--r--pkgs/development/libraries/openwsman/default.nix2
-rw-r--r--pkgs/development/libraries/osm-gps-map/default.nix2
-rw-r--r--pkgs/development/libraries/pango/default.nix2
-rw-r--r--pkgs/development/libraries/pcre2/default.nix2
-rw-r--r--pkgs/development/libraries/physics/rivet/default.nix8
-rw-r--r--pkgs/development/libraries/physics/yoda/default.nix4
-rw-r--r--pkgs/development/libraries/pixman/default.nix2
-rw-r--r--pkgs/development/libraries/polkit/default.nix72
-rw-r--r--pkgs/development/libraries/polkit/system_bus.conf58
-rw-r--r--pkgs/development/libraries/qca2/default.nix11
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/default.nix59
-rw-r--r--pkgs/development/libraries/qt-5/modules/qtwebkit.nix5
-rw-r--r--pkgs/development/libraries/rarian/default.nix2
-rw-r--r--pkgs/development/libraries/readosm/default.nix2
-rw-r--r--pkgs/development/libraries/science/biology/htslib/default.nix2
-rw-r--r--pkgs/development/libraries/science/biology/mirtk/default.nix41
-rw-r--r--pkgs/development/libraries/science/biology/nifticlib/default.nix1
-rw-r--r--pkgs/development/libraries/science/math/liblbfgs/default.nix2
-rw-r--r--pkgs/development/libraries/science/math/zn_poly/default.nix4
-rw-r--r--pkgs/development/libraries/silgraphite/graphite2.nix5
-rw-r--r--pkgs/development/libraries/snack/default.nix2
-rw-r--r--pkgs/development/libraries/spatialite-tools/default.nix2
-rw-r--r--pkgs/development/libraries/sqlite/default.nix2
-rw-r--r--pkgs/development/libraries/sword/default.nix2
-rw-r--r--pkgs/development/libraries/tachyon/darwin.patch31
-rw-r--r--pkgs/development/libraries/tachyon/default.nix7
-rw-r--r--pkgs/development/libraries/thrift/default.nix2
-rw-r--r--pkgs/development/libraries/tix/default.nix14
-rw-r--r--pkgs/development/libraries/twolame/default.nix2
-rw-r--r--pkgs/development/libraries/uthash/default.nix4
-rw-r--r--pkgs/development/libraries/v8/default.nix12
-rw-r--r--pkgs/development/libraries/v8/no-xcode.patch64
-rw-r--r--pkgs/development/libraries/vapoursynth-mvtools/default.nix2
-rw-r--r--pkgs/development/libraries/vigra/default.nix3
-rw-r--r--pkgs/development/libraries/volume-key/default.nix2
-rw-r--r--pkgs/development/libraries/wayland/1.9.nix2
-rw-r--r--pkgs/development/libraries/webkitgtk/2.20.nix4
157 files changed, 914 insertions, 535 deletions
diff --git a/pkgs/development/libraries/aalib/default.nix b/pkgs/development/libraries/aalib/default.nix
index 0209c41abee3..8b1878b0cc30 100644
--- a/pkgs/development/libraries/aalib/default.nix
+++ b/pkgs/development/libraries/aalib/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ ncurses ];
 
-  configureFlags = "--without-x --with-ncurses=${ncurses.dev}";
+  configureFlags = [ "--without-x" "--with-ncurses=${ncurses.dev}" ];
 
   postInstall = ''
     mkdir -p $dev/bin
diff --git a/pkgs/development/libraries/agg/default.nix b/pkgs/development/libraries/agg/default.nix
index ab3098580950..c0539aeed476 100644
--- a/pkgs/development/libraries/agg/default.nix
+++ b/pkgs/development/libraries/agg/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     sh autogen.sh
   '';
 
-  configureFlags = "--x-includes=${libX11.dev}/include --x-libraries=${libX11.out}/lib --enable-examples=no";
+  configureFlags = [ "--x-includes=${libX11.dev}/include" "--x-libraries=${libX11.out}/lib" "--enable-examples=no" ];
 
   # libtool --tag=CXX --mode=link g++ -g -O2 libexamples.la ../src/platform/X11/libaggplatformX11.la ../src/libagg.la -o alpha_mask2 alpha_mask2.o
   # libtool: error: cannot find the library 'libexamples.la'
diff --git a/pkgs/development/libraries/apr/default.nix b/pkgs/development/libraries/apr/default.nix
index ecdeb35f6eda..7d7acf90a95c 100644
--- a/pkgs/development/libraries/apr/default.nix
+++ b/pkgs/development/libraries/apr/default.nix
@@ -10,6 +10,11 @@ stdenv.mkDerivation rec {
 
   patches = stdenv.lib.optionals stdenv.isDarwin [ ./is-this-a-compiler-bug.patch ];
 
+  # This test needs the net
+  postPatch = ''
+    rm test/testsock.*
+  '';
+
   outputs = [ "out" "dev" ];
   outputBin = "dev";
 
diff --git a/pkgs/development/libraries/arb/git.nix b/pkgs/development/libraries/arb/git.nix
index 87b884fece10..a281e2a085fe 100644
--- a/pkgs/development/libraries/arb/git.nix
+++ b/pkgs/development/libraries/arb/git.nix
@@ -9,8 +9,8 @@ stdenv.mkDerivation rec {
     rev = "10bc615ce5999caf4723444b2b1219b74781d8a4";
     sha256 = "1xb40x3hv9nh76aizhskj5gdhalgn7r95a7zji2nn4ih3lmh40hl";
   };
-  buildInputs = [mpir gmp mpfr flint];
-  configureFlags = "--with-gmp=${gmp} --with-mpir=${mpir} --with-mpfr=${mpfr} --with-flint=${flint}";
+  buildInputs = [ mpir gmp mpfr flint ];
+  configureFlags = [ "--with-gmp=${gmp}" "--with-mpir=${mpir}" "--with-mpfr=${mpfr}" "--with-flint=${flint}" ];
   meta = {
     inherit version;
     description = ''A library for arbitrary-precision interval arithmetic'';
diff --git a/pkgs/development/libraries/beecrypt/default.nix b/pkgs/development/libraries/beecrypt/default.nix
index 09758440524c..d7d6ef545163 100644
--- a/pkgs/development/libraries/beecrypt/default.nix
+++ b/pkgs/development/libraries/beecrypt/default.nix
@@ -6,8 +6,8 @@ stdenv.mkDerivation {
     url = mirror://sourceforge/beecrypt/beecrypt-4.2.1.tar.gz;
     sha256 = "0pf5k1c4nsj77jfq5ip0ra1gzx2q47xaa0s008fnn6hd11b1yvr8";
   };
-  buildInputs = [m4];
-  configureFlags = "--disable-optimized --enable-static";
+  buildInputs = [ m4 ];
+  configureFlags = [ "--disable-optimized" "--enable-static" ];
 
   meta = {
     platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/development/libraries/buddy/default.nix b/pkgs/development/libraries/buddy/default.nix
index 00e236eba8c3..a8555a349d08 100644
--- a/pkgs/development/libraries/buddy/default.nix
+++ b/pkgs/development/libraries/buddy/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ bison ];
   patches = [ ./gcc-4.3.3-fixes.patch ];
-  configureFlags = "CFLAGS=-O3 CXXFLAGS=-O3";
+  configureFlags = [ "CFLAGS=-O3" "CXXFLAGS=-O3" ];
   doCheck = true;
 
   meta = {
diff --git a/pkgs/development/libraries/cddlib/default.nix b/pkgs/development/libraries/cddlib/default.nix
index 058ee893c37a..68d34c75c010 100644
--- a/pkgs/development/libraries/cddlib/default.nix
+++ b/pkgs/development/libraries/cddlib/default.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     description = ''An implementation of the Double Description Method for generating all vertices of a convex polyhedron'';
     license = licenses.gpl2Plus;
     maintainers = with maintainers; [raskin timokau];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
     homepage = https://www.inf.ethz.ch/personal/fukudak/cdd_home/index.html;
   };
 }
diff --git a/pkgs/development/libraries/classads/default.nix b/pkgs/development/libraries/classads/default.nix
index 32a4a574ed6c..d329b1945fc7 100644
--- a/pkgs/development/libraries/classads/default.nix
+++ b/pkgs/development/libraries/classads/default.nix
@@ -12,9 +12,9 @@ stdenv.mkDerivation {
 
   buildInputs = [ pcre ];
 
-  configureFlags = ''                                                  
-    --enable-namespace --enable-flexible-member
-  '';
+  configureFlags = [
+    "--enable-namespace" "--enable-flexible-member"
+  ];
   
   meta = {
     homepage = http://www.cs.wisc.edu/condor/classad/;
diff --git a/pkgs/development/libraries/clearsilver/default.nix b/pkgs/development/libraries/clearsilver/default.nix
index cd1789a13bbd..fd4d8d5ca31b 100644
--- a/pkgs/development/libraries/clearsilver/default.nix
+++ b/pkgs/development/libraries/clearsilver/default.nix
@@ -10,7 +10,14 @@ stdenv.mkDerivation rec {
 
   PYTHON_SITE = "$(out)/site-packages";
 
-  configureFlags = "--with-python=${python}/bin/python --disable-apache --disable-perl --disable-ruby --disable-java --disable-csharp";
+  configureFlags = [
+    "--with-python=${python}/bin/python"
+    "--disable-apache"
+    "--disable-perl"
+    "--disable-ruby"
+    "--disable-java"
+    "--disable-csharp"
+  ];
 
   preInstall = ''
     mkdir -p $out
diff --git a/pkgs/development/libraries/cloog-ppl/default.nix b/pkgs/development/libraries/cloog-ppl/default.nix
index 0ce0af97ec94..47037339d417 100644
--- a/pkgs/development/libraries/cloog-ppl/default.nix
+++ b/pkgs/development/libraries/cloog-ppl/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./fix-ppl-version.patch ];
 
-  configureFlags = "--with-ppl=${ppl}";
+  configureFlags = [ "--with-ppl=${ppl}" ];
 
   preAutoreconf = ''
     touch NEWS ChangeLog AUTHORS
diff --git a/pkgs/development/libraries/clucene-core/2.x.nix b/pkgs/development/libraries/clucene-core/2.x.nix
index 0ba9e1545fbf..0db253bbec26 100644
--- a/pkgs/development/libraries/clucene-core/2.x.nix
+++ b/pkgs/development/libraries/clucene-core/2.x.nix
@@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
         $out/lib/libclucene-core.1.dylib
   '';
 
+  doCheck = false; # fails with "Unable to find executable: /build/clucene-core-2.3.3.4/build/bin/cl_test"
+
   meta = {
     description = "Core library for full-featured text search engine";
     longDescription = ''
diff --git a/pkgs/development/libraries/codec2/default.nix b/pkgs/development/libraries/codec2/default.nix
new file mode 100644
index 000000000000..9f4c4c3b6b36
--- /dev/null
+++ b/pkgs/development/libraries/codec2/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchsvn, cmake } :
+
+let
+  version = "0.8";
+
+in stdenv.mkDerivation {
+  name = "codec2-${version}";
+
+  src = fetchsvn {
+    url = "https://svn.code.sf.net/p/freetel/code/codec2/branches/${version}";
+    sha256 = "0qbyaqdn37253s30n6m2ric8nfdsxhkslb9h572kdx18j2yjccki";
+  };
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "Speech codec designed for communications quality speech at low data rates";
+    homepage = http://www.rowetel.com/blog/?page_id=452;
+    license = licenses.lgpl21;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ markuskowa ];
+  };
+}
diff --git a/pkgs/development/libraries/cppunit/default.nix b/pkgs/development/libraries/cppunit/default.nix
index 0690bd425aec..3f8b2d896ac6 100644
--- a/pkgs/development/libraries/cppunit/default.nix
+++ b/pkgs/development/libraries/cppunit/default.nix
@@ -9,9 +9,10 @@ stdenv.mkDerivation rec {
     sha256 = "1027cyfx5gsjkdkaf6c2wnjh68882grw8n672018cj3vs9lrhmix";
   };
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = https://freedesktop.org/wiki/Software/cppunit/;
     description = "C++ unit testing framework";
-    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
+    license = licenses.lgpl21;
+    platforms = platforms.linux ++ platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/cracklib/default.nix b/pkgs/development/libraries/cracklib/default.nix
index aa8b4231a869..b75f03fab7c7 100644
--- a/pkgs/development/libraries/cracklib/default.nix
+++ b/pkgs/development/libraries/cracklib/default.nix
@@ -13,6 +13,7 @@ stdenv.mkDerivation rec {
   meta = with stdenv.lib; {
     homepage    = https://github.com/cracklib/cracklib;
     description = "A library for checking the strength of passwords";
+    license = licenses.lgpl21; # Different license for the wordlist: http://www.openwall.com/wordlists
     maintainers = with maintainers; [ lovek323 ];
     platforms   = platforms.unix;
   };
diff --git a/pkgs/development/libraries/cwiid/default.nix b/pkgs/development/libraries/cwiid/default.nix
index 606058da8545..ee646b24c81a 100644
--- a/pkgs/development/libraries/cwiid/default.nix
+++ b/pkgs/development/libraries/cwiid/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
-  configureFlags = "--without-python";
+  configureFlags = [ "--without-python" ];
 
   prePatch = ''
     sed -i -e '/$(LDCONFIG)/d' common/include/lib.mak.in
diff --git a/pkgs/development/libraries/dbus-cplusplus/default.nix b/pkgs/development/libraries/dbus-cplusplus/default.nix
index 051405811438..6190f6ddc52a 100644
--- a/pkgs/development/libraries/dbus-cplusplus/default.nix
+++ b/pkgs/development/libraries/dbus-cplusplus/default.nix
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ dbus glib expat ];
 
-  configureFlags = "--disable-ecore";
+  configureFlags = [ "--disable-ecore" ];
 
   meta = with stdenv.lib; {
     homepage = http://dbus-cplusplus.sourceforge.net;
diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix
index ade6c98df942..3ca2bdd9abef 100644
--- a/pkgs/development/libraries/dbus/default.nix
+++ b/pkgs/development/libraries/dbus/default.nix
@@ -6,8 +6,8 @@ assert x11Support -> libX11 != null
                   && libSM != null;
 
 let
-  version = "1.12.8";
-  sha256 = "1cvfi7jiby12h0f5gbysphhk99m6mch87ab3cqxkj0w36gkrkp72";
+  version = "1.12.10";
+  sha256 = "1xywijmgfad4m3cxp0b4l6kvypwc53ckmhwwzbrc6n32jwj3ssab";
 
 self = stdenv.mkDerivation {
     name = "dbus-${version}";
diff --git a/pkgs/development/libraries/eclib/default.nix b/pkgs/development/libraries/eclib/default.nix
index 62014489f30c..2a43cbe8ee53 100644
--- a/pkgs/development/libraries/eclib/default.nix
+++ b/pkgs/development/libraries/eclib/default.nix
@@ -16,7 +16,7 @@ assert withFlint -> flint != null;
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
   pname = "eclib";
-  version = "20180710"; # upgrade might break the sage interface
+  version = "20180815"; # upgrade might break the sage interface
   # sage tests to run:
   # src/sage/interfaces/mwrank.py
   # src/sage/libs/eclib
@@ -25,16 +25,8 @@ stdenv.mkDerivation rec {
     owner = "JohnCremona";
     repo = "${pname}";
     rev = "v${version}";
-    sha256 = "1kmwpw971sipb4499c9b35q5pz6sms5qndqrvq7396d8hhwjg1i2";
+    sha256 = "12syn83lnzx0xc4r1v3glfimbzndyilkpdmx50xrihbjz1hzczif";
   };
-  patches = [
-    # One of the headers doesn't get installed.
-    # See https://github.com/NixOS/nixpkgs/pull/43476.
-    (fetchpatch {
-      url = "https://github.com/JohnCremona/eclib/pull/42/commits/c9b96429815e31a6e3372c106e31eef2a96431f9.patch";
-      sha256 = "0cw26h94m66rbh8jjsfnb1bvc6z7ybh8zcp8xl5nhxjxiawhcl73";
-    })
-  ];
   buildInputs = [
     pari
     ntl
diff --git a/pkgs/development/libraries/fflas-ffpack/1.nix b/pkgs/development/libraries/fflas-ffpack/1.nix
index 5efa378ff5fa..eae0326c832f 100644
--- a/pkgs/development/libraries/fflas-ffpack/1.nix
+++ b/pkgs/development/libraries/fflas-ffpack/1.nix
@@ -9,7 +9,11 @@ stdenv.mkDerivation rec {
   };
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
   buildInputs = [ givaro_3_7 openblas gmpxx];
-  configureFlags = "--with-blas=-lopenblas --with-gmp=${gmpxx.dev} --with-givaro=${givaro_3_7}";
+  configureFlags = [
+    "--with-blas=-lopenblas"
+    "--with-gmp=${gmpxx.dev}"
+    "--with-givaro=${givaro_3_7}"
+  ];
   meta = {
     inherit version;
     description = ''Finite Field Linear Algebra Subroutines'';
diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix
index e763e5c1159c..4bb995ff0743 100644
--- a/pkgs/development/libraries/ffmpeg/generic.nix
+++ b/pkgs/development/libraries/ffmpeg/generic.nix
@@ -194,11 +194,11 @@ stdenv.mkDerivation rec {
     description = "A complete, cross-platform solution to record, convert and stream audio and video";
     homepage = http://www.ffmpeg.org/;
     longDescription = ''
-      FFmpeg is the leading multimedia framework, able to decode, encode, transcode, 
-      mux, demux, stream, filter and play pretty much anything that humans and machines 
-      have created. It supports the most obscure ancient formats up to the cutting edge. 
-      No matter if they were designed by some standards committee, the community or 
-      a corporation. 
+      FFmpeg is the leading multimedia framework, able to decode, encode, transcode,
+      mux, demux, stream, filter and play pretty much anything that humans and machines
+      have created. It supports the most obscure ancient formats up to the cutting edge.
+      No matter if they were designed by some standards committee, the community or
+      a corporation.
     '';
     license = licenses.gpl3;
     platforms = platforms.all;
diff --git a/pkgs/development/libraries/fftw/default.nix b/pkgs/development/libraries/fftw/default.nix
index 12b30cf0349f..bc5de5f9730f 100644
--- a/pkgs/development/libraries/fftw/default.nix
+++ b/pkgs/development/libraries/fftw/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, lib, precision ? "double" }:
+{ fetchurl, stdenv, lib, precision ? "double", perl }:
 
 with lib;
 
@@ -38,6 +38,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  checkInputs = [ perl ];
+
   meta = with stdenv.lib; {
     description = "Fastest Fourier Transform in the West library";
     homepage = http://www.fftw.org/;
diff --git a/pkgs/development/libraries/flint/default.nix b/pkgs/development/libraries/flint/default.nix
index 2b3f75b80dbd..d92a0c61aab8 100644
--- a/pkgs/development/libraries/flint/default.nix
+++ b/pkgs/development/libraries/flint/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
   ];
 
   # issues with ntl -- https://github.com/wbhart/flint2/issues/487
-  NIX_CFLAGS_COMPILE = [ "-std=c++11" ];
+  NIX_CXXSTDLIB_COMPILE = [ "-std=c++11" ];
 
   patches = [
     (fetchpatch {
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
     description = ''Fast Library for Number Theory'';
     license = stdenv.lib.licenses.gpl2Plus;
     maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
     homepage = http://www.flintlib.org/;
     downloadPage = "http://www.flintlib.org/downloads.html";
     updateWalker = true;
diff --git a/pkgs/development/libraries/fribidi/default.nix b/pkgs/development/libraries/fribidi/default.nix
index 208d88ed18e3..08b0a87e3e20 100644
--- a/pkgs/development/libraries/fribidi/default.nix
+++ b/pkgs/development/libraries/fribidi/default.nix
@@ -11,14 +11,14 @@
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
   pname = "fribidi";
-  version = "1.0.4";
+  version = "1.0.5";
 
   outputs = [ "out" "devdoc" ];
 
-  # NOTE: 2018-06-06 v1.0.4: Only URL tarball has "Have pre-generated man pages: true", which works-around upstream usage of some rare ancient `c2man` fossil application.
+  # NOTE: 2018-06-06 v1.0.5: Only URL tarball has "Have pre-generated man pages: true", which works-around upstream usage of some rare ancient `c2man` fossil application.
   src = fetchurl {
     url = "https://github.com/${pname}/${pname}/releases/download/v${version}/${name}.tar.bz2";
-    sha256 = "1gipy8fjyn6i4qrhima02x8xs493d21f22dijp88nk807razxgcl";
+    sha256 = "1kp4b1hpx2ky20ixgy2xhj5iygfl7ps5k9kglh1z5i7mhykg4r3a";
   };
 
   postPatch = ''
diff --git a/pkgs/development/libraries/gamin/default.nix b/pkgs/development/libraries/gamin/default.nix
index 2af7bbce18bc..a4e0bcfb52b0 100644
--- a/pkgs/development/libraries/gamin/default.nix
+++ b/pkgs/development/libraries/gamin/default.nix
@@ -14,7 +14,11 @@ stdenv.mkDerivation (rec {
 
   # `_GNU_SOURCE' is needed, e.g., to get `struct ucred' from
   # <sys/socket.h> with Glibc 2.9.
-  configureFlags = "--disable-debug --with-python=${python} CPPFLAGS=-D_GNU_SOURCE";
+  configureFlags = [
+    "--disable-debug"
+    "--with-python=${python}"
+    "CPPFLAGS=-D_GNU_SOURCE"
+  ];
 
   patches = [ ./deadlock.patch ]
     ++ map fetchurl (import ./debian-patches.nix)
diff --git a/pkgs/development/libraries/gd/default.nix b/pkgs/development/libraries/gd/default.nix
index 77fe948e003a..5ceded0546c5 100644
--- a/pkgs/development/libraries/gd/default.nix
+++ b/pkgs/development/libraries/gd/default.nix
@@ -35,6 +35,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  doCheck = false; # fails 2 tests
+
   meta = with stdenv.lib; {
     homepage = https://libgd.github.io/;
     description = "A dynamic image creation library";
diff --git a/pkgs/development/libraries/gdal/gdal-1_11.nix b/pkgs/development/libraries/gdal/gdal-1_11.nix
index 4d1cee5b9160..84d130c3865e 100644
--- a/pkgs/development/libraries/gdal/gdal-1_11.nix
+++ b/pkgs/development/libraries/gdal/gdal-1_11.nix
@@ -58,6 +58,6 @@ stdenv.mkDerivation rec {
     homepage = http://www.gdal.org/;
     license = stdenv.lib.licenses.mit;
     maintainers = [ stdenv.lib.maintainers.marcweber ];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = with stdenv.lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/development/libraries/gdbm/default.nix b/pkgs/development/libraries/gdbm/default.nix
index a1980d62490a..bbebcca6e2f0 100644
--- a/pkgs/development/libraries/gdbm/default.nix
+++ b/pkgs/development/libraries/gdbm/default.nix
@@ -1,11 +1,13 @@
 { stdenv, lib, buildPlatform, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "gdbm-1.15";
+  name = "gdbm-1.17";
+  # FIXME: remove on update to > 1.17
+  NIX_CFLAGS_COMPILE = if stdenv.cc.isClang then "-Wno-error=return-type" else null;
 
   src = fetchurl {
     url = "mirror://gnu/gdbm/${name}.tar.gz";
-    sha256 = "03nwsbixdp3nx3fzn3gjy0n7rcppmkkxb2nxbmd8mvb7gwhf7zgr";
+    sha256 = "0zcp2iv5dbab18859a5fvacg8lkp8k4pr9af13kfvami6lpcrn3w";
   };
 
   doCheck = true; # not cross;
diff --git a/pkgs/development/libraries/gegl/3.0.nix b/pkgs/development/libraries/gegl/3.0.nix
index 287c33243865..54ee7662d06e 100644
--- a/pkgs/development/libraries/gegl/3.0.nix
+++ b/pkgs/development/libraries/gegl/3.0.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   hardeningDisable = [ "format" ];
 
   # needs fonts otherwise  don't know how to pass them
-  configureFlags = "--disable-docs";
+  configureFlags = [ "--disable-docs" ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/gegl/default.nix b/pkgs/development/libraries/gegl/default.nix
index ccfa7e536111..e90cc257e7e8 100644
--- a/pkgs/development/libraries/gegl/default.nix
+++ b/pkgs/development/libraries/gegl/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   })];
 
   # needs fonts otherwise  don't know how to pass them
-  configureFlags = "--disable-docs";
+  configureFlags = [ "--disable-docs" ];
 
   buildInputs = [ babl libpng cairo libjpeg librsvg pango gtk2 bzip2 intltool libintl ]
     ++ stdenv.lib.optional stdenv.isDarwin OpenGL;
diff --git a/pkgs/development/libraries/geoclue/default.nix b/pkgs/development/libraries/geoclue/default.nix
index 2588d7f3d547..8417719b7063 100644
--- a/pkgs/development/libraries/geoclue/default.nix
+++ b/pkgs/development/libraries/geoclue/default.nix
@@ -7,17 +7,19 @@ with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "geoclue-${version}";
-  version = "2.4.10";
+  version = "2.4.12";
 
   src = fetchurl {
     url = "https://www.freedesktop.org/software/geoclue/releases/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz";
-    sha256 = "0h4n8jf7w457sglfdhghkyf8n4v4a5jrx8dgdy5zn35nbscx24l4";
+    sha256 = "1jnad1f3rf8h05sz1lc172jnqdhqdpz76ff6m7i5ss3s0znf5l05";
   };
 
   outputs = [ "out" "dev" "devdoc" ];
 
   nativeBuildInputs = [
-    pkgconfig intltool gtk-doc docbook_xsl docbook_xml_dtd_412 wrapGAppsHook gobjectIntrospection
+    pkgconfig intltool wrapGAppsHook gobjectIntrospection
+    # devdoc
+    gtk-doc docbook_xsl docbook_xml_dtd_412 
   ];
 
   buildInputs = [
@@ -41,11 +43,6 @@ stdenv.mkDerivation rec {
     "--disable-nmea-source"
   ];
 
-  # https://gitlab.freedesktop.org/geoclue/geoclue/issues/73
-  postInstall = ''
-    sed -i $dev/lib/pkgconfig/libgeoclue-2.0.pc -e "s|includedir=.*|includedir=$dev/include|"
-  '';
-
   meta = with stdenv.lib; {
     description = "Geolocation framework and some data providers";
     homepage = https://gitlab.freedesktop.org/geoclue/geoclue/wikis/home;
diff --git a/pkgs/development/libraries/gf2x/default.nix b/pkgs/development/libraries/gf2x/default.nix
index 0d0fa0b2ca5d..8c2e29231dca 100644
--- a/pkgs/development/libraries/gf2x/default.nix
+++ b/pkgs/development/libraries/gf2x/default.nix
@@ -14,6 +14,6 @@ stdenv.mkDerivation rec {
     homepage = http://gf2x.gforge.inria.fr;
     license = licenses.gpl2Plus;
     maintainers = with maintainers; [ raskin ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/givaro/default.nix b/pkgs/development/libraries/givaro/default.nix
index 3556acb0590d..0773daa2d09a 100644
--- a/pkgs/development/libraries/givaro/default.nix
+++ b/pkgs/development/libraries/givaro/default.nix
@@ -11,8 +11,12 @@ stdenv.mkDerivation rec {
     rev = "v${version}";
     sha256 = "199p8wyj5i63jbnk7j8qbdbfp5rm2lpmcxyk3mdjy9bz7ygx3hhy";
   };
+
+  enableParallelBuilding = true;
+
   nativeBuildInputs = [ autoreconfHook ];
   buildInputs = [autoconf automake libtool gmpxx];
+
   configureFlags = [
     "--disable-optimization"
   ] ++ stdenv.lib.optionals (!optimize) [
@@ -28,12 +32,18 @@ stdenv.mkDerivation rec {
     "--disable-fma"
     "--disable-fma4"
   ];
-  doCheck = true;
+
+  # On darwin, tests are linked to dylib in the nix store, so we need to make
+  # sure tests run after installPhase.
+  doInstallCheck = true;
+  installCheckTarget = "check";
+  doCheck = false;
+
   meta = {
     inherit version;
     description = ''A C++ library for arithmetic and algebraic computations'';
     license = stdenv.lib.licenses.cecill-b;
     maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/glibmm/default.nix b/pkgs/development/libraries/glibmm/default.nix
index 3c3b49e66161..ee77f4b498e4 100644
--- a/pkgs/development/libraries/glibmm/default.nix
+++ b/pkgs/development/libraries/glibmm/default.nix
@@ -26,7 +26,8 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ glib libsigcxx ];
 
   enableParallelBuilding = true;
-  #doCheck = true; # some tests need network
+
+  doCheck = false; # fails. one test needs the net, another /etc/fstab
 
   meta = with stdenv.lib; {
     description = "C++ interface to the GLib library";
diff --git a/pkgs/development/libraries/glog/default.nix b/pkgs/development/libraries/glog/default.nix
index 93e94fc8c42b..b030eab7c3ad 100644
--- a/pkgs/development/libraries/glog/default.nix
+++ b/pkgs/development/libraries/glog/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, autoreconfHook }:
+{ stdenv, fetchFromGitHub, autoreconfHook, perl }:
 
 stdenv.mkDerivation rec {
   name = "glog-${version}";
@@ -13,6 +13,9 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook ];
 
+  checkInputs = [ perl ];
+  doCheck = false; # fails with "Mangled symbols (28 out of 380) found in demangle.dm"
+
   meta = with stdenv.lib; {
     homepage = https://github.com/google/glog;
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/gmime/2.nix b/pkgs/development/libraries/gmime/2.nix
index 7d5eeb29997b..b25f5c90bfae 100644
--- a/pkgs/development/libraries/gmime/2.nix
+++ b/pkgs/development/libraries/gmime/2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, glib, zlib, libgpgerror, gobjectIntrospection }:
+{ stdenv, fetchurl, pkgconfig, glib, zlib, gnupg, libgpgerror, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   version = "2.6.23";
@@ -15,6 +15,17 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ glib zlib libgpgerror ];
   configureFlags = [ "--enable-introspection=yes" ];
 
+  postPatch = ''
+    substituteInPlace tests/testsuite.c \
+      --replace /bin/rm rm \
+      --replace /bin/mkdir mkdir
+
+    substituteInPlace tests/test-pkcs7.c \
+      --replace /bin/mkdir mkdir
+  '';
+
+  checkInputs = [ gnupg ];
+
   enableParallelBuilding = true;
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/gmime/3.nix b/pkgs/development/libraries/gmime/3.nix
index 124fc08cf3bd..65c99610a5c7 100644
--- a/pkgs/development/libraries/gmime/3.nix
+++ b/pkgs/development/libraries/gmime/3.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, glib, zlib, gpgme, libidn, gobjectIntrospection }:
+{ stdenv, fetchurl, pkgconfig, glib, zlib, gnupg, gpgme, libidn, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   version = "3.2.0";
@@ -16,6 +16,13 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ glib ];
   configureFlags = [ "--enable-introspection=yes" ];
 
+  postPatch = ''
+    substituteInPlace tests/testsuite.c \
+      --replace /bin/rm rm
+  '';
+
+  checkInputs = [ gnupg ];
+
   enableParallelBuilding = true;
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/gmp/4.3.2.nix b/pkgs/development/libraries/gmp/4.3.2.nix
index 36067cc0786d..939f769b4570 100644
--- a/pkgs/development/libraries/gmp/4.3.2.nix
+++ b/pkgs/development/libraries/gmp/4.3.2.nix
@@ -27,8 +27,12 @@ let self = stdenv.mkDerivation rec {
     then "ln -sf configfsf.guess config.guess"
     else ''echo "Darwin host is `./config.guess`."'';
 
-  configureFlags = (if cxx then "--enable-cxx" else "--disable-cxx") +
-    stdenv.lib.optionalString stdenv.isDarwin " ac_cv_build=x86_64-apple-darwin13.4.0 ac_cv_host=x86_64-apple-darwin13.4.0";
+  configureFlags = [
+    (stdenv.lib.enableFeature cxx "cxx")
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+    "ac_cv_build=x86_64-apple-darwin13.4.0"
+    "ac_cv_host=x86_64-apple-darwin13.4.0"
+  ];
 
   # The test t-lucnum_ui fails (on Linux/x86_64) when built with GCC 4.8.
   # Newer versions of GMP don't have that issue anymore.
diff --git a/pkgs/development/libraries/gmp/5.1.x.nix b/pkgs/development/libraries/gmp/5.1.x.nix
index 57204776decd..3b9fbc35a768 100644
--- a/pkgs/development/libraries/gmp/5.1.x.nix
+++ b/pkgs/development/libraries/gmp/5.1.x.nix
@@ -20,18 +20,17 @@ let self = stdenv.mkDerivation rec {
 
   patches = if stdenv.isDarwin then [ ./need-size-t.patch ] else null;
 
-  configureFlags =
+  configureFlags = [
+    "--with-pic"
+    (stdenv.lib.enableFeature cxx "cxx")
     # Build a "fat binary", with routines for several sub-architectures
     # (x86), except on Solaris where some tests crash with "Memory fault".
     # See <http://hydra.nixos.org/build/2760931>, for instance.
     #
     # no darwin because gmp uses ASM that clang doesn't like
-    optional (!stdenv.isSunOS) "--enable-fat"
-    ++ (if cxx then [ "--enable-cxx"  ]
-               else [ "--disable-cxx" ])
-    ++ optional (cxx && stdenv.isDarwin) "CPPFLAGS=-fexceptions"
-    ++ optional stdenv.isDarwin "ABI=64"
-    ++ optional stdenv.is64bit "--with-pic"
+    (stdenv.lib.enableFeature (!stdenv.isSunOS && stdenv.hostPlatform.isx86) "fat")
+  ] ++ optional (cxx && stdenv.isDarwin) "CPPFLAGS=-fexceptions"
+    ++ optional (stdenv.isDarwin && stdenv.is64bit) "ABI=64"
     ;
 
   # The config.guess in GMP tries to runtime-detect various
diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix
index f62883529fc9..04c57d94666f 100644
--- a/pkgs/development/libraries/gmp/6.x.nix
+++ b/pkgs/development/libraries/gmp/6.x.nix
@@ -21,18 +21,17 @@ let self = stdenv.mkDerivation rec {
   depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ m4 ];
 
-  configureFlags =
+  configureFlags = [
+    "--with-pic"
+    (stdenv.lib.enableFeature cxx "cxx")
     # Build a "fat binary", with routines for several sub-architectures
     # (x86), except on Solaris where some tests crash with "Memory fault".
     # See <http://hydra.nixos.org/build/2760931>, for instance.
     #
     # no darwin because gmp uses ASM that clang doesn't like
-    optional (!stdenv.isSunOS && stdenv.hostPlatform.isx86) "--enable-fat"
-    ++ (if cxx then [ "--enable-cxx"  ]
-               else [ "--disable-cxx" ])
-    ++ optional (cxx && stdenv.isDarwin) "CPPFLAGS=-fexceptions"
+    (stdenv.lib.enableFeature (!stdenv.isSunOS && stdenv.hostPlatform.isx86) "fat")
+  ] ++ optional (cxx && stdenv.isDarwin) "CPPFLAGS=-fexceptions"
     ++ optional (stdenv.isDarwin && stdenv.is64bit) "ABI=64"
-    ++ optional stdenv.is64bit "--with-pic"
     ++ optional (with stdenv.hostPlatform; useAndroidPrebuilt || useiOSPrebuilt) "--disable-assembly"
     ;
 
diff --git a/pkgs/development/libraries/gpgme/default.nix b/pkgs/development/libraries/gpgme/default.nix
index e7da60a9d1a2..b3b00a1c7226 100644
--- a/pkgs/development/libraries/gpgme/default.nix
+++ b/pkgs/development/libraries/gpgme/default.nix
@@ -44,6 +44,10 @@ stdenv.mkDerivation rec {
     # https://www.gnupg.org/documentation/manuals/gpgme/Largefile-Support-_0028LFS_0029.html
     ++ lib.optional (system == "i686-linux") "-D_FILE_OFFSET_BITS=64";
 
+  checkInputs = [ which ];
+
+  doCheck = false; # fails 8 out of 26 tests with "GPGME: Decryption failed". Spooky!
+
   meta = with stdenv.lib; {
     homepage = https://gnupg.org/software/gpgme/index.html;
     description = "Library for making GnuPG easier to use";
diff --git a/pkgs/development/libraries/granite/default.nix b/pkgs/development/libraries/granite/default.nix
index 8243775c6bc1..b8f35c8539ac 100644
--- a/pkgs/development/libraries/granite/default.nix
+++ b/pkgs/development/libraries/granite/default.nix
@@ -1,14 +1,14 @@
-{ stdenv, fetchFromGitHub, perl, cmake, ninja, vala, pkgconfig, gobjectIntrospection, glib, gtk3, gnome3, gettext }:
+{ stdenv, fetchFromGitHub, perl, cmake, ninja, vala_0_40, pkgconfig, gobjectIntrospection, glib, gtk3, gnome3, gettext }:
 
 stdenv.mkDerivation rec {
   name = "granite-${version}";
-  version = "0.5";
+  version = "5.0";
 
   src = fetchFromGitHub {
     owner = "elementary";
     repo = "granite";
     rev = version;
-    sha256 = "15l8z1jkqhvappnr8jww27lfy3dwqybgsxk5iccyvnvzpjdh2s0h";
+    sha256 = "015hkclcxirssg7a8s6mkns5xdk77m1jnkshlyfdw041nzyc5jh1";
   };
 
   cmakeFlags = [
@@ -17,18 +17,18 @@ stdenv.mkDerivation rec {
   ];
 
   nativeBuildInputs = [
-    vala
-    pkgconfig
     cmake
-    ninja
-    perl
     gettext
     gobjectIntrospection
+    ninja
+    perl
+    pkgconfig
+    vala_0_40
   ];
   buildInputs = [
     glib
-    gtk3
     gnome3.libgee
+    gtk3
   ];
 
   meta = with stdenv.lib; {
@@ -37,6 +37,6 @@ stdenv.mkDerivation rec {
     homepage = https://github.com/elementary/granite;
     license = licenses.lgpl3;
     platforms = platforms.linux;
-    maintainers = [ maintainers.vozz ];
+    maintainers = with maintainers; [ vozz worldofpeace ];
   };
 }
diff --git a/pkgs/development/libraries/gsasl/default.nix b/pkgs/development/libraries/gsasl/default.nix
index 9c19bdbdc29a..71da2c716f84 100644
--- a/pkgs/development/libraries/gsasl/default.nix
+++ b/pkgs/development/libraries/gsasl/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libidn kerberos ];
 
-  configureFlags = "--with-gssapi-impl=mit";
+  configureFlags = [ "--with-gssapi-impl=mit" ];
 
   doCheck = true;
 
diff --git a/pkgs/development/libraries/gstreamer/base/default.nix b/pkgs/development/libraries/gstreamer/base/default.nix
index 49216b70fe12..dd4007bd142b 100644
--- a/pkgs/development/libraries/gstreamer/base/default.nix
+++ b/pkgs/development/libraries/gstreamer/base/default.nix
@@ -57,6 +57,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  doCheck = false; # fails, wants DRI access for OpenGL
+
   patches = [
     (fetchpatch {
         url = "https://bug794856.bugzilla-attachments.gnome.org/attachment.cgi?id=370414";
diff --git a/pkgs/development/libraries/gstreamer/good/default.nix b/pkgs/development/libraries/gstreamer/good/default.nix
index ad7309be0445..99d27523b1c9 100644
--- a/pkgs/development/libraries/gstreamer/good/default.nix
+++ b/pkgs/development/libraries/gstreamer/good/default.nix
@@ -54,4 +54,7 @@ stdenv.mkDerivation rec {
   ++ optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
   ++ optionals stdenv.isLinux [ libv4l libpulseaudio libavc1394 libiec61883 ];
 
+  # fails 1 tests with "Unexpected critical/warning: g_object_set_is_valid_property: object class 'GstRtpStorage' has no property named ''"
+  doCheck = false;
+
 }
diff --git a/pkgs/development/libraries/gstreamer/legacy/gst-ffmpeg/default.nix b/pkgs/development/libraries/gstreamer/legacy/gst-ffmpeg/default.nix
index 95b394a6d4b7..9c9243a1c683 100644
--- a/pkgs/development/libraries/gstreamer/legacy/gst-ffmpeg/default.nix
+++ b/pkgs/development/libraries/gstreamer/legacy/gst-ffmpeg/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   # Upstream strongly recommends against using --with-system-ffmpeg,
   # but we do it anyway because we're so hardcore (and we don't want
   # multiple copies of ffmpeg).
-  configureFlags = stdenv.lib.optionalString (!useInternalFfmpeg) "--with-system-ffmpeg";
+  configureFlags = stdenv.lib.optional (!useInternalFfmpeg) "--with-system-ffmpeg";
 
   buildInputs =
     [ pkgconfig bzip2 gst-plugins-base orc ]
diff --git a/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix
index 9c47ef0260b4..7ecb6c34b432 100644
--- a/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix
+++ b/pkgs/development/libraries/gstreamer/legacy/gst-plugins-good/default.nix
@@ -36,6 +36,9 @@ stdenv.mkDerivation rec {
       --replace "${ncurses.dev}/lib" "${ncurses.out}/lib"
   '';
 
+  # fails 1 out of 65 tests with "Could not read TLS certificate from '../../tests/files/test-cert.pem': TLS support is not available"
+  doCheck = false;
+
   meta = {
     homepage = https://gstreamer.freedesktop.org;
 
diff --git a/pkgs/development/libraries/gstreamer/legacy/gstreamer/default.nix b/pkgs/development/libraries/gstreamer/legacy/gstreamer/default.nix
index e46ecfb76127..d4d4082509e4 100644
--- a/pkgs/development/libraries/gstreamer/legacy/gstreamer/default.nix
+++ b/pkgs/development/libraries/gstreamer/legacy/gstreamer/default.nix
@@ -17,18 +17,21 @@ stdenv.mkDerivation rec {
   buildInputs = [ perl bison flex ];
   propagatedBuildInputs = [ glib libxml2 ];
 
-  patchPhase = ''
+  # See https://trac.macports.org/ticket/40783 for explanation of patch
+  patches = stdenv.lib.optional stdenv.isDarwin ./darwin.patch;
+
+  postPatch = ''
     sed -i -e 's/^   /\t/' docs/gst/Makefile.in docs/libs/Makefile.in docs/plugins/Makefile.in
-  ''
-  + stdenv.lib.optionalString stdenv.isDarwin ''
-    # Applying this patch manually to avoid a rebuild on Linux. Feel free to refactor later
-    # See https://trac.macports.org/ticket/40783 for explanation of patch
-    patch -p1 < ${./darwin.patch}
   '';
 
-  configureFlags = ''
-    --disable-examples --enable-failing-tests --localstatedir=/var --disable-gtk-doc --disable-docbook
-  '';
+  configureFlags = [
+    "--disable-examples"
+    "--localstatedir=/var"
+    "--disable-gtk-doc"
+    "--disable-docbook"
+  ];
+
+  doCheck = false; # fails. 2 tests crash
 
   postInstall = ''
     # Hm, apparently --disable-gtk-doc is ignored...
diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix
index a0160a8440da..24260234116b 100644
--- a/pkgs/development/libraries/harfbuzz/default.nix
+++ b/pkgs/development/libraries/harfbuzz/default.nix
@@ -2,6 +2,7 @@
 , icu, graphite2, harfbuzz # The icu variant uses and propagates the non-icu one.
 , withIcu ? false # recommended by upstream as default, but most don't needed and it's big
 , withGraphite2 ? true # it is small and major distros do include it
+, python
 }:
 
 let
@@ -17,6 +18,11 @@ stdenv.mkDerivation {
     sha256 = "0my6m9aqv4a8fc2pjwqx9pfdfh3a9mqvas4si4psi1b1867zi8y8";
   };
 
+  postPatch = ''
+    patchShebangs src/gen-def.py
+    patchShebangs test
+  '';
+
   outputs = [ "out" "dev" ];
   outputBin = "dev";
 
@@ -29,8 +35,10 @@ stdenv.mkDerivation {
   buildInputs = [ glib freetype cairo ]; # recommended by upstream
   propagatedBuildInputs = []
     ++ optional withGraphite2 graphite2
-    ++ optionals withIcu [ icu harfbuzz ]
-    ;
+    ++ optionals withIcu [ icu harfbuzz ];
+
+  checkInputs = [ python ];
+  doInstallCheck = false; # fails, probably a bug
 
   # Slightly hacky; some pkgs expect them in a single directory.
   postInstall = optionalString withIcu ''
diff --git a/pkgs/development/libraries/hunspell/default.nix b/pkgs/development/libraries/hunspell/default.nix
index ecbfbb7da0b8..b3914a4438b3 100644
--- a/pkgs/development/libraries/hunspell/default.nix
+++ b/pkgs/development/libraries/hunspell/default.nix
@@ -14,6 +14,10 @@ stdenv.mkDerivation rec {
   buildInputs = [ ncurses readline ];
   nativeBuildInputs = [ autoreconfHook ];
 
+  postPatch = ''
+    patchShebangs tests
+  '';
+
   autoreconfFlags = "-vfi";
 
   configureFlags = [ "--with-ui" "--with-readline" ];
diff --git a/pkgs/development/libraries/icu/base.nix b/pkgs/development/libraries/icu/base.nix
index 705fb816b2e5..b8ad48326b2b 100644
--- a/pkgs/development/libraries/icu/base.nix
+++ b/pkgs/development/libraries/icu/base.nix
@@ -36,9 +36,9 @@ let
       sed -e 's/LDFLAGSICUDT=-nodefaultlibs -nostdlib/LDFLAGSICUDT=/' -i config/mh-linux
     '';
 
-    configureFlags = "--disable-debug" +
-      stdenv.lib.optionalString (stdenv.isFreeBSD || stdenv.isDarwin) " --enable-rpath" +
-      stdenv.lib.optionalString (buildPlatform != hostPlatform) " --with-cross-build=${nativeBuildRoot}";
+    configureFlags = [ "--disable-debug" ]
+      ++ stdenv.lib.optional (stdenv.isFreeBSD || stdenv.isDarwin) "--enable-rpath"
+      ++ stdenv.lib.optional (buildPlatform != hostPlatform) "--with-cross-build=${nativeBuildRoot}";
 
     enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/ilixi/default.nix b/pkgs/development/libraries/ilixi/default.nix
index 0213148d6930..99f6df9c5f06 100644
--- a/pkgs/development/libraries/ilixi/default.nix
+++ b/pkgs/development/libraries/ilixi/default.nix
@@ -14,9 +14,12 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ directfb libsigcxx libxml2 fontconfig ];
 
-  configureFlags = ''
-    --enable-log-debug --enable-debug --enable-trace --with-examples
-  '';
+  configureFlags = [
+    "--enable-log-debug"
+    "--enable-debug"
+    "--enable-trace"
+    "--with-examples"
+  ];
 
   meta = with stdenv.lib; {
     description = "Lightweight C++ GUI toolkit for embedded Linux systems";
diff --git a/pkgs/development/libraries/imlib/default.nix b/pkgs/development/libraries/imlib/default.nix
index 624e401b62f7..2b95742c44c0 100644
--- a/pkgs/development/libraries/imlib/default.nix
+++ b/pkgs/development/libraries/imlib/default.nix
@@ -7,10 +7,11 @@ stdenv.mkDerivation {
     sha256 = "0ggjxyvgp4pxc0b88v40xj9daz90518ydnycw7qax011gxpr12d3";
   };
 
-  configureFlags = "
-    --disable-shm
-    --x-includes=${libX11.dev}/include
-    --x-libraries=${libX11.out}/lib";
+  configureFlags = [
+    "--disable-shm"
+    "--x-includes=${libX11.dev}/include"
+    "--x-libraries=${libX11.out}/lib"
+  ];
 
   buildInputs = [libjpeg libXext libX11 xextproto libtiff libungif libpng];
 
diff --git a/pkgs/development/libraries/jasper/default.nix b/pkgs/development/libraries/jasper/default.nix
index bc18a13884b5..de4848c7dda4 100644
--- a/pkgs/development/libraries/jasper/default.nix
+++ b/pkgs/development/libraries/jasper/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   propagatedBuildInputs = [ libjpeg ];
 
-  configureFlags = "--enable-shared";
+  configureFlags = [ "--enable-shared" ];
 
   outputs = [ "bin" "dev" "out" "man" ];
 
diff --git a/pkgs/development/libraries/jbig2dec/default.nix b/pkgs/development/libraries/jbig2dec/default.nix
index b9dcc927172f..cc838be0f4f0 100644
--- a/pkgs/development/libraries/jbig2dec/default.nix
+++ b/pkgs/development/libraries/jbig2dec/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, python }:
 
 stdenv.mkDerivation rec {
   name = "jbig2dec-0.14";
@@ -8,6 +8,13 @@ stdenv.mkDerivation rec {
     sha256 = "0k01hp0q4275fj4rbr1gy64svfraw5w7wvwl08yjhvsnpb1rid11";
   };
 
+  postPatch = ''
+    patchShebangs test_jbig2dec.py
+  '';
+
+  checkInputs = [ python ];
+  doCheck = false; # fails 1 of 4 tests
+
   meta = {
     homepage = https://www.ghostscript.com/jbig2dec.html;
     description = "Decoder implementation of the JBIG2 image compression format";
diff --git a/pkgs/development/libraries/ldns/default.nix b/pkgs/development/libraries/ldns/default.nix
index e9d81d3ab785..c4120e5bb0eb 100644
--- a/pkgs/development/libraries/ldns/default.nix
+++ b/pkgs/development/libraries/ldns/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, openssl, perl, dns-root-data }:
+{ stdenv, fetchurl, fetchpatch, openssl, perl, which, dns-root-data }:
 
 stdenv.mkDerivation rec {
   pname = "ldns";
@@ -45,6 +45,9 @@ stdenv.mkDerivation rec {
     "ac_cv_func_realloc_0_nonnull=yes"
   ];
 
+  checkInputs = [ which ];
+  doCheck = false; # fails. missing some files
+
   postInstall = ''
     moveToOutput "bin/ldns-config" "$dev"
 
diff --git a/pkgs/development/libraries/lensfun/default.nix b/pkgs/development/libraries/lensfun/default.nix
index e9ba4ae5ac21..21cdd9cd0964 100644
--- a/pkgs/development/libraries/lensfun/default.nix
+++ b/pkgs/development/libraries/lensfun/default.nix
@@ -12,11 +12,11 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ glib zlib libpng cmake gnumake3 ];
 
-  configureFlags = "-v";
+  configureFlags = [ "-v" ];
 
   meta = with stdenv.lib; {
-    platforms = platforms.linux;
-    maintainers = [ ];
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = with maintainers; [ enzime ];
     license = stdenv.lib.licenses.lgpl3;
     description = "An opensource database of photographic lenses and their characteristics";
     homepage = http://lensfun.sourceforge.net/;
diff --git a/pkgs/development/libraries/libagar/libagar_test.nix b/pkgs/development/libraries/libagar/libagar_test.nix
index dea102774d09..c1e9ba7d1c73 100644
--- a/pkgs/development/libraries/libagar/libagar_test.nix
+++ b/pkgs/development/libraries/libagar/libagar_test.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     cat configure.in | ${bsdbuild}/bin/mkconfigure > configure
   '';
 
-  configureFlags = "--with-agar=${libagar}";
+  configureFlags = [ "--with-agar=${libagar}" ];
 
   buildInputs = [ perl bsdbuild libagar libjpeg libpng openssl ];
 
diff --git a/pkgs/development/libraries/libantlr3c/default.nix b/pkgs/development/libraries/libantlr3c/default.nix
index ef5838188593..6f12bf891b01 100644
--- a/pkgs/development/libraries/libantlr3c/default.nix
+++ b/pkgs/development/libraries/libantlr3c/default.nix
@@ -7,7 +7,7 @@ stdenv.mkDerivation {
     sha256 ="0lpbnb4dq4azmsvlhp6khq1gy42kyqyjv8gww74g5lm2y6blm4fa";
   };
 
-  configureFlags = if stdenv.is64bit then "--enable-64bit" else "";
+  configureFlags = stdenv.lib.optional stdenv.is64bit "--enable-64bit";
 
   meta = with stdenv.lib; {
     description = "C runtime libraries of ANTLR v3";
diff --git a/pkgs/development/libraries/libappindicator/default.nix b/pkgs/development/libraries/libappindicator/default.nix
index 71c388be6ea5..8bf0e4bcb93c 100644
--- a/pkgs/development/libraries/libappindicator/default.nix
+++ b/pkgs/development/libraries/libappindicator/default.nix
@@ -61,6 +61,8 @@ in stdenv.mkDerivation rec {
       --replace /usr/bin/file ${file}/bin/file
   '';
 
+  doCheck = false; # generates shebangs in check phase, too lazy to fix
+
   installFlags = [
     "sysconfdir=\${out}/etc"
     "localstatedir=\${TMPDIR}"
diff --git a/pkgs/development/libraries/libcanberra/default.nix b/pkgs/development/libraries/libcanberra/default.nix
index 0d1772d0c549..8addb6128f0c 100644
--- a/pkgs/development/libraries/libcanberra/default.nix
+++ b/pkgs/development/libraries/libcanberra/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     ++ lib.optional stdenv.isLinux libcap
     ++ lib.optional withAlsa alsaLib;
 
-  configureFlags = "--disable-oss";
+  configureFlags = [ "--disable-oss" ];
 
   patchFlags = "-p0";
   patches = stdenv.lib.optional stdenv.isDarwin
diff --git a/pkgs/development/libraries/libcdio/default.nix b/pkgs/development/libraries/libcdio/default.nix
index bb81721feeae..9dc3c1d11ba1 100644
--- a/pkgs/development/libraries/libcdio/default.nix
+++ b/pkgs/development/libraries/libcdio/default.nix
@@ -8,12 +8,15 @@ stdenv.mkDerivation rec {
     sha256 = "0jr8ppdm80c533nzmrpz3iffnpc6nhvsria1di9f4jg1l19a03fd";
   };
 
+  postPatch = ''
+    patchShebangs .
+  '';
+
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ libcddb ncurses help2man ]
     ++ stdenv.lib.optionals stdenv.isDarwin [ libiconv Carbon IOKit ];
 
-  # Disabled due to several spurious test failures.
-  # doCheck = true;
+  doCheck = true;
 
   meta = with stdenv.lib; {
     description = "A library for OS-independent CD-ROM and CD image access";
diff --git a/pkgs/development/libraries/libcdr/default.nix b/pkgs/development/libraries/libcdr/default.nix
index fa309dc8844e..5e46f4dc699d 100644
--- a/pkgs/development/libraries/libcdr/default.nix
+++ b/pkgs/development/libraries/libcdr/default.nix
@@ -18,8 +18,7 @@ stdenv.mkDerivation rec {
     sed -i 's,^CPPFLAGS.*,\0 -DBOOST_ERROR_CODE_HEADER_ONLY -DBOOST_SYSTEM_NO_DEPRECATED,' src/lib/Makefile.in
   '';
 
-  configureFlags = if stdenv.cc.isClang
-    then [ "--disable-werror" ] else null;
+  configureFlags = stdenv.lib.optional stdenv.cc.isClang "--disable-werror";
 
   CXXFLAGS="--std=gnu++0x"; # For c++11 constants in lcms2.h
 
diff --git a/pkgs/development/libraries/libcmis/default.nix b/pkgs/development/libraries/libcmis/default.nix
index 9ab42c7fd1dd..d62d1a802645 100644
--- a/pkgs/development/libraries/libcmis/default.nix
+++ b/pkgs/development/libraries/libcmis/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
   buildInputs = [ boost libxml2 curl ];
-  configureFlags = "--without-man --with-boost=${boost.dev} --disable-werror --disable-tests";
+  configureFlags = [ "--without-man" "--with-boost=${boost.dev}" "--disable-werror" "--disable-tests" ];
 
   # Cppcheck cannot find all the include files (use --check-config for details)
   doCheck = false;
diff --git a/pkgs/development/libraries/libdbusmenu/default.nix b/pkgs/development/libraries/libdbusmenu/default.nix
index 220cc5a2eeb4..730cef6f6960 100644
--- a/pkgs/development/libraries/libdbusmenu/default.nix
+++ b/pkgs/development/libraries/libdbusmenu/default.nix
@@ -46,6 +46,8 @@ stdenv.mkDerivation rec {
     "--disable-scrollkeeper"
   ] ++ optional (gtkVersion != "2") "--disable-dumper";
 
+  doCheck = false; # generates shebangs in check phase, too lazy to fix
+
   installFlags = [
     "sysconfdir=\${out}/etc"
     "localstatedir=\${TMPDIR}"
diff --git a/pkgs/development/libraries/libdevil/default.nix b/pkgs/development/libraries/libdevil/default.nix
index f88d20bee703..78e7490cd992 100644
--- a/pkgs/development/libraries/libdevil/default.nix
+++ b/pkgs/development/libraries/libdevil/default.nix
@@ -42,6 +42,13 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  postPatch = ''
+    for a in test/Makefile.in test/format_test/format_checks.sh.in ; do
+      substituteInPlace $a \
+        --replace /bin/bash ${stdenv.shell}
+    done
+  '';
+
   meta = with stdenv.lib; {
     homepage = http://openil.sourceforge.net/;
     description = "An image library which can can load, save, convert, manipulate, filter and display a wide variety of image formats";
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index 93ef1957d2cd..5107d8898d46 100644
--- a/pkgs/development/libraries/libdrm/default.nix
+++ b/pkgs/development/libraries/libdrm/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, pkgconfig, libpthreadstubs, libpciaccess, valgrind-light }:
 
 stdenv.mkDerivation rec {
-  name = "libdrm-2.4.92";
+  name = "libdrm-2.4.93";
 
   src = fetchurl {
     url = "https://dri.freedesktop.org/libdrm/${name}.tar.bz2";
-    sha256 = "1yirzx8hmlvv6r0l7lb3zxmgy5la2mri9al0k16xqfg19pdqzr79";
+    sha256 = "0g6d9wsnb7lx8r1m4kq8js0wsc5jl20cz1csnlh6z9s8jpfd313f";
   };
 
   outputs = [ "out" "dev" "bin" ];
@@ -16,6 +16,12 @@ stdenv.mkDerivation rec {
 
   patches = stdenv.lib.optional stdenv.isDarwin ./libdrm-apple.patch;
 
+  postPatch = ''
+    for a in */*-symbol-check ; do
+      patchShebangs $a
+    done
+  '';
+
   preConfigure = stdenv.lib.optionalString stdenv.isDarwin
     "echo : \\\${ac_cv_func_clock_gettime=\'yes\'} > config.cache";
 
diff --git a/pkgs/development/libraries/libextractor/default.nix b/pkgs/development/libraries/libextractor/default.nix
index 88b15b58c43d..e3f3604f94e3 100644
--- a/pkgs/development/libraries/libextractor/default.nix
+++ b/pkgs/development/libraries/libextractor/default.nix
@@ -27,10 +27,12 @@ stdenv.mkDerivation rec {
    ] ++ stdenv.lib.optionals gtkSupport [ glib gtk3 ]
      ++ stdenv.lib.optionals videoSupport [ ffmpeg libmpeg2 ];
 
-  configureFlags = "--disable-ltdl-install "
-    + "--with-ltdl-include=${libtool}/include "
-    + "--with-ltdl-lib=${libtool.lib}/lib "
-    + "--enable-xpdf";
+  configureFlags = [
+    "--disable-ltdl-install"
+    "--with-ltdl-include=${libtool}/include"
+    "--with-ltdl-lib=${libtool.lib}/lib"
+    "--enable-xpdf"
+  ];
 
   # Checks need to be run after "make install", otherwise plug-ins are not in
   # the search path, etc.
diff --git a/pkgs/development/libraries/libfaketime/default.nix b/pkgs/development/libraries/libfaketime/default.nix
index cedd5f98027a..cc9db8f7e661 100644
--- a/pkgs/development/libraries/libfaketime/default.nix
+++ b/pkgs/development/libraries/libfaketime/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, bash, perl }:
 
 stdenv.mkDerivation rec {
   name = "libfaketime-${version}";
@@ -13,10 +13,20 @@ stdenv.mkDerivation rec {
     ./no-date-in-gzip-man-page.patch
   ];
 
+  postPatch = ''
+    patchShebangs test src
+    for a in test/functests/test_exclude_mono.sh src/faketime.c ; do
+      substituteInPlace $a \
+        --replace /bin/bash ${stdenv.shell}
+    done
+  '';
+
   preBuild = ''
     makeFlagsArray+=(PREFIX="$out" LIBDIRNAME=/lib)
   '';
 
+  checkInputs = [ perl ];
+
   meta = with stdenv.lib; {
     description = "Report faked system time to programs without having to change the system-wide time";
     homepage = "https://github.com/wolfcw/libfaketime/";
diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix
index 638dec302b77..d8708114c8e6 100644
--- a/pkgs/development/libraries/libgcrypt/default.nix
+++ b/pkgs/development/libraries/libgcrypt/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     ++ stdenv.lib.optional stdenv.isDarwin gettext
     ++ stdenv.lib.optional enableCapabilities libcap;
 
-  preConfigure = stdenv.lib.optionalString stdenv.isCross ''
+  preConfigure = stdenv.lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
     # This is intentional: gpg-error-config is a shell script that will work during the build
     mkdir -p "$NIX_BUILD_TOP"/bin
     ln -s ${libgpgerror.dev}/bin/gpg-error-config "$NIX_BUILD_TOP/bin"
diff --git a/pkgs/development/libraries/libglvnd/default.nix b/pkgs/development/libraries/libglvnd/default.nix
index 7e1a2b549681..27c1cb0e390a 100644
--- a/pkgs/development/libraries/libglvnd/default.nix
+++ b/pkgs/development/libraries/libglvnd/default.nix
@@ -16,11 +16,18 @@ in stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkgconfig python2 ];
   buildInputs = [ libX11 libXext glproto ];
 
+  postPatch = lib.optionalString stdenv.isDarwin ''
+    substituteInPlace src/GLX/Makefile.am \
+      --replace "-Wl,-Bsymbolic " ""
+    substituteInPlace src/EGL/Makefile.am \
+      --replace "-Wl,-Bsymbolic " ""
+  '';
+
   NIX_CFLAGS_COMPILE = [
     "-UDEFAULT_EGL_VENDOR_CONFIG_DIRS"
     # FHS paths are added so that non-NixOS applications can find vendor files.
     "-DDEFAULT_EGL_VENDOR_CONFIG_DIRS=\"${driverLink}/share/glvnd/egl_vendor.d:/etc/glvnd/egl_vendor.d:/usr/share/glvnd/egl_vendor.d\""
-  ];
+  ] ++ lib.optional stdenv.cc.isClang "-Wno-error";
 
   # Indirectly: https://bugs.freedesktop.org/show_bug.cgi?id=35268
   configureFlags  = stdenv.lib.optional stdenv.hostPlatform.isMusl "--disable-tls";
@@ -40,6 +47,6 @@ in stdenv.mkDerivation rec {
     description = "The GL Vendor-Neutral Dispatch library";
     homepage = https://github.com/NVIDIA/libglvnd;
     license = licenses.bsd2;
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/libgpod/default.nix b/pkgs/development/libraries/libgpod/default.nix
index c6056ee49fbf..74aee0f39c7e 100644
--- a/pkgs/development/libraries/libgpod/default.nix
+++ b/pkgs/development/libraries/libgpod/default.nix
@@ -25,8 +25,8 @@ in stdenv.mkDerivation rec {
   propagatedBuildInputs = [ glib libxml2 sqlite zlib sg3_utils
     gdk_pixbuf taglib libimobiledevice python pygobject2 mutagen ];
 
-  nativeBuildInputs = [ gettext perlXMLParser intltool pkgconfig perl
-    libimobiledevice.swig ] ++ lib.optionals monoSupport [ mono gtk-sharp-2_0 ];
+  nativeBuildInputs = [ gettext perlXMLParser intltool pkgconfig perl] ++
+   lib.optionals monoSupport [ mono gtk-sharp-2_0 ];
 
   meta = {
     homepage = http://gtkpod.sourceforge.net/;
diff --git a/pkgs/development/libraries/libgsf/default.nix b/pkgs/development/libraries/libgsf/default.nix
index 90daf2ddf743..20a08885142a 100644
--- a/pkgs/development/libraries/libgsf/default.nix
+++ b/pkgs/development/libraries/libgsf/default.nix
@@ -11,8 +11,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig intltool libintl ];
 
-  buildInputs = [ gettext bzip2 zlib python ]
-    ++ stdenv.lib.optional doCheck perl;
+  buildInputs = [ gettext bzip2 zlib python ];
+  checkInputs = [ perl ];
 
   propagatedBuildInputs = [ libxml2 glib gdk_pixbuf libiconv ];
 
diff --git a/pkgs/development/libraries/libimobiledevice/default.nix b/pkgs/development/libraries/libimobiledevice/default.nix
index d1b779627c69..f4eafcdaace4 100644
--- a/pkgs/development/libraries/libimobiledevice/default.nix
+++ b/pkgs/development/libraries/libimobiledevice/default.nix
@@ -1,32 +1,46 @@
-{ stdenv, fetchurl, fetchpatch, python2, pkgconfig, usbmuxd, glib, libgcrypt,
-  libtasn1, libplist, readline, libusbmuxd, openssl }:
+{ stdenv, fetchFromGitHub, automake, autoconf, libtool, pkgconfig, gnutls
+, libgcrypt, libtasn1, glib, libplist, libusbmuxd }:
 
 stdenv.mkDerivation rec {
-  name = "libimobiledevice-1.2.0";
-
-  nativeBuildInputs = [ python2 libplist.swig pkgconfig ];
-  buildInputs = [ readline ];
-  propagatedBuildInputs = [ libusbmuxd glib libgcrypt libtasn1 libplist openssl ];
-
-  patches = [
-    ./disable_sslv3.patch
-    (fetchpatch {
-      name = "CVE-2016-5104.patch";
-      url = "https://github.com/libimobiledevice/libimobiledevice/commit/df1f5c4d70d0c19ad40072f5246ca457e7f9849e.patch";
-      sha256 = "06ygb9aqcvm4v08wrldsddjgyqv5bkpq6lxzq2a1nwqp9mq4a4k1";
-    })
-  ];
+  pname = "libimobiledevice";
+  version = "2018-07-24";
 
-  postPatch = ''sed -e 's@1\.3\.21@@' -i configure'';
-  passthru.swig = libplist.swig;
+  name = "${pname}-${version}";
 
-  src = fetchurl {
-    url = "${meta.homepage}/downloads/${name}.tar.bz2";
-    sha256 = "0dqhy4qwj30mw8pwckvjmgnj1qqrh6p8c6jknmhvylshhzh0ssvq";
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = "d7a2e04d2e7880c56116fd35489a7f98755501b7";
+    sha256 = "0cj0j10lmfr28c7nh79n2mcmy31xx50g93h0bqs0l7y76ph4dqkc";
   };
 
-  meta = {
-    homepage = http://www.libimobiledevice.org;
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [
+    autoconf
+    automake
+    libtool
+    pkgconfig
+  ];
+  propagatedBuildInputs = [
+    glib
+    gnutls
+    libgcrypt
+    libplist
+    libtasn1
+    libusbmuxd
+  ];
+
+  preConfigure = "NOCONFIGURE=1 ./autogen.sh";
+
+  configureFlags = [
+    "--disable-static"
+    "--disable-openssl"
+    "--without-cython"
+  ];
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/libimobiledevice/libimobiledevice;
     description = "A software library that talks the protocols to support iPhone®, iPod Touch® and iPad® devices on Linux";
     longDescription = ''
       libimobiledevice is a software library that talks the protocols to support
@@ -38,7 +52,10 @@ stdenv.mkDerivation rec {
       installed applications, retrieve addressbook/calendars/notes and bookmarks
       and synchronize music and video to the device. The library is in
       development since August 2007 with the goal to bring support for these
-      devices to the Linux Desktop.'';
-    inherit (usbmuxd.meta) platforms maintainers;
+      devices to the Linux Desktop.
+    '';
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ ];
   };
 }
diff --git a/pkgs/development/libraries/libinput/default.nix b/pkgs/development/libraries/libinput/default.nix
index bf08db6d3b7b..5498a32e7091 100644
--- a/pkgs/development/libraries/libinput/default.nix
+++ b/pkgs/development/libraries/libinput/default.nix
@@ -16,11 +16,11 @@ in
 with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "libinput-${version}";
-  version = "1.11.0";
+  version = "1.11.3";
 
   src = fetchurl {
     url = "https://www.freedesktop.org/software/libinput/${name}.tar.xz";
-    sha256 = "04mwl1v51b785h7q3v23hahr0qzr48qq1jzj7d3msjvgh97nr8v4";
+    sha256 = "01nb1shnl871d939wgfd7nc9svclcnfjfhlq64b4yns2dvcr24gk";
   };
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/libminc/default.nix b/pkgs/development/libraries/libminc/default.nix
index ddab3439f02a..1e13f3238222 100644
--- a/pkgs/development/libraries/libminc/default.nix
+++ b/pkgs/development/libraries/libminc/default.nix
@@ -14,21 +14,26 @@ stdenv.mkDerivation rec {
     sha256 = "0mn4n3ihzcr1jw2g1vy6c8p4lkc88jwljk04argmj7k4djrgpxpa";
   };
 
+  postPatch = ''
+    patchShebangs .
+  '';
+
   nativeBuildInputs = [ cmake ];
   buildInputs = [ zlib netcdf nifticlib hdf5 ];
 
-  cmakeFlags = [ "-DBUILD_TESTING=${if doCheck then "TRUE" else "FALSE"}"
-                 "-DLIBMINC_MINC1_SUPPORT=TRUE"
-                 "-DLIBMINC_BUILD_SHARED_LIBS=TRUE"
-                 "-DLIBMINC_USE_SYSTEM_NIFTI=TRUE" ];
-
+  cmakeFlags = [
+    "-DBUILD_TESTING=${if doCheck then "ON" else "OFF"}"
+    "-DLIBMINC_MINC1_SUPPORT=ON"
+    "-DLIBMINC_BUILD_SHARED_LIBS=ON"
+    "-DLIBMINC_USE_SYSTEM_NIFTI=ON"
+  ];
 
+  doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
   checkPhase = ''
     export LD_LIBRARY_PATH="$(pwd)"  # see #22060
     ctest -E 'ezminc_rw_test|minc_conversion' --output-on-failure
     # ezminc_rw_test can't find libminc_io.so.5.2.0; minc_conversion hits netcdf compilation issue
   '';
-  doCheck = true;
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/libmp3splt/default.nix b/pkgs/development/libraries/libmp3splt/default.nix
index 7e5ac2a2297c..af8297e98549 100644
--- a/pkgs/development/libraries/libmp3splt/default.nix
+++ b/pkgs/development/libraries/libmp3splt/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ libtool ];
   buildInputs = [ libmad libid3tag ];
 
-  configureFlags = "--disable-pcre";
+  configureFlags = [ "--disable-pcre" ];
 
   meta = with stdenv.lib; {
     homepage    = https://sourceforge.net/projects/mp3splt/;
diff --git a/pkgs/development/libraries/libmspack/default.nix b/pkgs/development/libraries/libmspack/default.nix
index ef250441daba..2cb4cd3cd9bf 100644
--- a/pkgs/development/libraries/libmspack/default.nix
+++ b/pkgs/development/libraries/libmspack/default.nix
@@ -1,11 +1,11 @@
 {stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
-  name = "libmspack-0.6alpha";
+  name = "libmspack-0.7.1alpha";
 
   src = fetchurl {
     url = "https://www.cabextract.org.uk/libmspack/${name}.tar.gz";
-    sha256 = "08gr2pcinas6bdqz3k0286g5cnksmcx813skmdwyca6bmj1fxnqy";
+    sha256 = "0zn4vwzk5ankgd0l88cipan19pzbzv0sm3fba17lvqwka3dp1acp";
   };
 
   meta = {
diff --git a/pkgs/development/libraries/libndctl/default.nix b/pkgs/development/libraries/libndctl/default.nix
index 79439f822696..b53920f60b8b 100644
--- a/pkgs/development/libraries/libndctl/default.nix
+++ b/pkgs/development/libraries/libndctl/default.nix
@@ -31,6 +31,10 @@ in stdenv.mkDerivation rec {
     })
   ];
 
+  postPatch = ''
+    patchShebangs test
+  '';
+
   preAutoreconf = ''
     substituteInPlace configure.ac --replace "which" "${which}/bin/which"
     substituteInPlace git-version --replace /bin/bash ${stdenv.shell}
diff --git a/pkgs/development/libraries/liboping/default.nix b/pkgs/development/libraries/liboping/default.nix
index c177f7ba58ee..ca026811d69b 100644
--- a/pkgs/development/libraries/liboping/default.nix
+++ b/pkgs/development/libraries/liboping/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ ncurses perl ];
 
-  configureFlags = stdenv.lib.optionalString (perl == null) "--with-perl-bindings=no";
+  configureFlags = stdenv.lib.optional (perl == null) "--with-perl-bindings=no";
 
   meta = with stdenv.lib; {
     description = "C library to generate ICMP echo requests (a.k.a. ping packets)";
diff --git a/pkgs/development/libraries/libosinfo/default.nix b/pkgs/development/libraries/libosinfo/default.nix
index 0175e21bbc72..111bea61eb65 100644
--- a/pkgs/development/libraries/libosinfo/default.nix
+++ b/pkgs/development/libraries/libosinfo/default.nix
@@ -14,9 +14,9 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     pkgconfig vala intltool gobjectIntrospection gtk-doc docbook_xsl
-  ] ++ stdenv.lib.optionals doCheck checkInputs;
-  checkInputs = [ check curl perl ];
+  ];
   buildInputs = [ glib libsoup libxml2 libxslt ];
+  checkInputs = [ check curl perl ];
 
   patches = [
     ./osinfo-db-data-dir.patch
diff --git a/pkgs/development/libraries/libphonenumber/default.nix b/pkgs/development/libraries/libphonenumber/default.nix
new file mode 100644
index 000000000000..4cb327ff527b
--- /dev/null
+++ b/pkgs/development/libraries/libphonenumber/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, cmake, gmock, boost, pkgconfig, protobuf, icu }:
+
+let
+  version = "8.9.9";
+in
+stdenv.mkDerivation {
+  name = "phonenumber-${version}";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "googlei18n";
+    repo = "libphonenumber";
+    rev = "v${version}";
+    sha256 = "005visnfnr84blgdi0yp4hrzskwbsnawrzv6lqfi9f073l6w5j6w";
+  };
+
+  nativeBuildInputs = [
+    cmake
+    gmock
+    pkgconfig
+  ];
+
+  buildInputs = [
+    boost
+    protobuf
+    icu
+  ];
+
+  cmakeDir = "../cpp";
+
+  checkPhase = "./libphonenumber_test";
+
+  meta = with stdenv.lib; {
+    description = "Google's i18n library for parsing and using phone numbers";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ illegalprime ];
+  };
+}
diff --git a/pkgs/development/libraries/libplist/default.nix b/pkgs/development/libraries/libplist/default.nix
index 8dc64f2c2b57..0d6e3b8db6e0 100644
--- a/pkgs/development/libraries/libplist/default.nix
+++ b/pkgs/development/libraries/libplist/default.nix
@@ -1,31 +1,41 @@
-{ stdenv, fetchurl, pkgconfig, swig2, python2Packages, glib }:
+{ stdenv,  autoreconfHook, fetchFromGitHub, pkgconfig, python2Packages, glib }:
 
 let
   inherit (python2Packages) python cython;
-in stdenv.mkDerivation rec {
-  name = "libplist-${version}";
-  version = "2.0.0";
-
-  nativeBuildInputs = [ pkgconfig swig2 python cython ];
+in
+stdenv.mkDerivation rec {
+  pname = "libplist";
+  version = "2018-07-25";
+
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "libimobiledevice";
+    repo = pname;
+    rev = "db68a9d1070b363eee93147f072f46526064acbc";
+    sha256 = "0lxyb35jjg31m8dxhsv1jr2ccy5s19fsqzisy7lfjk46w7brs4h5";
+  };
 
-  propagatedBuildInputs = [ glib ];
+  outputs = ["bin" "dev" "out" "py"];
 
-  passthru.swig = swig2;
+  nativeBuildInputs = [
+    pkgconfig
+    python
+    cython
+    autoreconfHook
+  ];
 
-  outputs = ["bin" "dev" "out" "py"];
+  propagatedBuildInputs = [ glib ];
 
   postFixup = ''
     moveToOutput "lib/${python.libPrefix}" "$py"
   '';
 
-  src = fetchurl {
-    url = "https://www.libimobiledevice.org/downloads/${name}.tar.bz2";
-    sha256 = "00pnh9zf3iwdji2faccns7vagbmbrwbj9a8zp9s53a6rqaa9czis";
-  };
-
-  meta = {
-    homepage = https://github.com/JonathanBeck/libplist;
-    platforms = stdenv.lib.platforms.all;
+  meta = with stdenv.lib; {
+    description = "A library to handle Apple Property List format in binary or XML";
+    homepage = https://github.com/libimobiledevice/libplist;
+    license = licenses.lgpl21Plus;
     maintainers = [ ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/libpng/12.nix b/pkgs/development/libraries/libpng/12.nix
index 01a828f95da5..0153ff8327b6 100644
--- a/pkgs/development/libraries/libpng/12.nix
+++ b/pkgs/development/libraries/libpng/12.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
 
   passthru = { inherit zlib; };
 
-  configureFlags = "--enable-static";
+  configureFlags = [ "--enable-static" ];
 
   postInstall = ''mv "$out/bin" "$dev/bin"'';
 
diff --git a/pkgs/development/libraries/libpng/default.nix b/pkgs/development/libraries/libpng/default.nix
index 4173588ac522..0e5a4a866e8f 100644
--- a/pkgs/development/libraries/libpng/default.nix
+++ b/pkgs/development/libraries/libpng/default.nix
@@ -3,9 +3,7 @@
 assert zlib != null;
 
 let
-  version = "1.6.34";
   patchVersion = "1.6.34";
-  sha256 = "1xjr0v34fyjgnhvaa1zixcpx5yvxcg4zwvfh0fyklfyfj86rc7ig";
   patch_src = fetchurl {
     url = "mirror://sourceforge/libpng-apng/libpng-${patchVersion}-apng.patch.gz";
     sha256 = "1ha4npf9mfrzp0srg8a5amks5ww84xzfpjbsj8k3yjjpai798qg6";
@@ -14,10 +12,11 @@ let
 
 in stdenv.mkDerivation rec {
   name = "libpng" + whenPatched "-apng" + "-${version}";
+  version = "1.6.34";
 
   src = fetchurl {
     url = "mirror://sourceforge/libpng/libpng-${version}.tar.xz";
-    inherit sha256;
+    sha256 = "1xjr0v34fyjgnhvaa1zixcpx5yvxcg4zwvfh0fyklfyfj86rc7ig";
   };
   postPatch = whenPatched "gunzip < ${patch_src} | patch -Np1";
 
@@ -26,9 +25,7 @@ in stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ zlib ];
 
-  # it's hard to cross-run tests and some check programs didn't compile anyway
-  makeFlags = stdenv.lib.optional (!doCheck) "check_PROGRAMS=";
-  doCheck = true; # not cross;
+  doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
 
   passthru = { inherit zlib; };
 
diff --git a/pkgs/development/libraries/libpqxx/default.nix b/pkgs/development/libraries/libpqxx/default.nix
index 5c4699d26268..5afed2b2a2f5 100644
--- a/pkgs/development/libraries/libpqxx/default.nix
+++ b/pkgs/development/libraries/libpqxx/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     patchShebangs .
   '';
 
-  configureFlags = "--enable-shared";
+  configureFlags = [ "--enable-shared" ];
 
   meta = {
     description = "A C++ library to access PostgreSQL databases";
diff --git a/pkgs/development/libraries/libqalculate/default.nix b/pkgs/development/libraries/libqalculate/default.nix
index 5c7868983708..377d9fe50be7 100644
--- a/pkgs/development/libraries/libqalculate/default.nix
+++ b/pkgs/development/libraries/libqalculate/default.nix
@@ -3,13 +3,13 @@
 
 stdenv.mkDerivation rec {
   name = "libqalculate-${version}";
-  version = "2.6.0b";
+  version = "2.6.2";
 
   src = fetchFromGitHub {
     owner = "qalculate";
     repo = "libqalculate";
     rev = "v${version}";
-    sha256 = "1g0pmf33vrjabxmx6lyysgkxa6hg8qmwk0n5ncl4pr8sdkimswxw";
+    sha256 = "1wfffki5ib65z9ndph2c4a17qx62f07q12adzabs7ij9gv94y9j5";
   };
 
   outputs = [ "out" "dev" "doc" ];
diff --git a/pkgs/development/libraries/librdf/redland.nix b/pkgs/development/libraries/librdf/redland.nix
index 633611273a30..422ace462a94 100644
--- a/pkgs/development/libraries/librdf/redland.nix
+++ b/pkgs/development/libraries/librdf/redland.nix
@@ -36,6 +36,8 @@ stdenv.mkDerivation rec {
   # Fix broken DT_NEEDED in lib/redland/librdf_storage_sqlite.so.
   NIX_CFLAGS_LINK = "-lraptor2";
 
+  doCheck = false; # fails 1 out of 17 tests with a segmentation fault
+
   meta = {
     homepage = http://librdf.org/;
     platforms = stdenv.lib.platforms.unix;
diff --git a/pkgs/development/libraries/librsync/0.9.nix b/pkgs/development/libraries/librsync/0.9.nix
index 115f4cd90a0c..3ca84ed2ce5f 100644
--- a/pkgs/development/libraries/librsync/0.9.nix
+++ b/pkgs/development/libraries/librsync/0.9.nix
@@ -10,7 +10,10 @@ stdenv.mkDerivation {
 
   hardeningDisable = [ "format" ];
 
-  configureFlags = if stdenv.isCygwin then "--enable-static" else "--enable-shared";
+  configureFlags = [
+    (stdenv.lib.enableFeature stdenv.isCygwin    "static")
+    (stdenv.lib.enableFeature (!stdenv.isCygwin) "shared")
+  ];
 
   dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
 
diff --git a/pkgs/development/libraries/libseccomp/default.nix b/pkgs/development/libraries/libseccomp/default.nix
index e0c77a0cf357..c8d9e21366df 100644
--- a/pkgs/development/libraries/libseccomp/default.nix
+++ b/pkgs/development/libraries/libseccomp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, getopt, makeWrapper }:
+{ stdenv, fetchurl, getopt, makeWrapper, utillinux }:
 
 stdenv.mkDerivation rec {
   name = "libseccomp-${version}";
@@ -17,6 +17,9 @@ stdenv.mkDerivation rec {
     patchShebangs .
   '';
 
+  checkInputs = [ utillinux ];
+  doCheck = false; # dependency cycle
+
   # Hack to ensure that patchelf --shrink-rpath get rids of a $TMPDIR reference.
   preFixup = "rm -rfv src";
 
diff --git a/pkgs/development/libraries/libsecret/default.nix b/pkgs/development/libraries/libsecret/default.nix
index f311d1a03353..fde3c7a7b30e 100644
--- a/pkgs/development/libraries/libsecret/default.nix
+++ b/pkgs/development/libraries/libsecret/default.nix
@@ -1,10 +1,9 @@
 { stdenv, fetchurl, glib, pkgconfig, intltool, libxslt, docbook_xsl
 , libgcrypt, gobjectIntrospection, vala_0_38, gnome3, libintl }:
-let
+
+stdenv.mkDerivation rec {
   pname = "libsecret";
   version = "0.18.5";
-in
-stdenv.mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
@@ -12,6 +11,10 @@ stdenv.mkDerivation rec {
     sha256 = "1cychxc3ff8fp857iikw0n2s13s2mhw2dn1mr632f7w3sn6vvrww";
   };
 
+  postPatch = ''
+    patchShebangs .
+  '';
+
   outputs = [ "out" "dev" ];
 
   propagatedBuildInputs = [ glib ];
@@ -19,6 +22,10 @@ stdenv.mkDerivation rec {
   buildInputs = [ libgcrypt gobjectIntrospection vala_0_38 ];
   # optional: build docs with gtk-doc? (probably needs a flag as well)
 
+  # checkInputs = [ python2 ];
+
+  doCheck = false; # fails. with python3 tests fail to evaluate, with python2 they fail to run python3
+
   passthru = {
     updateScript = gnome3.updateScript {
       packageName = pname;
diff --git a/pkgs/development/libraries/libsoup/default.nix b/pkgs/development/libraries/libsoup/default.nix
index f9ea73089f4c..2804486e2f0a 100644
--- a/pkgs/development/libraries/libsoup/default.nix
+++ b/pkgs/development/libraries/libsoup/default.nix
@@ -3,22 +3,19 @@
 , valaSupport ? true, vala_0_40
 , intltool, python3 }:
 
-let
-  pname = "libsoup";
-  version = "2.62.2";
-in
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
+  pname = "libsoup";
+  version = "2.62.2";
 
   src = fetchurl {
     url = "mirror://gnome/sources/${pname}/${gnome3.versionBranch version}/${name}.tar.xz";
     sha256 = "1dkrz1iwsswscayfmjxqv2q00b87snlq9nxdccn5vck0vbinylwy";
   };
 
-  prePatch = ''
+  postPatch = ''
     patchShebangs libsoup/
-  '' + stdenv.lib.optionalString valaSupport
-  ''
+  '' + stdenv.lib.optionalString valaSupport ''
      substituteInPlace libsoup/Makefile.in --replace "\$(DESTDIR)\$(vapidir)" "\$(DESTDIR)\$(girdir)/../vala/vapi"
   '';
 
diff --git a/pkgs/development/libraries/libspatialite/default.nix b/pkgs/development/libraries/libspatialite/default.nix
index b75baf149e1a..8e7b539527e1 100644
--- a/pkgs/development/libraries/libspatialite/default.nix
+++ b/pkgs/development/libraries/libspatialite/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ libxml2 sqlite zlib proj geos libiconv ];
 
-  configureFlags = "--disable-freexl";
+  configureFlags = [ "--disable-freexl" ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/libtasn1/default.nix b/pkgs/development/libraries/libtasn1/default.nix
index cc5b19f7a595..5762291568ce 100644
--- a/pkgs/development/libraries/libtasn1/default.nix
+++ b/pkgs/development/libraries/libtasn1/default.nix
@@ -11,8 +11,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "devdoc" ];
   outputBin = "dev";
 
-  nativeBuildInputs = [ texinfo ];
-  buildInputs = [ perl ];
+  nativeBuildInputs = [ texinfo perl ];
 
   doCheck = true;
 
diff --git a/pkgs/development/libraries/libtensorflow/default.nix b/pkgs/development/libraries/libtensorflow/default.nix
index c8b299034fc7..e6cd140c4e4b 100644
--- a/pkgs/development/libraries/libtensorflow/default.nix
+++ b/pkgs/development/libraries/libtensorflow/default.nix
@@ -31,19 +31,19 @@ let
 
 in stdenv.mkDerivation rec {
   pname = "libtensorflow";
-  version = "1.8.0";
+  version = "1.9.0";
   name = "${pname}-${version}";
   src = fetchurl {
     url = "https://storage.googleapis.com/tensorflow/${pname}/${pname}-${tfType}-${system}-${version}.tar.gz";
     sha256 =
       if system == "linux-x86_64" then
         if cudaSupport
-        then "0m1g4sqr9as0jgfx7wlyay2nkad6wgvsyk2gvhfkqkq5sm1vbx85"
-        else "0qzy15rc3x961cyi3bqnygrcnw4x69r28xkwhpwrv1r0gi6k73ha"
+        then "1q3mh06x344im25z7r3vgrfksfdsi8fh8ldn6y2mf86h4d11yxc3"
+        else "0l9ps115ng5ffzdwphlqmj3jhidps2v5afppdzrbpzmy41xz0z21"
       else if system == "darwin-x86_64" then
         if cudaSupport
         then unavailable
-        else "0q8lmyj8l50hl6l48c640ixanvhqf2836bicyl9p2x8sj97b7y8l"
+        else "1qj0v1706w6mczycdsh38h2glyv5d25v62kdn98wxd5rw8f9v657"
       else unavailable;
   };
 
diff --git a/pkgs/development/libraries/libtiff/default.nix b/pkgs/development/libraries/libtiff/default.nix
index c5a12432280b..bf0393fd89a6 100644
--- a/pkgs/development/libraries/libtiff/default.nix
+++ b/pkgs/development/libraries/libtiff/default.nix
@@ -13,8 +13,10 @@ stdenv.mkDerivation rec {
 
   prePatch = let
       debian = fetchurl {
-        url = http://http.debian.net/debian/pool/main/t/tiff/tiff_4.0.9-5.debian.tar.xz;
-        sha256 = "15lwcsd46gini27akms2ngyxnwi1hs2yskrv5x2wazs5fw5ii62w";
+        # When the URL disappears, it typically means that Debian has new patches
+        # (probably security) and updating to new tarball will apply them as well.
+        url = http://http.debian.net/debian/pool/main/t/tiff/tiff_4.0.9-6.debian.tar.xz;
+        sha256 = "10yk5npchxscgsnd7ihd3bbbw2fxkl7ni0plm43c9q4nwp6ms52f";
       };
     in ''
       tar xf ${debian}
diff --git a/pkgs/development/libraries/libtoxcore/default.nix b/pkgs/development/libraries/libtoxcore/default.nix
index a005c8b37465..994d22846773 100644
--- a/pkgs/development/libraries/libtoxcore/default.nix
+++ b/pkgs/development/libraries/libtoxcore/default.nix
@@ -30,8 +30,6 @@ let
     enableParallelBuilding = true;
 
     doCheck = false; # hangs, tries to access the net?
-
-    # for some reason the tests are not running - it says "No tests found!!"
     checkInputs = [ check ];
     checkPhase = "ctest";
 
diff --git a/pkgs/development/libraries/liburcu/default.nix b/pkgs/development/libraries/liburcu/default.nix
index 85f8b6df2959..58da13044523 100644
--- a/pkgs/development/libraries/liburcu/default.nix
+++ b/pkgs/development/libraries/liburcu/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "01pbg67qy5hcssy2yi0ckqapzfclgdq93li2rmzw4pa3wh5j42cw";
   };
 
-  nativeBuildInputs = stdenv.lib.optional doCheck perl;
+  checkInputs = [ perl ];
 
   preCheck = "patchShebangs tests/unit";
   doCheck = true;
diff --git a/pkgs/development/libraries/libusbmuxd/default.nix b/pkgs/development/libraries/libusbmuxd/default.nix
index ae53178e88d9..08aeba1254e5 100644
--- a/pkgs/development/libraries/libusbmuxd/default.nix
+++ b/pkgs/development/libraries/libusbmuxd/default.nix
@@ -1,25 +1,26 @@
-{ stdenv, fetchurl, fetchpatch, pkgconfig, libplist }:
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, libplist }:
 
 stdenv.mkDerivation rec {
-  name = "libusbmuxd-1.0.10";
-  src = fetchurl {
-    url = "https://www.libimobiledevice.org/downloads/${name}.tar.bz2";
-    sha256 = "1wn9zq2224786mdr12c5hxad643d29wg4z6b7jn888jx4s8i78hs";
-  };
+  pname = "libusbmuxd";
+  version = "2018-07-23";
+
+  name = "${pname}-${version}";
 
-  patches = [
-    (fetchpatch {
-      name = "CVE-2016-5104.patch";
-      url = "https://github.com/libimobiledevice/libusbmuxd/commit/4397b3376dc4e4cb1c991d0aed61ce6482614196.patch";
-      sha256 = "0cl3vys7bkwbdzf64d0rz3zlqpfc30w4l7j49ljv01agh42ywhgk";
-    })
-  ];
+  src = fetchFromGitHub {
+    owner = "libimobiledevice";
+    repo = pname;
+    rev = "78df9be5fc8222ed53846cb553de9b5d24c85c6c";
+    sha256 = "05hbn0mbmv5ln9hfsvnf7i1mnp6ncbyfnl5w331kg4fi12wjshc5";
+  };
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
   buildInputs = [ libplist ];
 
-  meta = {
-    homepage = http://www.libimobiledevice.org;
-    platforms = stdenv.lib.platforms.unix;
+  meta = with stdenv.lib; {
+    description = "A client library to multiplex connections from and to iOS devices";
+    homepage    = https://github.com/libimobiledevice/libusbmuxd;
+    license     = licenses.lgpl21Plus;
+    platforms   = platforms.linux;
+    maintainers = with maintainers; [ ];
   };
 }
diff --git a/pkgs/development/libraries/libvirt/default.nix b/pkgs/development/libraries/libvirt/default.nix
index 14db7d6a1c4a..63f11daad288 100644
--- a/pkgs/development/libraries/libvirt/default.nix
+++ b/pkgs/development/libraries/libvirt/default.nix
@@ -59,10 +59,6 @@ in stdenv.mkDerivation rec {
     substituteInPlace src/lxc/lxc_conf.c \
       --replace 'lxc_path,' '"/run/libvirt/nix-emulators/libvirt_lxc",'
 
-    [ -f ${jansson}/lib/libjansson.so.4 ] || exit 1
-    substituteInPlace src/util/virjsoncompat.c \
-      --replace '"libjansson.so.4"' '"${jansson}/lib/libjansson.so.4"'
-
     patchShebangs . # fixes /usr/bin/python references
   '';
 
diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix
index aa78d0d33c08..2f0f0f1425d1 100644
--- a/pkgs/development/libraries/libxml2/default.nix
+++ b/pkgs/development/libraries/libxml2/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl
+{ stdenv, lib, fetchurl, fetchpatch
 , zlib, xz, python2, findXMLCatalogs
 , buildPlatform, hostPlatform
 , pythonSupport ? buildPlatform == hostPlatform
@@ -19,6 +19,19 @@ in stdenv.mkDerivation rec {
     sha256 = "0ci7is75bwqqw2p32vxvrk6ds51ik7qgx73m920rakv5jlayax0b";
   };
 
+  patches = [
+    (fetchpatch {
+      name = "CVE-2018-14567_CVE-2018-9251.patch";
+      url = https://gitlab.gnome.org/GNOME/libxml2/commit/2240fbf5912054af025fb6e01e26375100275e74.patch;
+      sha256 = "1xpqsfkzhrqasza51c821mnds5l317djrz8086fmzpyf68vld03h";
+    })
+    (fetchpatch {
+      name = "CVE-2018-14404.patch";
+      url = https://gitlab.gnome.org/GNOME/libxml2/commit/a436374994c47b12d5de1b8b1d191a098fa23594.patch;
+      sha256 = "19vp7p32vrninnfa7vk9ipw7n4cl1gg16xxbhjy2d0kwp1crvzqh";
+    })
+  ];
+
   outputs = [ "bin" "dev" "out" "man" "doc" ]
     ++ lib.optional pythonSupport "py"
     ++ lib.optional enableStatic "static";
@@ -32,12 +45,13 @@ in stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ zlib findXMLCatalogs ] ++ lib.optional icuSupport icu;
 
-  configureFlags =
-       lib.optional pythonSupport "--with-python=${python}"
-    ++ lib.optional icuSupport    "--with-icu"
-    ++ [ "--exec_prefix=$dev" ]
-    ++ lib.optional enableStatic "--enable-static"
-    ++ lib.optional (!enableShared) "--disable-shared";
+  configureFlags = [
+    "--exec_prefix=$dev"
+    (lib.enableFeature enableStatic "static")
+    (lib.enableFeature enableShared "shared")
+    (lib.withFeature icuSupport "icu")
+    (lib.withFeatureAs pythonSupport "python" python)
+  ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/libzip/default.nix b/pkgs/development/libraries/libzip/default.nix
index 76f5d6567dd3..50ed00711df7 100644
--- a/pkgs/development/libraries/libzip/default.nix
+++ b/pkgs/development/libraries/libzip/default.nix
@@ -9,13 +9,19 @@ stdenv.mkDerivation rec {
     sha256 = "1633dvjc08zwwhzqhnv62rjf1abx8y5njmm8y16ik9iwd07ka6d9";
   };
 
+  postPatch = ''
+    patchShebangs test-driver
+    patchShebangs man/handle_links
+  '';
+
   outputs = [ "out" "dev" ];
 
   nativeBuildInputs = [ perl ];
   propagatedBuildInputs = [ zlib ];
 
-  preInstall = ''
-    patchShebangs man/handle_links
+  preCheck = ''
+    # regress/runtests is a generated file
+    patchShebangs regress
   '';
 
   # At least mysqlWorkbench cannot find zipconf.h; I think also openoffice
diff --git a/pkgs/development/libraries/libzmf/default.nix b/pkgs/development/libraries/libzmf/default.nix
index 6050a7080df9..695effe2ea92 100644
--- a/pkgs/development/libraries/libzmf/default.nix
+++ b/pkgs/development/libraries/libzmf/default.nix
@@ -10,9 +10,9 @@ stdenv.mkDerivation rec {
     sha256 = "08mg5kmkjrmqrd8j5rkzw9vdqlvibhb1ynp6bmfxnzq5rcq1l197";
   };
 
-  buildInputs = [boost icu libpng librevenge zlib cppunit];
-  nativeBuildInputs = [doxygen pkgconfig];
-  configureFlags = " --disable-werror ";
+  buildInputs = [ boost icu libpng librevenge zlib cppunit ];
+  nativeBuildInputs = [ doxygen pkgconfig ];
+  configureFlags = [ "--disable-werror" ];
 
   meta = {
     inherit version;
diff --git a/pkgs/development/libraries/lightning/default.nix b/pkgs/development/libraries/lightning/default.nix
index 8e38b7b61927..2ad14efa3223 100644
--- a/pkgs/development/libraries/lightning/default.nix
+++ b/pkgs/development/libraries/lightning/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "0sbs2lm8b9in2m8d52zf0x9gpp40x6r7sl6sha92yq3pr78rwa4v";
   };
 
-  buildInputs = stdenv.lib.optional doCheck libopcodes;
+  checkInputs = [ libopcodes ];
 
   doCheck = true;
 
diff --git a/pkgs/development/libraries/loudmouth/default.nix b/pkgs/development/libraries/loudmouth/default.nix
index e014e38c3f97..aecd75656dae 100644
--- a/pkgs/development/libraries/loudmouth/default.nix
+++ b/pkgs/development/libraries/loudmouth/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   patches = [
   ];
 
-  configureFlags = "--with-ssl=openssl";
+  configureFlags = [ "--with-ssl=openssl" ];
 
   propagatedBuildInputs = [ openssl libidn glib zlib ];
 
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index dbcfcf19bd10..e1a9477dcd63 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -88,6 +88,7 @@ let self = stdenv.mkDerivation {
   patches = [
     ./symlink-drivers.patch
     ./missing-includes.patch # dev_t needs sys/stat.h, time_t needs time.h, etc.-- fixes build w/musl
+    ./disk_cache-include-dri-driver-path-in-cache-key.patch
   ];
 
   outputs = [ "out" "dev" "drivers" "osmesa" ];
diff --git a/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch b/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch
new file mode 100644
index 000000000000..47391567fb9b
--- /dev/null
+++ b/pkgs/development/libraries/mesa/disk_cache-include-dri-driver-path-in-cache-key.patch
@@ -0,0 +1,52 @@
+From 9c9df280b318c26aece9873cf77b32e4f95634c1 Mon Sep 17 00:00:00 2001
+From: David McFarland <corngood@gmail.com>
+Date: Mon, 6 Aug 2018 15:52:11 -0300
+Subject: [PATCH] disk_cache: include dri driver path in cache key
+
+This fixes invalid cache hits on NixOS where all shared library
+timestamps in /nix/store are zero.
+---
+ src/util/Makefile.am  | 3 +++
+ src/util/disk_cache.c | 3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/src/util/Makefile.am b/src/util/Makefile.am
+index 07bf052175..aea09f60b3 100644
+--- a/src/util/Makefile.am
++++ b/src/util/Makefile.am
+@@ -30,6 +30,9 @@ noinst_LTLIBRARIES = \
+ 	libmesautil.la \
+ 	libxmlconfig.la
+ 
++AM_CFLAGS = \
++	-DDISK_CACHE_KEY=\"$(drivers)\"
++
+ AM_CPPFLAGS = \
+ 	$(PTHREAD_CFLAGS) \
+ 	-I$(top_srcdir)/include
+diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
+index 4a762eff20..8086c0be75 100644
+--- a/src/util/disk_cache.c
++++ b/src/util/disk_cache.c
+@@ -388,8 +388,10 @@ disk_cache_create(const char *gpu_name, const char *timestamp,
+ 
+    /* Create driver id keys */
+    size_t ts_size = strlen(timestamp) + 1;
++   size_t key_size = strlen(DISK_CACHE_KEY) + 1;
+    size_t gpu_name_size = strlen(gpu_name) + 1;
+    cache->driver_keys_blob_size += ts_size;
++   cache->driver_keys_blob_size += key_size;
+    cache->driver_keys_blob_size += gpu_name_size;
+ 
+    /* We sometimes store entire structs that contains a pointers in the cache,
+@@ -410,6 +412,7 @@ disk_cache_create(const char *gpu_name, const char *timestamp,
+    uint8_t *drv_key_blob = cache->driver_keys_blob;
+    DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size)
+    DRV_KEY_CPY(drv_key_blob, timestamp, ts_size)
++   DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size)
+    DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size)
+    DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size)
+    DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size)
+-- 
+2.18.0
+
diff --git a/pkgs/development/libraries/mpir/default.nix b/pkgs/development/libraries/mpir/default.nix
index 2ecae98387e1..fe9cd6f492e5 100644
--- a/pkgs/development/libraries/mpir/default.nix
+++ b/pkgs/development/libraries/mpir/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     description = ''A highly optimised library for bignum arithmetic forked from GMP'';
     license = stdenv.lib.licenses.lgpl3Plus;
     maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.unix;
     downloadPage = "http://mpir.org/downloads.html";
     homepage = http://mpir.org/;
     updateWalker = true;
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index 0cb69f937564..861b387a993a 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -21,7 +21,9 @@ stdenv.mkDerivation rec {
     sha256 = "05qdmbmrrn88ii9f66rkcmcyzp1kb1ymkx7g040lfkd1nkp7w1da";
   };
 
-  patches = lib.optional (!stdenv.cc.isClang) ./clang.patch;
+  # The patch st-0.7.patch needs to be removed, if ncurses is upgraded in the future.
+  # It is necessary for the 6.1 version of ncurses.
+  patches = [ ./st-0.7.patch ] ++ lib.optional (!stdenv.cc.isClang) ./clang.patch;
 
   outputs = [ "out" "dev" "man" ];
   setOutputFlags = false; # some aren't supported
diff --git a/pkgs/development/libraries/ncurses/st-0.7.patch b/pkgs/development/libraries/ncurses/st-0.7.patch
new file mode 100644
index 000000000000..956f9b68d68f
--- /dev/null
+++ b/pkgs/development/libraries/ncurses/st-0.7.patch
@@ -0,0 +1,13 @@
+diff --git a/misc/terminfo.src b/misc/terminfo.src
+index 84f4810..ac300a7 100644
+--- a/misc/terminfo.src
++++ b/misc/terminfo.src
+@@ -6260,7 +6260,7 @@ st-0.7|simpleterm 0.7,
+ 	     %=%t3%e%p1%d%;m,
+ 	sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|
+ 	    %t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m,
+-	Ss=\E]52;%p1%s;%p2%s\007, kDN3=\E[1;3B, kDN5=\E[1;5B,
++	Ms=\E]52;%p1%s;%p2%s\007, kDN3=\E[1;3B, kDN5=\E[1;5B,
+ 	kLFT3=\E[1;3D, kLFT5=\E[1;5D, kNXT3=\E[6;3~,
+ 	kNXT5=\E[6;5~, kPRV3=\E[5;3~, kPRV5=\E[5;5~,
+ 	kRIT3=\E[1;3C, kRIT5=\E[1;5C, kUP3=\E[1;3A, kUP5=\E[1;5A,
diff --git a/pkgs/development/libraries/neon/0.29.nix b/pkgs/development/libraries/neon/0.29.nix
index dbde83c2d94b..d0f992efb2bc 100644
--- a/pkgs/development/libraries/neon/0.29.nix
+++ b/pkgs/development/libraries/neon/0.29.nix
@@ -28,13 +28,12 @@ stdenv.mkDerivation rec {
   buildInputs = [libxml2 openssl]
     ++ stdenv.lib.optional compressionSupport zlib;
 
-  configureFlags = ''
-    ${if shared then "--enable-shared" else "--disable-shared"}
-    ${if static then "--enable-static" else "--disable-static"}
-    ${if compressionSupport then "--with-zlib" else "--without-zlib"}
-    ${if sslSupport then "--with-ssl" else "--without-ssl"}
-    --enable-shared
-  '';
+  configureFlags = [
+    (stdenv.lib.enableFeature shared "shared")
+    (stdenv.lib.enableFeature static "static")
+    (stdenv.lib.withFeature compressionSupport "zlib")
+    (stdenv.lib.withFeature sslSupport "ssl")
+  ];
 
   passthru = {inherit compressionSupport sslSupport;};
 
diff --git a/pkgs/development/libraries/neon/default.nix b/pkgs/development/libraries/neon/default.nix
index 9c2a3265491a..7aad5be36f70 100644
--- a/pkgs/development/libraries/neon/default.nix
+++ b/pkgs/development/libraries/neon/default.nix
@@ -28,13 +28,12 @@ stdenv.mkDerivation rec {
   buildInputs = [libxml2 openssl]
     ++ stdenv.lib.optional compressionSupport zlib;
 
-  configureFlags = ''
-    ${if shared then "--enable-shared" else "--disable-shared"}
-    ${if static then "--enable-static" else "--disable-static"}
-    ${if compressionSupport then "--with-zlib" else "--without-zlib"}
-    ${if sslSupport then "--with-ssl" else "--without-ssl"}
-    --enable-shared
-  '';
+  configureFlags = [
+    (stdenv.lib.enableFeature shared "shared")
+    (stdenv.lib.enableFeature static "static")
+    (stdenv.lib.withFeature compressionSupport "zlib")
+    (stdenv.lib.withFeature sslSupport "ssl")
+  ];
 
   passthru = {inherit compressionSupport sslSupport;};
 
diff --git a/pkgs/development/libraries/netcdf/default.nix b/pkgs/development/libraries/netcdf/default.nix
index 8446a91cceca..7d0e934d911c 100644
--- a/pkgs/development/libraries/netcdf/default.nix
+++ b/pkgs/development/libraries/netcdf/default.nix
@@ -16,6 +16,15 @@ in stdenv.mkDerivation rec {
     sha256 = "0hi61cdihwwvz5jz1l7yq712j7ca1cj4bhr8x0x7c2vlb1s9biw9";
   };
 
+  postPatch = ''
+    patchShebangs .
+
+    # this test requires the net
+    for a in ncdap_test/Makefile.am ncdap_test/Makefile.in; do
+      substituteInPlace $a --replace testurl.sh " "
+    done
+  '';
+
   nativeBuildInputs = [ m4 ];
   buildInputs = [ hdf5 curl mpi ];
 
diff --git a/pkgs/development/libraries/nlohmann_json/default.nix b/pkgs/development/libraries/nlohmann_json/default.nix
index 0e9ff5d9105e..8db3a3d92ff6 100644
--- a/pkgs/development/libraries/nlohmann_json/default.nix
+++ b/pkgs/development/libraries/nlohmann_json/default.nix
@@ -15,9 +15,6 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
-  doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
-  checkTarget = "test";
-
   enableParallelBuilding = true;
 
   cmakeFlags = [
@@ -26,6 +23,8 @@ stdenv.mkDerivation rec {
     "-DCMAKE_SYSTEM_NAME=Windows"
   ];
 
+  doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
+
   meta = with stdenv.lib; {
     description = "Header only C++ library for the JSON file format";
     homepage = https://github.com/nlohmann/json;
diff --git a/pkgs/development/libraries/nlopt/default.nix b/pkgs/development/libraries/nlopt/default.nix
index 3696578b8e04..904cdc6a3daa 100644
--- a/pkgs/development/libraries/nlopt/default.nix
+++ b/pkgs/development/libraries/nlopt/default.nix
@@ -10,11 +10,18 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ octave ];
 
-  configureFlags = "--with-cxx --enable-shared --with-pic --without-guile --without-python
-  --without-matlab " +
-    stdenv.lib.optionalString (octave != null) ("--with-octave " +
-        "M_INSTALL_DIR=$(out)/${octave.sitePath}/m " +
-        "OCT_INSTALL_DIR=$(out)/${octave.sitePath}/oct ");
+  configureFlags = [
+    "--with-cxx"
+    "--enable-shared"
+    "--with-pic"
+    "--without-guile"
+    "--without-python"
+    "--without-matlab"
+  ] ++ stdenv.lib.optionals (octave != null) [
+    "--with-octave"
+    "M_INSTALL_DIR=$(out)/${octave.sitePath}/m"
+    "OCT_INSTALL_DIR=$(out)/${octave.sitePath}/oct"
+  ];
 
   meta = {
     homepage = http://ab-initio.mit.edu/nlopt/;
diff --git a/pkgs/development/libraries/nss/default.nix b/pkgs/development/libraries/nss/default.nix
index 5387272a2f05..4e9dab79e4e9 100644
--- a/pkgs/development/libraries/nss/default.nix
+++ b/pkgs/development/libraries/nss/default.nix
@@ -55,6 +55,11 @@ in stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = "-Wno-error";
 
+  # TODO(@oxij): investigate this: `make -n check` works but `make
+  # check` fails with "no rule", same for "installcheck".
+  doCheck = false;
+  doInstallCheck = false;
+
   postInstall = ''
     rm -rf $out/private
     mv $out/public $out/include
diff --git a/pkgs/development/libraries/ntl/default.nix b/pkgs/development/libraries/ntl/default.nix
index ab50cf1e17ca..96d3be41235a 100644
--- a/pkgs/development/libraries/ntl/default.nix
+++ b/pkgs/development/libraries/ntl/default.nix
@@ -20,6 +20,10 @@ stdenv.mkDerivation rec {
     sha256 = "04avzmqflx2a33n7v9jj32g83p7m6z712fg1mw308jk5ca2qp489";
   };
 
+  patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace DoConfig --replace g++ c++
+  '';
+
   buildInputs = [
     gmp
   ];
diff --git a/pkgs/development/libraries/ntrack/default.nix b/pkgs/development/libraries/ntrack/default.nix
index fb36839fe233..44c8f51e856a 100644
--- a/pkgs/development/libraries/ntrack/default.nix
+++ b/pkgs/development/libraries/ntrack/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig python ];
 
-  configureFlags = "--without-gobject CFLAGS=--std=gnu99";
+  configureFlags = [ "--without-gobject" "CFLAGS=--std=gnu99" ];
 
   # Remove this patch after version 016
   patches = [ ./libnl-fix.patch ];
diff --git a/pkgs/development/libraries/openldap/default.nix b/pkgs/development/libraries/openldap/default.nix
index 907f071d5c55..9ed555053e25 100644
--- a/pkgs/development/libraries/openldap/default.nix
+++ b/pkgs/development/libraries/openldap/default.nix
@@ -1,21 +1,13 @@
 { stdenv, fetchurl, openssl, cyrus_sasl, db, groff, libtool }:
 
 stdenv.mkDerivation rec {
-  name = "openldap-2.4.45";
+  name = "openldap-2.4.46";
 
   src = fetchurl {
     url = "https://www.openldap.org/software/download/OpenLDAP/openldap-release/${name}.tgz";
-    sha256 = "091qvwk5dkcpp17ziabcnh3rg3m7qwzw2pihfcd1d5fdxgywzmnd";
+    sha256 = "0bab1km8f2nan1x0zgwliknbxg0zlf2pafxrr867kblrdfwdr44s";
   };
 
-  patches = [
-    (fetchurl {
-      url = "https://bz-attachments.freebsd.org/attachment.cgi?id=183223";
-      sha256 = "1fiy457hrxmydybjlvn8ypzlavz22cz31q2rga07n32dh4x759r3";
-    })
-  ];
-  patchFlags = [ "-p0" ];
-
   # TODO: separate "out" and "bin"
   outputs = [ "out" "dev" "man" "devdoc" ];
 
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 35538b99060e..9f0c2b2a5b88 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -24,11 +24,19 @@ let
       ++ optional (versionOlder version "1.0.2" && hostPlatform.isDarwin)
            ./darwin-arch.patch;
 
-  postPatch = if (versionAtLeast version "1.1.0" && stdenv.hostPlatform.isMusl) then ''
-    substituteInPlace crypto/async/arch/async_posix.h \
-      --replace '!defined(__ANDROID__) && !defined(__OpenBSD__)' \
-                '!defined(__ANDROID__) && !defined(__OpenBSD__) && 0'
-  '' else null;
+    postPatch = ''
+      patchShebangs Configure
+    '' + optionalString (versionOlder version "1.1.0") ''
+      patchShebangs test/*
+      for a in test/t* ; do
+        substituteInPlace "$a" \
+          --replace /bin/rm rm
+      done
+    '' + optionalString (versionAtLeast version "1.1.0" && stdenv.hostPlatform.isMusl) ''
+      substituteInPlace crypto/async/arch/async_posix.h \
+        --replace '!defined(__ANDROID__) && !defined(__OpenBSD__)' \
+                  '!defined(__ANDROID__) && !defined(__OpenBSD__) && 0'
+    '';
 
     outputs = [ "bin" "dev" "out" "man" ];
     setOutputFlags = false;
@@ -38,6 +46,7 @@ let
     buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders;
 
     # TODO(@Ericson2314): Improve with mass rebuild
+    configurePlatforms = [];
     configureScript = {
         "x86_64-darwin"  = "./Configure darwin64-x86_64-cc";
         "x86_64-solaris" = "./Configure solaris64-x86_64-gcc";
@@ -56,13 +65,6 @@ let
           throw "Not sure what configuration to use for ${hostPlatform.config}"
       );
 
-    # TODO(@Ericson2314): Make unconditional on mass rebuild
-    ${if buildPlatform != hostPlatform then "configurePlatforms" else null} = [];
-
-    preConfigure = ''
-      patchShebangs Configure
-    '';
-
     configureFlags = [
       "shared" # "shared" builds both shared and static libraries
       "--libdir=lib"
@@ -119,16 +121,13 @@ let
 in {
 
   openssl_1_0_2 = common {
-    version = "1.0.2o";
-    sha256 = "0kcy13l701054nhpbd901mz32v1kn4g311z0nifd83xs2jbmqgzc";
+    version = "1.0.2p";
+    sha256 = "003xh9f898i56344vpvpxxxzmikivxig4xwlm7vbi7m8n43qxaah";
   };
 
   openssl_1_1_0 = common {
-    version = "1.1.0h";
-    sha256 = "05x509lccqjscgyi935z809pwfm708islypwhmjnb6cyvrn64daq";
-    patches = [
-      ./revert-relaxed-quoting.patch
-    ];
+    version = "1.1.0i";
+    sha256 = "16fgaf113p6s5ixw227sycvihh3zx6f6rf0hvjjhxk68m12cigzb";
   };
 
 }
diff --git a/pkgs/development/libraries/openssl/revert-relaxed-quoting.patch b/pkgs/development/libraries/openssl/revert-relaxed-quoting.patch
deleted file mode 100644
index ebe7c0ef26ce..000000000000
--- a/pkgs/development/libraries/openssl/revert-relaxed-quoting.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 7ee2a43069913fb7c444c656048996ea92cc465e Mon Sep 17 00:00:00 2001
-From: Richard Levitte <levitte@openssl.org>
-Date: Wed, 28 Mar 2018 14:46:27 +0200
-Subject: [PATCH] Revert "util/dofile.pl: only quote stuff that actually needs
- quoting"
-
-This wasn't a good solution, too many things depend on the quotes being
-there consistently.
-
-This reverts commit 49cd47eaababc8c57871b929080fc1357e2ad7b8.
-
-Fixes #5772
-
-Reviewed-by: Rich Salz <rsalz@openssl.org>
-(Merged from https://github.com/openssl/openssl/pull/5773)
-
-(cherry picked from commit 00701e5ea84861b74d9d624f21a6b3fcb12e8acd)
----
- util/dofile.pl | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/util/dofile.pl b/util/dofile.pl
-index fc72989b0fd..a932941cd5a 100644
---- a/util/dofile.pl
-+++ b/util/dofile.pl
-@@ -99,9 +99,9 @@ package main;
- # This adds quotes (") around the given string, and escapes any $, @, \,
- # " and ' by prepending a \ to them.
- sub quotify1 {
--    my $s = my $orig = shift @_;
-+    my $s = shift @_;
-     $s =~ s/([\$\@\\"'])/\\$1/g;
--    $s ne $orig || $s =~ /\s/ ? '"'.$s.'"' : $s;
-+    '"'.$s.'"';
- }
- 
- # quotify_l LIST
diff --git a/pkgs/development/libraries/openwsman/default.nix b/pkgs/development/libraries/openwsman/default.nix
index 1aa0f2684571..2122a7b23f1b 100644
--- a/pkgs/development/libraries/openwsman/default.nix
+++ b/pkgs/development/libraries/openwsman/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     cmakeFlags="$cmakeFlags -DPACKAGE_ARCHITECTURE=$(uname -m)";
   '';
 
-  configureFlags = "--disable-more-warnings";
+  configureFlags = [ "--disable-more-warnings" ];
 
   meta = with stdenv.lib; {
     description  = "Openwsman server implementation and client API with bindings";
diff --git a/pkgs/development/libraries/osm-gps-map/default.nix b/pkgs/development/libraries/osm-gps-map/default.nix
index febba5d5703f..b7033ea4ddf6 100644
--- a/pkgs/development/libraries/osm-gps-map/default.nix
+++ b/pkgs/development/libraries/osm-gps-map/default.nix
@@ -24,6 +24,6 @@ stdenv.mkDerivation rec {
     homepage = https://nzjrs.github.io/osm-gps-map;
     license = licenses.gpl2Plus;
     maintainers = with maintainers; [ hrdinka ];
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
   };
 }
diff --git a/pkgs/development/libraries/pango/default.nix b/pkgs/development/libraries/pango/default.nix
index a9a8c5c2563e..28f8a221700d 100644
--- a/pkgs/development/libraries/pango/default.nix
+++ b/pkgs/development/libraries/pango/default.nix
@@ -31,6 +31,8 @@ stdenv.mkDerivation rec {
 
   configureFlags = optional stdenv.isDarwin "--without-x";
 
+  doCheck = false; # fails 1 out of 12 tests with "Fontconfig error: Cannot load default config file"
+
   meta = with stdenv.lib; {
     description = "A library for laying out and rendering of text, with an emphasis on internationalization";
 
diff --git a/pkgs/development/libraries/pcre2/default.nix b/pkgs/development/libraries/pcre2/default.nix
index e0819cde679b..49357a5970c0 100644
--- a/pkgs/development/libraries/pcre2/default.nix
+++ b/pkgs/development/libraries/pcre2/default.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
 
   outputs = [ "bin" "dev" "out" "doc" "man" "devdoc" ];
 
+  doCheck = false; # fails 1 out of 3 tests, looks like a bug
+
   postFixup = ''
     moveToOutput bin/pcre2-config "$dev"
   '';
diff --git a/pkgs/development/libraries/physics/rivet/default.nix b/pkgs/development/libraries/physics/rivet/default.nix
index 8c4a9288a15b..639da1687a72 100644
--- a/pkgs/development/libraries/physics/rivet/default.nix
+++ b/pkgs/development/libraries/physics/rivet/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "rivet-${version}";
-  version = "2.6.0";
+  version = "2.6.1";
 
   src = fetchurl {
     url = "https://www.hepforge.org/archive/rivet/Rivet-${version}.tar.bz2";
-    sha256 = "007rwal8wx2k9gs0r6kym6ix0siz0x9l55q9myq41siirpf2jcpv";
+    sha256 = "08lhr10h97vqhy6ci4zna4ngx9875j32zs8ad5sy38xgbbrx3474";
   };
 
   patches = [
@@ -28,6 +28,10 @@ stdenv.mkDerivation rec {
   propagatedBuildInputs = [ fastjet ghostscript gsl yoda ];
 
   preConfigure = ''
+    substituteInPlace Makefile.in \
+      --replace "SUBDIRS = src pyext data include bin analyses doc test" "SUBDIRS = src pyext data include bin analyses test"
+    substituteInPlace analyses/Makefile.in \
+      --replace "!(tmp)" ""
     substituteInPlace bin/rivet-buildplugin.in \
       --replace '"which"' '"${which}/bin/which"' \
       --replace 'mycxx=' 'mycxx=${stdenv.cc}/bin/${if stdenv.cc.isClang or false then "clang++" else "g++"}  #' \
diff --git a/pkgs/development/libraries/physics/yoda/default.nix b/pkgs/development/libraries/physics/yoda/default.nix
index 1dacdba1b1ce..c86b0ed3d1c8 100644
--- a/pkgs/development/libraries/physics/yoda/default.nix
+++ b/pkgs/development/libraries/physics/yoda/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "yoda-${version}";
-  version = "1.7.0";
+  version = "1.7.1";
 
   src = fetchurl {
     url = "https://www.hepforge.org/archive/yoda/YODA-${version}.tar.bz2";
-    sha256 = "0fyf6ld1klzlfmr5sl1jxzck4a0h14zfkrff8397rn1fqnqbzmmk";
+    sha256 = "0yq20fnckf6h0a53ghxsgia6ikq71ch9a0w0khq188r7rlg9gmzd";
   };
 
   pythonPath = []; # python wrapper support
diff --git a/pkgs/development/libraries/pixman/default.nix b/pkgs/development/libraries/pixman/default.nix
index 2987c67ae757..af4e12a014b7 100644
--- a/pkgs/development/libraries/pixman/default.nix
+++ b/pkgs/development/libraries/pixman/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ]
     ++ stdenv.lib.optionals stdenv.cc.isClang [ autoconf automake libtool autoreconfHook ];
 
-  buildInputs = stdenv.lib.optional doCheck libpng;
+  buildInputs = [ libpng ];
 
   configureFlags = stdenv.lib.optional stdenv.isAarch32 "--disable-arm-iwmmxt";
 
diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix
index 2b5f7cacd4b3..82927664b4c1 100644
--- a/pkgs/development/libraries/polkit/default.nix
+++ b/pkgs/development/libraries/polkit/default.nix
@@ -1,49 +1,25 @@
-{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, glib, expat, pam
-, intltool, spidermonkey_17 , gobjectIntrospection, libxslt, docbook_xsl
-, docbook_xml_dtd_412, gtk-doc
+{ stdenv, fetchurl, fetchpatch, autoreconfHook, pkgconfig, glib, expat, pam, perl
+, intltool, spidermonkey_52 , gobjectIntrospection, libxslt, docbook_xsl, dbus
+, docbook_xml_dtd_412, gtk-doc, coreutils
 , useSystemd ? stdenv.isLinux, systemd
-, doCheck ? false
+, doCheck ? stdenv.isLinux
 }:
 
 let
 
-  system = "/var/run/current-system/sw";
+  system = "/run/current-system/sw";
   setuid = "/run/wrappers/bin"; #TODO: from <nixos> config.security.wrapperDir;
 
-  foolVars = {
-    SYSCONF = "/etc";
-    DATA = "${system}/share"; # to find share/polkit-1/actions of other apps at runtime
-  };
-
 in
 
 stdenv.mkDerivation rec {
-  name = "polkit-0.113";
+  name = "polkit-0.115";
 
   src = fetchurl {
     url = "https://www.freedesktop.org/software/polkit/releases/${name}.tar.gz";
-    sha256 = "109w86kfqrgz83g9ivggplmgc77rz8kx8646izvm2jb57h4rbh71";
+    sha256 = "0c91y61y4gy6p91cwbzg32dhavw4b7fflg370rimqhdxpzdfr1rg";
   };
 
-  patches = [
-    (fetchpatch {
-      url = "http://src.fedoraproject.org/cgit/rpms/polkit.git/plain/polkit-0.113-agent-leaks.patch?id=fa6fd575804de92886c95d3bc2b7eb2abcd13760";
-      sha256 = "1cxnhj0y30g7ldqq1y6zwsbdwcx7h97d3mpd3h5jy7dhg3h9ym91";
-    })
-    (fetchpatch {
-      url = "http://src.fedoraproject.org/cgit/rpms/polkit.git/plain/polkit-0.113-polkitpermission-leak.patch?id=fa6fd575804de92886c95d3bc2b7eb2abcd13760";
-      sha256 = "1h1rkd4avqyyr8q6836zzr3w10jf521gcqnvhrhzwdpgp1ay4si7";
-    })
-    (fetchpatch {
-      url = "http://src.fedoraproject.org/cgit/rpms/polkit.git/plain/polkit-0.113-itstool.patch?id=fa6fd575804de92886c95d3bc2b7eb2abcd13760";
-      sha256 = "0bxmjwp8ahy1y5g1l0kxmld0l3mlvb2l0i5n1qabia3d5iyjkyfh";
-    })
-    (fetchpatch {
-      name = "netgroup-optional.patch";
-      url = "https://bugs.freedesktop.org/attachment.cgi?id=118753";
-      sha256 = "1zq51dhmqi9zi86bj9dq4i4pxlxm41k3k4a091j07bd78cjba038";
-    })
-  ];
 
   postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
     sed -i -e "s/-Wl,--as-needed//" configure.ac
@@ -52,35 +28,34 @@ stdenv.mkDerivation rec {
   outputs = [ "bin" "dev" "out" ]; # small man pages in $bin
 
   nativeBuildInputs =
-    [ gtk-doc pkgconfig autoreconfHook intltool gobjectIntrospection ]
+    [ gtk-doc pkgconfig autoreconfHook intltool gobjectIntrospection perl ]
     ++ [ libxslt docbook_xsl docbook_xml_dtd_412 ]; # man pages
   buildInputs =
-    [ glib expat pam spidermonkey_17 gobjectIntrospection ]
+    [ glib expat pam spidermonkey_52 gobjectIntrospection ]
     ++ stdenv.lib.optional useSystemd systemd;
 
-  # Ugly hack to overwrite hardcoded directories
-  # TODO: investigate a proper patch which will be accepted upstream
-  # After update it's good to check the sources via:
-  #   grep '\<PACKAGE_' '--include=*.[ch]' -R
-  CFLAGS = stdenv.lib.concatStringsSep " "
-    ( map (var: ''-DPACKAGE_${var}_DIR=\""${builtins.getAttr var foolVars}"\"'')
-        (builtins.attrNames foolVars) );
+  NIX_CFLAGS_COMPILE = " -Wno-deprecated-declarations "; # for polkit 0.114 and glib 2.56
 
   preConfigure = ''
+    chmod +x test/mocklibc/bin/mocklibc{,-test}.in
     patchShebangs .
-  '' + stdenv.lib.optionalString useSystemd /* bogus chroot detection */ ''
-    sed '/libsystemd autoconfigured/s/.*/:/' -i configure
-  ''
+
     # ‘libpolkit-agent-1.so’ should call the setuid wrapper on
     # NixOS.  Hard-coding the path is kinda ugly.  Maybe we can just
     # call through $PATH, but that might have security implications.
-  + ''
     substituteInPlace src/polkitagent/polkitagentsession.c \
       --replace   'PACKAGE_PREFIX "/lib/polkit-1/'   '"${setuid}/'
+    substituteInPlace test/data/etc/polkit-1/rules.d/10-testing.rules \
+      --replace   /bin/true ${coreutils}/bin/true \
+      --replace   /bin/false ${coreutils}/bin/false
+
+  '' + stdenv.lib.optionalString useSystemd /* bogus chroot detection */ ''
+    sed '/libsystemd autoconfigured/s/.*/:/' -i configure
   '';
 
   configureFlags = [
-    #"--libexecdir=$(out)/libexec/polkit-1" # this and localstatedir are ignored by configure
+    "--datadir=${system}/share"
+    "--sysconfdir=/etc"
     "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
     "--with-polkitd-user=polkituser" #TODO? <nixos> config.ids.uids.polkituser
     "--with-os-type=NixOS" # not recognized but prevents impurities on non-NixOS
@@ -96,7 +71,14 @@ stdenv.mkDerivation rec {
     paxmark mr test/polkitbackend/.libs/polkitbackendjsauthoritytest
   '';
 
+  installFlags=["datadir=$(out)/share" "sysconfdir=$(out)/etc"];
+
   inherit doCheck;
+  checkInputs = [dbus];
+  checkPhase = ''
+    # tests need access to the system bus
+    dbus-run-session --config-file=${./system_bus.conf} -- sh -c 'DBUS_SYSTEM_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS make check'
+  '';
 
   meta = with stdenv.lib; {
     homepage = http://www.freedesktop.org/wiki/Software/polkit;
diff --git a/pkgs/development/libraries/polkit/system_bus.conf b/pkgs/development/libraries/polkit/system_bus.conf
new file mode 100644
index 000000000000..435b4740a2f7
--- /dev/null
+++ b/pkgs/development/libraries/polkit/system_bus.conf
@@ -0,0 +1,58 @@
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+  <!-- Our well-known bus type, do not change this -->
+  <type>system</type>
+
+  <!-- Fork into daemon mode -->
+  <fork/>
+
+  <!-- Enable logging to syslog -->
+  <syslog/>
+
+  <!-- Only allow socket-credentials-based authentication -->
+  <auth>EXTERNAL</auth>
+
+  <!-- Only listen on a local socket. (abstract=/path/to/socket 
+       means use abstract namespace, don't really create filesystem 
+       file; only Linux supports this. Use path=/whatever on other 
+       systems.) -->
+  <listen>unix:path=/tmp/system_bus_socket</listen>
+
+  <policy context="default">
+    <!-- All users can connect to system bus -->
+    <allow user="*"/>
+
+    <!-- Holes must be punched in service configuration files for
+         name ownership and sending method calls -->
+    <deny own="*"/>
+    <deny send_type="method_call"/>
+
+    <!-- Signals and reply messages (method returns, errors) are allowed
+         by default -->
+    <allow send_type="signal"/>
+    <allow send_requested_reply="true" send_type="method_return"/>
+    <allow send_requested_reply="true" send_type="error"/>
+
+    <!-- All messages may be received by default -->
+    <allow receive_type="method_call"/>
+    <allow receive_type="method_return"/>
+    <allow receive_type="error"/>
+    <allow receive_type="signal"/>
+
+    <!-- Allow anyone to talk to the message bus -->
+    <allow send_destination="org.freedesktop.DBus"
+           send_interface="org.freedesktop.DBus" />
+    <allow send_destination="org.freedesktop.DBus"
+           send_interface="org.freedesktop.DBus.Introspectable"/>
+    <!-- But disallow some specific bus services -->
+    <deny send_destination="org.freedesktop.DBus"
+          send_interface="org.freedesktop.DBus"
+          send_member="UpdateActivationEnvironment"/>
+    <deny send_destination="org.freedesktop.DBus"
+          send_interface="org.freedesktop.DBus.Debug.Stats"/>
+    <deny send_destination="org.freedesktop.DBus"
+          send_interface="org.freedesktop.systemd1.Activator"/>
+  </policy>
+
+</busconfig>
diff --git a/pkgs/development/libraries/qca2/default.nix b/pkgs/development/libraries/qca2/default.nix
index 568e7ce07b3b..ec32c44a91fc 100644
--- a/pkgs/development/libraries/qca2/default.nix
+++ b/pkgs/development/libraries/qca2/default.nix
@@ -10,16 +10,23 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ cmake pkgconfig ];
-  buildInputs = [ (stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security) qt ];
+  buildInputs = [ qt ]
+    ++ stdenv.lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
 
   enableParallelBuilding = true;
 
   # tells CMake to use this CA bundle file if it is accessible
-  preConfigure = ''export QC_CERTSTORE_PATH=/etc/ssl/certs/ca-certificates.crt'';
+  preConfigure = ''
+    export QC_CERTSTORE_PATH=/etc/ssl/certs/ca-certificates.crt
+  '';
 
   # tricks CMake into using this CA bundle file if it is not accessible (in a sandbox)
   cmakeFlags = [ "-Dqca_CERTSTORE=/etc/ssl/certs/ca-certificates.crt" ];
 
+  postPatch = ''
+    sed -i -e '1i cmake_policy(SET CMP0025 NEW)' CMakeLists.txt
+  '';
+
   meta = with stdenv.lib; {
     description = "Qt Cryptographic Architecture";
     license = "LGPL";
diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix
index 471f11ad107b..f7ddf8ff780c 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -6,7 +6,7 @@
 , buildMultimedia ? stdenv.isLinux, alsaLib, gstreamer, gst-plugins-base
 , buildWebkit ? (stdenv.isLinux || stdenv.isDarwin)
 , flashplayerFix ? false, gdk_pixbuf
-, gtkStyle ? true, gtk2
+, gtkStyle ? stdenv.hostPlatform == stdenv.buildPlatform, gtk2
 , gnomeStyle ? false, libgnomeui, GConf, gnome_vfs
 , developerBuild ? false
 , docs ? false
@@ -139,37 +139,40 @@ stdenv.mkDerivation rec {
 
   prefixKey = "-prefix ";
 
-  ${if stdenv.hostPlatform == stdenv.buildPlatform then null else "configurePlatforms"} = [];
+  configurePlatforms = [];
   configureFlags = let
+    mk = cond: name: "-${lib.optionalString (!cond) "no-"}${name}";
     platformFlag =
       if stdenv.hostPlatform != stdenv.buildPlatform
       then "-xplatform"
       else "-platform";
-    in (if stdenv.hostPlatform == stdenv.buildPlatform then ''
-      -v -no-separate-debug-info -release -fast -confirm-license -opensource
-
-      -${if stdenv.isFreeBSD then "no-" else ""}opengl -xrender -xrandr -xinerama -xcursor -xinput -xfixes -fontconfig
-      -qdbus -${if cups == null then "no-" else ""}cups -glib -dbus-linked -openssl-linked
-
-      ${if mysql != null then "-plugin" else "-no"}-sql-mysql -system-sqlite
-
-      -exceptions -xmlpatterns
-
-      -make libs -make tools -make translations
-      -${if demos then "" else "no"}make demos
-      -${if examples then "" else "no"}make examples
-      -${if docs then "" else "no"}make docs
-
-      -no-phonon ${if buildWebkit then "" else "-no"}-webkit ${if buildMultimedia then "" else "-no"}-multimedia -audio-backend
-      ${if developerBuild then "-developer-build" else ""}
-    '' else ''
-      -static -release -confirm-license -opensource
-      -no-opengl -no-phonon
-      -no-svg
-      -make qmake -make libs -nomake tools
-      -nomake demos -nomake examples -nomake docs
-    '') + lib.optionalString stdenv.hostPlatform.isDarwin "${platformFlag} unsupported/macx-clang-libc++"
-        + lib.optionalString stdenv.hostPlatform.isMinGW  "${platformFlag} win32-g++-4.6";
+  in (if stdenv.hostPlatform != stdenv.buildPlatform then [
+    # I've not tried any case other than i686-pc-mingw32.
+    # -nomake tools: it fails linking some asian language symbols
+    # -no-svg: it fails to build on mingw64
+    "-static" "-release" "-confirm-license" "-opensource"
+    "-no-opengl" "-no-phonon"
+    "-no-svg"
+    "-make" "qmake" "-make" "libs" "-nomake" "tools"
+  ] else [
+    "-v" "-no-separate-debug-info" "-release" "-fast" "-confirm-license" "-opensource"
+
+    (mk (!stdenv.isFreeBSD) "opengl") "-xrender" "-xrandr" "-xinerama" "-xcursor" "-xinput" "-xfixes" "-fontconfig"
+    "-qdbus" (mk (cups != null) "cups") "-glib" "-dbus-linked" "-openssl-linked"
+
+    "-${if mysql != null then "plugin" else "no"}-sql-mysql" "-system-sqlite"
+
+    "-exceptions" "-xmlpatterns"
+
+    "-make" "libs" "-make" "tools" "-make" "translations"
+    "-no-phonon" (mk buildWebkit "webkit") (mk buildMultimedia "multimedia") "-audio-backend"
+  ]) ++ [
+    "-${if demos then "" else "no"}make" "demos"
+    "-${if examples then "" else "no"}make" "examples"
+    "-${if docs then "" else "no"}make" "docs"
+  ] ++ lib.optional developerBuild "-developer-build"
+    ++ lib.optionals stdenv.hostPlatform.isDarwin [ platformFlag "unsupported/macx-clang-libc++" ]
+    ++ lib.optionals stdenv.hostPlatform.isWindows [ platformFlag "win32-g++-4.6" ];
 
   propagatedBuildInputs =
     [ libXrender libXrandr libXinerama libXcursor libXext libXfixes libXv libXi
@@ -219,7 +222,7 @@ stdenv.mkDerivation rec {
     cp bin/qmake* $out/bin
   '';
 
-  dontStrip = if stdenv.hostPlatform == stdenv.buildPlatform then null else true;
+  dontStrip = stdenv.hostPlatform != stdenv.buildPlatform;
 
   meta = {
     homepage    = http://qt-project.org/;
diff --git a/pkgs/development/libraries/qt-5/modules/qtwebkit.nix b/pkgs/development/libraries/qt-5/modules/qtwebkit.nix
index 62da679157f0..833433fabeca 100644
--- a/pkgs/development/libraries/qt-5/modules/qtwebkit.nix
+++ b/pkgs/development/libraries/qt-5/modules/qtwebkit.nix
@@ -17,6 +17,9 @@ let
       url = "http://dev-www.libreoffice.org/src/5ade6ae2a99bc1e9e57031ca88d36dad-${name}.tar.gz";
       sha256 = "304636d4eccd81a14b6914d07b84c79ebb815288c76fe027b9ebff6ff24d5705";
     };
+    postPatch = ''
+      patchShebangs tests
+    '';
     buildInputs = [ perl ];
   };
 in
@@ -60,6 +63,8 @@ qtModule {
       ]
     ++ optional (!stdenv.isDarwin) ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
 
+  doCheck = false; # fails 13 out of 13 tests (ctest)
+
   # Hack to avoid TMPDIR in RPATHs.
   preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
 
diff --git a/pkgs/development/libraries/rarian/default.nix b/pkgs/development/libraries/rarian/default.nix
index 484e58568721..4446226fedef 100644
--- a/pkgs/development/libraries/rarian/default.nix
+++ b/pkgs/development/libraries/rarian/default.nix
@@ -12,7 +12,7 @@ in stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ perl perlXMLParser libxml2 libxslt];
-  configureFlags = "--with-xml-catalog=${docbook_xml_dtd_42}/xml/dtd/docbook/docbook.cat";
+  configureFlags = [ "--with-xml-catalog=${docbook_xml_dtd_42}/xml/dtd/docbook/docbook.cat" ];
 
   passthru = {
     updateScript = gnome3.updateScript {
diff --git a/pkgs/development/libraries/readosm/default.nix b/pkgs/development/libraries/readosm/default.nix
index 5a4306a63a78..1c777e849a46 100644
--- a/pkgs/development/libraries/readosm/default.nix
+++ b/pkgs/development/libraries/readosm/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ expat zlib geos libspatialite ];
 
-  configureFlags = "--disable-freexl";
+  configureFlags = [ "--disable-freexl" ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/science/biology/htslib/default.nix b/pkgs/development/libraries/science/biology/htslib/default.nix
index 2144a7f78935..48548bd72652 100644
--- a/pkgs/development/libraries/science/biology/htslib/default.nix
+++ b/pkgs/development/libraries/science/biology/htslib/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ zlib bzip2 lzma curl ];
 
-  configureFlags = "--enable-libcurl"; # optional but strongly recommended
+  configureFlags = [ "--enable-libcurl" ]; # optional but strongly recommended
 
   installFlags = "prefix=$(out)";
 
diff --git a/pkgs/development/libraries/science/biology/mirtk/default.nix b/pkgs/development/libraries/science/biology/mirtk/default.nix
new file mode 100644
index 000000000000..6ecc5159a3bc
--- /dev/null
+++ b/pkgs/development/libraries/science/biology/mirtk/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, lib, gtest, fetchgit, cmake, boost, eigen, python, vtk, zlib }:
+
+stdenv.mkDerivation rec {
+  version = "2.0.0";
+  name = "mirtk-${version}";
+
+  # uses submodules so can't use fetchFromGitHub
+  src = fetchgit {
+    url = "https://github.com/BioMedIA/MIRTK.git";
+    rev = "v${version}";
+    sha256 = "0i2v97m66ir5myvi5b123r7zcagwy551b73s984gk7lksl5yiqxk";
+  };
+
+  cmakeFlags = "-DWITH_VTK=ON -DBUILD_ALL_MODULES=ON -DBUILD_TESTING=ON";
+
+  doCheck = true;
+
+  checkPhase = ''
+    ctest -E '(Polynomial|ConvolutionFunction|Downsampling|EdgeTable|InterpolateExtrapolateImage)'
+  '';
+  # testPolynomial - segfaults for some reason
+  # testConvolutionFunction, testDownsampling - main not called correctly
+  # testEdgeTable, testInterpolateExtrapolateImageFunction - setup fails
+
+  postInstall = ''
+    install -Dm644 -t "$out/share/bash-completion/completions/mirtk" share/completion/bash/mirtk
+  '';
+
+  enableParallelBuilding = true;
+
+  nativeBuildInputs = [ cmake gtest ];
+  buildInputs = [ boost eigen python vtk zlib ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/BioMedIA/MIRTK";
+    description = "Medical image registration library and tools";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.linux;
+    license = licenses.asl20;
+  };
+}
diff --git a/pkgs/development/libraries/science/biology/nifticlib/default.nix b/pkgs/development/libraries/science/biology/nifticlib/default.nix
index ae916b84ea33..19e5644b9930 100644
--- a/pkgs/development/libraries/science/biology/nifticlib/default.nix
+++ b/pkgs/development/libraries/science/biology/nifticlib/default.nix
@@ -14,6 +14,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ zlib ];
 
   checkPhase = "ctest";
+  doCheck = false; # fails 7 out of 293 tests
 
   meta = with stdenv.lib; {
     homepage = https://sourceforge.net/projects/niftilib;
diff --git a/pkgs/development/libraries/science/math/liblbfgs/default.nix b/pkgs/development/libraries/science/math/liblbfgs/default.nix
index fe90fa2e171d..33e8baada834 100644
--- a/pkgs/development/libraries/science/math/liblbfgs/default.nix
+++ b/pkgs/development/libraries/science/math/liblbfgs/default.nix
@@ -2,7 +2,7 @@
 stdenv.mkDerivation {
   name = "liblbfgs-1.10";
 
-  configureFlags = "--enable-sse2";
+  configureFlags = [ "--enable-sse2" ];
   src = fetchurl {
     url = https://github.com/downloads/chokkan/liblbfgs/liblbfgs-1.10.tar.gz;
     sha256 = "1kv8d289rbz38wrpswx5dkhr2yh4fg4h6sszkp3fawxm09sann21";
diff --git a/pkgs/development/libraries/science/math/zn_poly/default.nix b/pkgs/development/libraries/science/math/zn_poly/default.nix
index bc322d4c5341..19d63d89834e 100644
--- a/pkgs/development/libraries/science/math/zn_poly/default.nix
+++ b/pkgs/development/libraries/science/math/zn_poly/default.nix
@@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
 
   libname = "libzn_poly${stdenv.targetPlatform.extensions.sharedLibrary}";
 
+  makeFlags = [ "CC=cc" ];
+
   # Tuning (either autotuning or with hand-written paramters) is possible
   # but not implemented here.
   # It seems buggy anyways (see homepage).
@@ -45,6 +47,6 @@ stdenv.mkDerivation rec {
     description = "Polynomial arithmetic over Z/nZ";
     license = with licenses; [ gpl3 ];
     maintainers = with maintainers; [ timokau ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/silgraphite/graphite2.nix b/pkgs/development/libraries/silgraphite/graphite2.nix
index 30a99415981b..dc3f4a118f6d 100644
--- a/pkgs/development/libraries/silgraphite/graphite2.nix
+++ b/pkgs/development/libraries/silgraphite/graphite2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, freetype, cmake }:
+{ stdenv, fetchurl, pkgconfig, freetype, cmake, python }:
 
 stdenv.mkDerivation rec {
   version = "1.3.6";
@@ -15,6 +15,9 @@ stdenv.mkDerivation rec {
 
   patches = stdenv.lib.optionals stdenv.isDarwin [ ./macosx.patch ];
 
+  checkInputs = [ python ];
+  doCheck = false; # fails, probably missing something
+
   meta = {
     description = "An advanced font engine";
     maintainers = [ stdenv.lib.maintainers.raskin ];
diff --git a/pkgs/development/libraries/snack/default.nix b/pkgs/development/libraries/snack/default.nix
index 1b5564dc1590..acf10cc497c8 100644
--- a/pkgs/development/libraries/snack/default.nix
+++ b/pkgs/development/libraries/snack/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
     sha256 = "07p89jv9qnjqkszws9sssq93ayvwpdnkcxrvyicbm4mb8x2pdzjb";
   };
 
-  configureFlags = "--with-tcl=${tcl}/lib --with-tk=${tk}/lib";
+  configureFlags = [ "--with-tcl=${tcl}/lib" "--with-tk=${tk}/lib" ];
 
   postUnpack = ''sourceRoot="$sourceRoot/unix"'';
 
diff --git a/pkgs/development/libraries/spatialite-tools/default.nix b/pkgs/development/libraries/spatialite-tools/default.nix
index 9070423d8c76..4ea7de0b1a38 100644
--- a/pkgs/development/libraries/spatialite-tools/default.nix
+++ b/pkgs/development/libraries/spatialite-tools/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ sqlite expat zlib proj geos libspatialite readosm ];
 
-  configureFlags = "--disable-freexl";
+  configureFlags = [ "--disable-freexl" ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/sqlite/default.nix b/pkgs/development/libraries/sqlite/default.nix
index 41fd880769a3..166ea39493bf 100644
--- a/pkgs/development/libraries/sqlite/default.nix
+++ b/pkgs/development/libraries/sqlite/default.nix
@@ -71,6 +71,8 @@ stdenv.mkDerivation rec {
     sed -i $out/lib/libsqlite3.la -e "s/dependency_libs=.*/dependency_libs='''/"
   '';
 
+  doCheck = false; # fails to link against tcl
+
   meta = {
     description = "A self-contained, serverless, zero-configuration, transactional SQL database engine";
     downloadPage = http://sqlite.org/download.html;
diff --git a/pkgs/development/libraries/sword/default.nix b/pkgs/development/libraries/sword/default.nix
index 0c3bb3b13064..afb168d5aa2a 100644
--- a/pkgs/development/libraries/sword/default.nix
+++ b/pkgs/development/libraries/sword/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  configureFlags = "--without-conf --enable-tests=no CXXFLAGS=-Wno-unused-but-set-variable";
+  configureFlags = [ "--without-conf" "--enable-tests=no CXXFLAGS=-Wno-unused-but-set-variable" ];
 
   meta = with stdenv.lib; {
     description = "A software framework that allows research manipulation of Biblical texts";
diff --git a/pkgs/development/libraries/tachyon/darwin.patch b/pkgs/development/libraries/tachyon/darwin.patch
new file mode 100644
index 000000000000..dbede586f073
--- /dev/null
+++ b/pkgs/development/libraries/tachyon/darwin.patch
@@ -0,0 +1,31 @@
+diff --git a/unix/Make-arch b/unix/Make-arch
+index 08afb85..822c4fc 100644
+--- a/unix/Make-arch
++++ b/unix/Make-arch
+@@ -924,7 +924,7 @@ macosx-thr:
+ 	$(MAKE) all \
+ 	"ARCH = macosx-thr" \
+ 	"CC = cc" \
+-	"CFLAGS = -Os -ffast-math -DBsd -DTHR -F/System/Library/Frameworks $(MISCFLAGS)" \
++	"CFLAGS = -Os -ffast-math -DBsd -DTHR $(MISCFLAGS)" \
+ 	"AR = ar" \
+ 	"ARFLAGS = r" \
+ 	"STRIP = strip" \
+@@ -946,7 +946,7 @@ macosx-x86-thr:
+ 	$(MAKE) all \
+ 	"ARCH = macosx-x86-thr" \
+ 	"CC = cc" \
+-	"CFLAGS = -O2 -ffast-math -DBsd -DTHR -F/System/Library/Frameworks $(MISCFLAGS)" \
++	"CFLAGS = -O2 -ffast-math -DBsd -DTHR $(MISCFLAGS)" \
+ 	"AR = ar" \
+ 	"ARFLAGS = r" \
+ 	"STRIP = strip" \
+@@ -957,7 +957,7 @@ macosx-x86-thr-ogl:
+ 	$(MAKE) all \
+ 	"ARCH = macosx-x86-thr-ogl" \
+ 	"CC = cc" \
+-	"CFLAGS = -O2 -ffast-math -DBsd -DTHR -I/usr/X11R6/include -F/System/Library/Frameworks $(MISCFLAGS) -DUSEOPENGL" \
++	"CFLAGS = -O2 -ffast-math -DBsd -DTHR -I/usr/X11R6/include $(MISCFLAGS) -DUSEOPENGL" \
+ 	"AR = ar" \
+ 	"ARFLAGS = r" \
+ 	"STRIP = strip" \
diff --git a/pkgs/development/libraries/tachyon/default.nix b/pkgs/development/libraries/tachyon/default.nix
index 4f711a639f73..d5d12e44df0a 100644
--- a/pkgs/development/libraries/tachyon/default.nix
+++ b/pkgs/development/libraries/tachyon/default.nix
@@ -50,7 +50,9 @@ stdenv.mkDerivation rec {
     ./no-absolute-paths.patch
     # Include new targets (like arm)
     ./make-archs.patch
-  ];
+  ] ++
+  # Ensure looks for nix-provided Carbon, not system frameworks
+  stdenv.lib.optional stdenv.isDarwin ./darwin.patch;
 
   installPhase = ''
     cd ../compile/${arch}
@@ -66,8 +68,7 @@ stdenv.mkDerivation rec {
     description = ''A Parallel / Multiprocessor Ray Tracing System'';
     license = stdenv.lib.licenses.bsd3;
     maintainers = [stdenv.lib.maintainers.raskin];
-    # darwin fails due to missing Carbon.h, even though Carbon is a build input
-    platforms = with stdenv.lib.platforms; linux ++ cygwin;
+    platforms = with stdenv.lib.platforms; linux ++ cygwin ++ darwin;
     homepage = http://jedi.ks.uiuc.edu/~johns/tachyon/;
   };
 }
diff --git a/pkgs/development/libraries/thrift/default.nix b/pkgs/development/libraries/thrift/default.nix
index cb200b82e207..dee441a0c2f6 100644
--- a/pkgs/development/libraries/thrift/default.nix
+++ b/pkgs/development/libraries/thrift/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
   # TODO: package boost-test, so we can run the test suite. (Currently it fails
   # to find libboost_unit_test_framework.a.)
-  configureFlags = "--enable-tests=no";
+  configureFlags = [ "--enable-tests=no" ];
   doCheck = false;
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/tix/default.nix b/pkgs/development/libraries/tix/default.nix
index 7e18e7402273..232c95e6257e 100644
--- a/pkgs/development/libraries/tix/default.nix
+++ b/pkgs/development/libraries/tix/default.nix
@@ -34,13 +34,13 @@ stdenv.mkDerivation rec {
       ln -s $i private_headers/generic;
     done;
     '';
-  configureFlags = ''
-      --with-tclinclude=${tcl}/include
-      --with-tclconfig=.
-      --with-tkinclude=${tk.dev}/include
-      --with-tkconfig=.
-      --libdir=''${prefix}/lib
-    '';
+  configureFlags = [
+    "--with-tclinclude=${tcl}/include"
+    "--with-tclconfig=."
+    "--with-tkinclude=${tk.dev}/include"
+    "--with-tkconfig=."
+    "--libdir=\${prefix}/lib"
+  ];
 
   meta = with stdenv.lib; {
     description = "A widget library for Tcl/Tk";
diff --git a/pkgs/development/libraries/twolame/default.nix b/pkgs/development/libraries/twolame/default.nix
index a65254fea24e..a752da8cb57d 100644
--- a/pkgs/development/libraries/twolame/default.nix
+++ b/pkgs/development/libraries/twolame/default.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
   buildInputs = [ libsndfile ];
 
+  doCheck = false; # fails with "../build-scripts/test-driver: line 107: -Mstrict: command not found"
+
   meta = with stdenv.lib;{
     description = "A MP2 encoder";
     longDescription = ''
diff --git a/pkgs/development/libraries/uthash/default.nix b/pkgs/development/libraries/uthash/default.nix
index 9c252004656c..57a1cbf73c2c 100644
--- a/pkgs/development/libraries/uthash/default.nix
+++ b/pkgs/development/libraries/uthash/default.nix
@@ -13,9 +13,8 @@ stdenv.mkDerivation rec {
 
   dontBuild = false;
 
-  buildInputs = stdenv.lib.optional doCheck perl;
-
   doCheck = true;
+  checkInputs = [ perl ];
   checkTarget = "-C tests/";
 
   installPhase = ''
@@ -30,4 +29,3 @@ stdenv.mkDerivation rec {
     platforms   = platforms.all;
   };
 }
-
diff --git a/pkgs/development/libraries/v8/default.nix b/pkgs/development/libraries/v8/default.nix
index 099794f6623d..2b9fa5cc04c0 100644
--- a/pkgs/development/libraries/v8/default.nix
+++ b/pkgs/development/libraries/v8/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchgit, fetchFromGitHub, gyp, readline, python, which, icu
-, patchelf, coreutils, cctools
+, patchelf, coreutils, xcbuild
 , doCheck ? false
 , static ? false
 }:
@@ -124,13 +124,7 @@ stdenv.mkDerivation rec {
 
   # Patch based off of:
   # https://github.com/cowboyd/libv8/tree/v5.1.281.67.0/patches
-  patches = lib.optional (!doCheck) ./libv8-5.4.232.patch
-  ++ stdenv.lib.optionals stdenv.isDarwin [ ./no-xcode.patch ];
-
-  prePatch = ''
-    chmod +w tools/gyp/pylib/gyp
-    chmod +w tools/gyp/pylib/gyp/xcode_emulation.py
-  '';
+  patches = lib.optional (!doCheck) ./libv8-5.4.232.patch;
 
   postPatch = ''
     sed -i 's,#!/usr/bin/env python,#!${python}/bin/python,' gypfiles/gyp_v8
@@ -157,7 +151,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ which ];
   buildInputs = [ readline python icu ]
-    ++ stdenv.lib.optional stdenv.isDarwin cctools
+    ++ stdenv.lib.optional stdenv.isDarwin xcbuild
     ++ stdenv.lib.optional stdenv.isLinux patchelf;
 
   NIX_CFLAGS_COMPILE = "-Wno-error=strict-overflow -Wno-error=unused-function -Wno-error=attributes"
diff --git a/pkgs/development/libraries/v8/no-xcode.patch b/pkgs/development/libraries/v8/no-xcode.patch
deleted file mode 100644
index 5562ffaf64e1..000000000000
--- a/pkgs/development/libraries/v8/no-xcode.patch
+++ /dev/null
@@ -1,64 +0,0 @@
---- a/tools/gyp/pylib/gyp/xcode_emulation.py
-+++ a/tools/gyp/pylib/gyp/xcode_emulation.py
-@@ -473,10 +473,16 @@
- 
-   def _XcodeSdkPath(self, sdk_root):
-     if sdk_root not in XcodeSettings._sdk_path_cache:
--      sdk_path = self._GetSdkVersionInfoItem(sdk_root, '--show-sdk-path')
--      XcodeSettings._sdk_path_cache[sdk_root] = sdk_path
--      if sdk_root:
--        XcodeSettings._sdk_root_cache[sdk_path] = sdk_root
-+      try:
-+        sdk_path = self._GetSdkVersionInfoItem(sdk_root, '--show-sdk-path')
-+        XcodeSettings._sdk_path_cache[sdk_root] = sdk_path
-+        if sdk_root:
-+          XcodeSettings._sdk_root_cache[sdk_path] = sdk_root
-+      except:
-+        # if this fails it's because xcodebuild failed, which means
-+        # the user is probably on a CLT-only system, where there
-+        # is no valid SDK root
-+        XcodeSettings._sdk_path_cache[sdk_root] = None
-     return XcodeSettings._sdk_path_cache[sdk_root]
- 
-   def _AppendPlatformVersionMinFlags(self, lst):
-@@ -606,10 +612,11 @@
-       framework_root = sdk_root
-     else:
-       framework_root = ''
--    config = self.spec['configurations'][self.configname]
--    framework_dirs = config.get('mac_framework_dirs', [])
--    for directory in framework_dirs:
--      cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root))
-+    if 'SDKROOT' in self._Settings():
-+      config = self.spec['configurations'][self.configname]
-+      framework_dirs = config.get('mac_framework_dirs', [])
-+      for directory in framework_dirs:
-+        cflags.append('-F' + directory.replace('$(SDKROOT)', framework_root))
- 
-     self.configname = None
-     return cflags
-@@ -861,10 +868,11 @@
-     sdk_root = self._SdkPath()
-     if not sdk_root:
-       sdk_root = ''
--    config = self.spec['configurations'][self.configname]
--    framework_dirs = config.get('mac_framework_dirs', [])
--    for directory in framework_dirs:
--      ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
-+    if 'SDKROOT' in self._Settings():
-+      config = self.spec['configurations'][self.configname]
-+      framework_dirs = config.get('mac_framework_dirs', [])
-+      for directory in framework_dirs:
-+        ldflags.append('-F' + directory.replace('$(SDKROOT)', sdk_root))
- 
-     platform_root = self._XcodePlatformPath(configname)
-     if sdk_root and platform_root and self._IsXCTest():
-@@ -1358,7 +1366,7 @@
-     if version:
-       version = re.match(r'(\d\.\d\.?\d*)', version).groups()[0]
-     else:
--      raise GypError("No Xcode or CLT version detected!")
-+      version = "7.0.0"
-     # The CLT has no build information, so we return an empty string.
-     version_list = [version, '']
-   version = version_list[0]
diff --git a/pkgs/development/libraries/vapoursynth-mvtools/default.nix b/pkgs/development/libraries/vapoursynth-mvtools/default.nix
index 2fa6710c4faf..c2ab61c6bd17 100644
--- a/pkgs/development/libraries/vapoursynth-mvtools/default.nix
+++ b/pkgs/development/libraries/vapoursynth-mvtools/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     yasm vapoursynth fftwFloat
   ];
 
-  configureFlags = "--libdir=$(out)/lib/vapoursynth";
+  configureFlags = [ "--libdir=$(out)/lib/vapoursynth" ];
 
   meta = with stdenv.lib; {
     description = "A set of filters for motion estimation and compensation";
diff --git a/pkgs/development/libraries/vigra/default.nix b/pkgs/development/libraries/vigra/default.nix
index 14211ea65e9a..4a002becdb3b 100644
--- a/pkgs/development/libraries/vigra/default.nix
+++ b/pkgs/development/libraries/vigra/default.nix
@@ -26,6 +26,9 @@ in stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  # fails with "./test_watersheds3d: error while loading shared libraries: libvigraimpex.so.11: cannot open shared object file: No such file or directory"
+  doCheck = false;
+
   meta = with stdenv.lib; {
     description = "Novel computer vision C++ library with customizable algorithms and data structures";
     homepage = https://hci.iwr.uni-heidelberg.de/vigra;
diff --git a/pkgs/development/libraries/volume-key/default.nix b/pkgs/development/libraries/volume-key/default.nix
index a8515975c353..b91c091c6c6f 100644
--- a/pkgs/development/libraries/volume-key/default.nix
+++ b/pkgs/development/libraries/volume-key/default.nix
@@ -24,6 +24,8 @@ in stdenv.mkDerivation rec {
     "pythondir=$(py)/${python3.sitePackages}"
   ];
 
+  doCheck = false; # fails 1 out of 1 tests, needs `certutil`
+
   meta = with stdenv.lib; {
     description = "A library for manipulating storage volume encryption keys and storing them separately from volumes to handle forgotten passphrases, and the associated command-line tool";
     homepage = https://pagure.io/volume_key/;
diff --git a/pkgs/development/libraries/wayland/1.9.nix b/pkgs/development/libraries/wayland/1.9.nix
index 3555a9232285..750a786c3fca 100644
--- a/pkgs/development/libraries/wayland/1.9.nix
+++ b/pkgs/development/libraries/wayland/1.9.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     sha256 = "1yhy62vkbq8j8c9zaa6yzvn75cd99kfa8n2zfdwl80x019r711ww";
   };
 
-  configureFlags = "--with-scanner --disable-documentation";
+  configureFlags = [ "--with-scanner" "--disable-documentation" ];
 
   nativeBuildInputs = [ pkgconfig ];
 
diff --git a/pkgs/development/libraries/webkitgtk/2.20.nix b/pkgs/development/libraries/webkitgtk/2.20.nix
index 5e30b2b79318..bb493d16a369 100644
--- a/pkgs/development/libraries/webkitgtk/2.20.nix
+++ b/pkgs/development/libraries/webkitgtk/2.20.nix
@@ -15,7 +15,7 @@ assert stdenv.isDarwin -> !enableGtk2Plugins;
 with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "webkitgtk-${version}";
-  version = "2.20.4";
+  version = "2.20.5";
 
   meta = {
     description = "Web content rendering engine, GTK+ port";
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "https://webkitgtk.org/releases/${name}.tar.xz";
-    sha256 = "0cmfjbfxssgrwhgqmk7kqws91k6pha519bnyjrfsgy640max2zfc";
+    sha256 = "147r7an41920zl4x9srdva7fxvw2znjin5ldjkhay1cndv9gih0m";
   };
 
   patches = optionals stdenv.isDarwin [