summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2017-03-14 00:49:22 +0200
committerTuomas Tynkkynen <tuomas@tuxera.com>2017-03-14 00:49:22 +0200
commitaba0b45b86fa5d3bf47bca33c37f3f0211b7e052 (patch)
tree9ec0dfef6dd6253dd329d5eb85da6a52a1470238 /pkgs/development/libraries
parent8bfa9f528c88243578246798c7c2ddde045e0de0 (diff)
parent46c9eac980e1d879d62c25499544c402feff3066 (diff)
Merge remote-tracking branch 'upstream/master' into staging
Conflicts:
      pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/CGAL/default.nix18
-rw-r--r--pkgs/development/libraries/SDL2_gfx/default.nix2
-rw-r--r--pkgs/development/libraries/ace/default.nix22
-rw-r--r--pkgs/development/libraries/aqbanking/sources.nix12
-rwxr-xr-xpkgs/development/libraries/aqbanking/update.sh2
-rw-r--r--pkgs/development/libraries/assimp/default.nix10
-rw-r--r--pkgs/development/libraries/aubio/default.nix17
-rw-r--r--pkgs/development/libraries/audio/suil/default.nix4
-rw-r--r--pkgs/development/libraries/boost/generic.nix2
-rw-r--r--pkgs/development/libraries/caf/default.nix23
-rw-r--r--pkgs/development/libraries/cdk/default.nix17
-rw-r--r--pkgs/development/libraries/chipmunk/default.nix7
-rw-r--r--pkgs/development/libraries/chromaprint/default.nix4
-rw-r--r--pkgs/development/libraries/cimg/default.nix6
-rw-r--r--pkgs/development/libraries/cl/default.nix22
-rw-r--r--pkgs/development/libraries/concurrencykit/default.nix19
-rw-r--r--pkgs/development/libraries/dbus/make-session-conf.xsl3
-rw-r--r--pkgs/development/libraries/dlib/default.nix40
-rw-r--r--pkgs/development/libraries/drumstick/default.nix14
-rw-r--r--pkgs/development/libraries/eigen/default.nix2
-rw-r--r--pkgs/development/libraries/libfilezilla/default.nix4
-rw-r--r--pkgs/development/libraries/msilbc/default.nix13
-rw-r--r--pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch13
-rw-r--r--pkgs/development/libraries/phonon/backends/gstreamer.nix27
-rw-r--r--pkgs/development/libraries/qt-5/5.7/default.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths-darwin.patch384
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/default.nix108
-rw-r--r--pkgs/development/libraries/qt-5/5.7/qtbase/series1
28 files changed, 631 insertions, 169 deletions
diff --git a/pkgs/development/libraries/CGAL/default.nix b/pkgs/development/libraries/CGAL/default.nix
index b8fd4af812ab6..e4eb8d3ab2ecb 100644
--- a/pkgs/development/libraries/CGAL/default.nix
+++ b/pkgs/development/libraries/CGAL/default.nix
@@ -1,25 +1,27 @@
-{ stdenv, fetchurl, cmake, boost, gmp, mpfr, mesa_glu }:
+{ stdenv, fetchFromGitHub, cmake, boost, gmp, mpfr }:
 
 stdenv.mkDerivation rec {
-  version = "4.7";
+  version = "4.9";
   name = "cgal-" + version;
 
-  src = fetchurl {
-    url = "https://github.com/CGAL/releases/archive/CGAL-${version}.tar.gz";
-    sha256 = "1hbp4qpfqvpggvv79yxr6z3w7y0nwd31zavb1s57y55yl9z3zfxy";
+  src = fetchFromGitHub {
+    owner = "CGAL";
+    repo = "releases";
+    rev = "CGAL-${version}";
+    sha256 = "044amgml1x5h17rpkck2azmxrmjvlzzykv71cjh5hlajsi88cid5";
   };
 
   # note: optional component libCGAL_ImageIO would need zlib and opengl;
   #   there are also libCGAL_Qt{3,4} omitted ATM
-  buildInputs = [ cmake boost gmp mpfr ];
-  #propagatedBuildInputs = [ mesa_glu ];
+  buildInputs = [ boost gmp mpfr ];
+  nativeBuildInputs = [ cmake ];
 
   doCheck = false;
 
   meta = with stdenv.lib; {
     description = "Computational Geometry Algorithms Library";
     homepage = http://cgal.org;
-    license = licenses.gpl3Plus; # some parts are GPLv3+, some are LGPLv3+
+    license = with licenses; [ gpl3Plus lgpl3Plus];
     platforms = platforms.all;
     maintainers = [ maintainers.raskin ];
   };
diff --git a/pkgs/development/libraries/SDL2_gfx/default.nix b/pkgs/development/libraries/SDL2_gfx/default.nix
index 1d26fed805eba..cee0a81ccfbd0 100644
--- a/pkgs/development/libraries/SDL2_gfx/default.nix
+++ b/pkgs/development/libraries/SDL2_gfx/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ SDL2 ];
 
-  configureFlags = [ "--enable-mmx" ];
+  configureFlags = if stdenv.isi686 || stdenv.isx86_64 then "--enable-mmx" else "--disable-mmx";
 
   meta = with stdenv.lib; {
     description = "SDL graphics drawing primitives and support functions";
diff --git a/pkgs/development/libraries/ace/default.nix b/pkgs/development/libraries/ace/default.nix
index 10ba217175c3d..9bc714c5538b2 100644
--- a/pkgs/development/libraries/ace/default.nix
+++ b/pkgs/development/libraries/ace/default.nix
@@ -1,17 +1,18 @@
-{ stdenv, fetchurl, pkgconfig, libtool, perl
-}:
+{ stdenv, fetchurl, pkgconfig, libtool, perl }:
 
 stdenv.mkDerivation rec {
   name = "ace-${version}";
-  version = "6.3.3";
+  version = "6.4.2";
+
   src = fetchurl {
-    url=http://download.dre.vanderbilt.edu/previous_versions/ACE-6.3.3.tar.bz2;
-    sha256 = "124qk205v8rx8p7rfigsargrpxjx3mh4nr99nlyk9csdc9gy8qpk";
+    url = "http://download.dre.vanderbilt.edu/previous_versions/ACE-${version}.tar.bz2";
+    sha256 = "0dscvlgxy0fwma63azjkdbc85mh8k751ik67s88w6w75j0psld73";
   };
 
   enableParallelBuilding = true;
 
-  buildInputs = [ pkgconfig libtool perl ];
+  nativeBuildInputs = [ pkgconfig libtool ];
+  buildInputs = [ perl ];
 
   patchPhase = ''substituteInPlace ./MPC/prj_install.pl \
     --replace /usr/bin/perl "${perl}/bin/perl"'';
@@ -25,12 +26,11 @@ stdenv.mkDerivation rec {
     > include/makeinclude/platform_macros.GNU
   '';
 
-meta = {
+  meta = with stdenv.lib; {
     description = "ADAPTIVE Communication Environment";
     homepage = http://www.dre.vanderbilt.edu/~schmidt/ACE.html;
-    license = stdenv.lib.licenses.doc;
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.nico202 ];
+    license = licenses.doc;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.nico202 ];
   };
 }
-
diff --git a/pkgs/development/libraries/aqbanking/sources.nix b/pkgs/development/libraries/aqbanking/sources.nix
index f53d9a9e26f18..1638c72e95f5c 100644
--- a/pkgs/development/libraries/aqbanking/sources.nix
+++ b/pkgs/development/libraries/aqbanking/sources.nix
@@ -1,12 +1,12 @@
 # This file is autogenerated from update.sh in the same directory.
 {
-  gwenhywfar.version = "4.15.3";
-  gwenhywfar.sha256 = "0fp67s932x66xfljb26zbrn8ambbc5y5c3hllr6l284nr63qf3ka";
-  gwenhywfar.releaseId = "201";
+  gwenhywfar.version = "4.17.0";
+  gwenhywfar.sha256 = "1z9bm2r407x8vxk2nk6pndx0zhlk32j65z472ljkgjbh56mgzz8i";
+  gwenhywfar.releaseId = "205";
   libchipcard.version = "5.0.4";
   libchipcard.sha256 = "0fj2h39ll4kiv28ch8qgzdbdbnzs8gl812qnm660bw89rynpjnnj";
   libchipcard.releaseId = "200";
-  aqbanking.version = "5.6.10";
-  aqbanking.sha256 = "1x0isvpk43rq2zlyyb9p0kgjmqv7yq07vgkiprw3f5sjkykvxw6d";
-  aqbanking.releaseId = "206";
+  aqbanking.version = "5.6.12";
+  aqbanking.sha256 = "08jbwmiv6f3v8iqdr44x4szna496fqcjfi6mlx04cnbx91m70lh6";
+  aqbanking.releaseId = "208";
 }
diff --git a/pkgs/development/libraries/aqbanking/update.sh b/pkgs/development/libraries/aqbanking/update.sh
index 2ba0192cbb64f..8929e8bc6eb49 100755
--- a/pkgs/development/libraries/aqbanking/update.sh
+++ b/pkgs/development/libraries/aqbanking/update.sh
@@ -13,7 +13,7 @@ getCurrentVersions() {
 currentVersions="$(getCurrentVersions)"
 
 getLastestVersion() {
-    local baseurl="http://www.aquamaniac.de"
+    local baseurl="https://www.aquamaniac.de"
     local pkglist="sites/download/packages.php?package=$1&showall=1"
     local url="$baseurl/$pkglist"
     local reVersion='[0-9]+(\.[0-9]+)+' # Only release versions, no betas!
diff --git a/pkgs/development/libraries/assimp/default.nix b/pkgs/development/libraries/assimp/default.nix
index 5fbc45a7c08b2..e342d8ab6c09c 100644
--- a/pkgs/development/libraries/assimp/default.nix
+++ b/pkgs/development/libraries/assimp/default.nix
@@ -1,19 +1,17 @@
 { stdenv, fetchFromGitHub, unzip, cmake, boost, zlib }:
 
-let
-  version = "3.2";
-in
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   name = "assimp-${version}";
+  version = "3.3.1";
 
   src = fetchFromGitHub{
     owner = "assimp";
     repo = "assimp";
     rev = "v${version}";
-    sha256 = "09fsksbq9a8gykwmw6gaicwh2ladrln1jc1xc5yk7w6x180cbb1x";
+    sha256 = "13y44fymj13h6alig0nqab91j2qch0yh9gq8yql2zz744ch2s5vc";
   };
 
-  buildInputs = [ unzip cmake boost zlib ];
+  buildInputs = [ cmake boost zlib ];
 
   meta = with stdenv.lib; {
     description = "A library to import various 3D model formats";
diff --git a/pkgs/development/libraries/aubio/default.nix b/pkgs/development/libraries/aubio/default.nix
index a14de67d7f390..3ea86b36a3060 100644
--- a/pkgs/development/libraries/aubio/default.nix
+++ b/pkgs/development/libraries/aubio/default.nix
@@ -1,24 +1,23 @@
 { stdenv, fetchurl, alsaLib, fftw, libjack2, libsamplerate
-, libsndfile, pkgconfig, python2
+, libsndfile, pkgconfig, python3
 }:
 
 stdenv.mkDerivation rec {
-  name = "aubio-0.4.3";
+  name = "aubio-0.4.4";
 
   src = fetchurl {
     url = "http://aubio.org/pub/${name}.tar.bz2";
-    sha256 = "1azarklqggch8kkz3gbqwi2vlb6ld4lidyhp34qawr0c7h3xnb5n";
+    sha256 = "1y5zzwv9xjc649g4xrlqnim4q7pcwgzn0xrq3ijbmm5r4ckbkk9a";
   };
 
-  buildInputs = [
-    alsaLib fftw libjack2 libsamplerate libsndfile pkgconfig python2
-  ];
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ alsaLib fftw libjack2 libsamplerate libsndfile python3 ];
 
-  configurePhase = "${python2.interpreter} waf configure --prefix=$out";
+  configurePhase = "${python3.interpreter} waf configure --prefix=$out";
 
-  buildPhase = "${python2.interpreter} waf";
+  buildPhase = "${python3.interpreter} waf";
 
-  installPhase = "${python2.interpreter} waf install";
+  installPhase = "${python3.interpreter} waf install";
 
   meta = with stdenv.lib; {
     description = "Library for audio labelling";
diff --git a/pkgs/development/libraries/audio/suil/default.nix b/pkgs/development/libraries/audio/suil/default.nix
index 8864d710174a3..f0dbdcc7daf6b 100644
--- a/pkgs/development/libraries/audio/suil/default.nix
+++ b/pkgs/development/libraries/audio/suil/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, gtk2, lv2, pkgconfig, python, serd, sord, sratom
+{ stdenv, lib, fetchurl, gtk2, lv2, pkgconfig, python, serd, sord, sratom, gcc6
 , withQt4 ? true, qt4 ? null
 , withQt5 ? false, qt5 ? null }:
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     sha256 = "1kji3lhha26qr6xm9j8ic5c40zbrrb5qnwm2qxzmsfxgmrz29wkf";
   };
 
-  buildInputs = [ gtk2 lv2 pkgconfig python serd sord sratom ]
+  buildInputs = [ gtk2 lv2 pkgconfig python serd sord sratom gcc6 ]
     ++ (lib.optionals withQt4 [ qt4 ])
     ++ (lib.optionals withQt5 (with qt5; [ qtbase qttools ]));
 
diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix
index 6adcce45d8086..174e9fe47769f 100644
--- a/pkgs/development/libraries/boost/generic.nix
+++ b/pkgs/development/libraries/boost/generic.nix
@@ -126,7 +126,7 @@ stdenv.mkDerivation {
     description = "Collection of C++ libraries";
     license = stdenv.lib.licenses.boost;
 
-    platforms = platforms.unix;
+    platforms = (if versionOlder version "1.59" then remove "aarch64-linux" else id) platforms.unix;
     maintainers = with maintainers; [ peti wkennington ];
   };
 
diff --git a/pkgs/development/libraries/caf/default.nix b/pkgs/development/libraries/caf/default.nix
new file mode 100644
index 0000000000000..d3e655676e643
--- /dev/null
+++ b/pkgs/development/libraries/caf/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "actor-framework-${version}";
+  version = "0.15.3";
+
+  src = fetchFromGitHub {
+    owner = "actor-framework";
+    repo = "actor-framework";
+    rev = "${version}";
+    sha256 = "0202nsdriigdh6sxi1k3hddvmf1x54qpykbvf2ghfhzyh0m1q7j2";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  meta = with stdenv.lib; {
+    description = "An open source implementation of the actor model in C++";
+    homepage = http://actor-framework.org/;
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ bobakker ];
+  };
+}
diff --git a/pkgs/development/libraries/cdk/default.nix b/pkgs/development/libraries/cdk/default.nix
index 614d57002cd2f..a97ca5cc6980e 100644
--- a/pkgs/development/libraries/cdk/default.nix
+++ b/pkgs/development/libraries/cdk/default.nix
@@ -1,11 +1,8 @@
 { stdenv, fetchurl, ncurses }:
 
-let
-  version = "5.0-20160131";
-in
-stdenv.mkDerivation {
+stdenv.mkDerivation rec {
   name = "cdk-${version}";
-  inherit version;
+  version ="5.0-20161210";
 
   buildInputs = [
     ncurses
@@ -13,13 +10,13 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "ftp://invisible-island.net/cdk/cdk-${version}.tgz";
-    sha256 = "08ic2f5rmi8niaxwxwr6l6lhpan7690x52vpldnbjcf20rc0fbf3";
+    sha256 = "1bazwcwz4qhxyc8jaahdd2nlm30f5dhy0f6cnix5rjjhi35mhxcy";
   };
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Curses development kit";
-    license = stdenv.lib.licenses.bsdOriginal ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.bsdOriginal ;
+    maintainers = [ maintainers.raskin ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/chipmunk/default.nix b/pkgs/development/libraries/chipmunk/default.nix
index 52990097a2305..2c50d81380576 100644
--- a/pkgs/development/libraries/chipmunk/default.nix
+++ b/pkgs/development/libraries/chipmunk/default.nix
@@ -5,15 +5,16 @@
 stdenv.mkDerivation rec {
   name = "chipmunk-${version}";
   majorVersion = "7";
-  version = "${majorVersion}.0.0";
+  version = "${majorVersion}.0.1";
 
   src = fetchurl {
     url = "https://chipmunk-physics.net/release/Chipmunk-${majorVersion}.x/Chipmunk-${version}.tgz";
-    sha256 = "1kaii8wgvp0kgn2p22jm9smyqlws4p5dg8j23jaiasx9jq1kiaql";
+    sha256 = "0q4jwv1icz8spcjkp0v3bnygi6hq2zmnsgcxkwm8i2bxfxjb8m7y";
   };
 
+  nativeBuildInputs = [ cmake ];
   buildInputs =
-    [ cmake freeglut mesa glfw2 glew libX11 xproto inputproto libXi libXmu ];
+    [ freeglut mesa glfw2 glew libX11 xproto inputproto libXi libXmu ];
 
   postInstall = ''
     mkdir -p $out/bin
diff --git a/pkgs/development/libraries/chromaprint/default.nix b/pkgs/development/libraries/chromaprint/default.nix
index 7c3c776e81b01..09c5eeb611ba9 100644
--- a/pkgs/development/libraries/chromaprint/default.nix
+++ b/pkgs/development/libraries/chromaprint/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "chromaprint-${version}";
-  version = "1.3.1";
+  version = "1.3.2";
 
   src = fetchurl {
     url = "http://bitbucket.org/acoustid/chromaprint/downloads/${name}.tar.gz";
-    sha256 = "10dm9cfqb77g12pyjnqaw80860kzdcvskni02ll7afpywq8s15cg";
+    sha256 = "0lln8dh33gslb9cbmd1hcv33pr6jxdwipd8m8gbsyhksiq6r1by3";
   };
 
   nativeBuildInputs = [ cmake ];
diff --git a/pkgs/development/libraries/cimg/default.nix b/pkgs/development/libraries/cimg/default.nix
index 722852f12700c..a9470ee3f41bc 100644
--- a/pkgs/development/libraries/cimg/default.nix
+++ b/pkgs/development/libraries/cimg/default.nix
@@ -4,14 +4,14 @@
 stdenv.mkDerivation rec {
 
   name = "cimg-${version}";
-  version = "1.7.0";
+  version = "1.7.9";
 
   src = fetchurl {
     url = "http://cimg.eu/files/CImg_${version}.zip";
-    sha256 = "06j3n7gvgxzvprqwf56nnca195y38dcbdlszrxyn5p9w9al437zj";
+    sha256 = "07g81jn25y2wksg9ycf9a7f5bfpcdl3xbrkp1xy3czl043a00y7s";
   };
 
-  buildInputs = [ unzip ];
+  nativeBuildInputs = [ unzip ];
 
   builder = ./builder.sh;
 
diff --git a/pkgs/development/libraries/cl/default.nix b/pkgs/development/libraries/cl/default.nix
index 1fa45992aeeee..b26327dd77545 100644
--- a/pkgs/development/libraries/cl/default.nix
+++ b/pkgs/development/libraries/cl/default.nix
@@ -1,19 +1,19 @@
-{stdenv, fetchurl, SDL, mesa, rebar, erlang, opencl-headers, ocl-icd }:
+{stdenv, fetchFromGitHub, SDL, mesa, rebar, erlang, opencl-headers, ocl-icd }:
 
 stdenv.mkDerivation rec {
-  version = "1.2.1";
+  version = "1.2.3";
   name = "cl-${version}";
 
-  src = fetchurl {
-    url = "https://github.com/tonyrog/cl/archive/${name}.tar.gz";
-    sha256 = "03jv280h9gqqqkm0mmkjr53srd2mzhvyy1biss77wpjrzq2z12c8";
+  src = fetchFromGitHub {
+    owner = "tonyrog";
+    repo = "cl";
+    rev = "cl-${version}";
+    sha256 = "1dk0k03z0ipxvrnn0kihph135hriw96jpnd31lbq44k6ckh6bm03";
   };
 
   buildInputs = [ erlang rebar opencl-headers ocl-icd ];
-  #propagatedBuildInputs = [ SDL mesa ];
-
+  
   buildPhase = ''
-    sed 's/git/"${version}"/' -i src/cl.app.src
     rebar compile
   '';
 
@@ -25,10 +25,10 @@ stdenv.mkDerivation rec {
     cp -ruv c_src doc ebin include priv src $DIR
   '';
 
-  meta = {
+  meta = with stdenv.lib; {
     homepage = https://github.com/tonyrog/cl;
     description = "OpenCL binding for Erlang";
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.linux;
+    license = licenses.mit;
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/concurrencykit/default.nix b/pkgs/development/libraries/concurrencykit/default.nix
index 3fad256e5728b..29ce216cadf16 100644
--- a/pkgs/development/libraries/concurrencykit/default.nix
+++ b/pkgs/development/libraries/concurrencykit/default.nix
@@ -2,22 +2,23 @@
 
 stdenv.mkDerivation rec {
   name    = "concurrencykit-${version}";
-  version = "0.4.5";
+  version = "0.6.0";
 
   src = fetchurl {
     url    = "http://concurrencykit.org/releases/ck-${version}.tar.gz";
-    sha256 = "0mh3z8ibiwidc6qvrv8bx9slgcycxwy06kfngfzfza6nihrymzl9";
+    sha256 = "1pv21p7sjwwmbs2xblpy1lqk53r2i212yrqyjlr5dr3rlv87vqnp";
   };
+  
+  #Deleting this line causes "Unknown option --disable-static"
+  configurePhase = "./configure --prefix=$out";
 
   enableParallelBuilding = true;
 
-  configurePhase = "./configure --prefix=$out";
-
-  meta = {
+  meta = with stdenv.lib; {
     description = "A library of safe, high-performance concurrent data structures";
-    homepage    = "http://concurrencykit.org";
-    license     = stdenv.lib.licenses.bsd2;
-    platforms   = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.thoughtpolice ];
+    homepage    = http://concurrencykit.org;
+    license     = licenses.bsd2;
+    platforms   = platforms.unix;
+    maintainers = [ maintainers.thoughtpolice ];
   };
 }
diff --git a/pkgs/development/libraries/dbus/make-session-conf.xsl b/pkgs/development/libraries/dbus/make-session-conf.xsl
index bc73369af944e..9544aa13db56d 100644
--- a/pkgs/development/libraries/dbus/make-session-conf.xsl
+++ b/pkgs/development/libraries/dbus/make-session-conf.xsl
@@ -18,7 +18,8 @@
 
   <xsl:template match="/busconfig">
     <busconfig>
-      <xsl:copy-of select="child::node()[name() != 'include' and name() != 'standard_session_servicedirs' and name() != 'servicedir' and name() != 'includedir']" />
+      <!-- We leave <standard_session_servicedirs/> because it includes XDG dirs and therefore user Nix profile. -->
+      <xsl:copy-of select="child::node()[name() != 'include' and name() != 'servicedir' and name() != 'includedir']" />
 
       <xsl:for-each select="str:tokenize($serviceDirectories)">
         <servicedir><xsl:value-of select="." />/share/dbus-1/services</servicedir>
diff --git a/pkgs/development/libraries/dlib/default.nix b/pkgs/development/libraries/dlib/default.nix
index 8a24445dcca7c..fe4e7907c9fe7 100644
--- a/pkgs/development/libraries/dlib/default.nix
+++ b/pkgs/development/libraries/dlib/default.nix
@@ -1,45 +1,25 @@
-{ stdenv, fetchurl, cmake, xlibsWrapper }:
+{ stdenv, fetchFromGitHub, cmake, xlibsWrapper }:
 
 stdenv.mkDerivation rec {
-  version = "18.10";
+  version = "19.4";
   name = "dlib-${version}";
 
-  src = fetchurl {
-    url = "mirror://sourceforge/dclib/dlib/${name}.tar.bz2";
-    sha256 = "1g3v13azc29m5r7zqs3x0g731hny6spb66cxnra7f167z31ka3s7";
+  src = fetchFromGitHub {
+    owner = "davisking";
+    repo = "dlib";
+    rev ="v${version}";
+    sha256 = "0zqa36i4s5i7n6284sp22qrhm3k37n9vqmpz068nm02vj9h0a2j4";
   };
 
-  # The supplied CMakeLists.txt does not have any install targets.
-  sources_var = "\$\{sources\}";
-  headers_var = "\$\{hearders\}";
-  preConfigure = ''
-    cat << EOF > CMakeLists.txt
-    cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
-    project(dlib)
-
-    include_directories(./)
-
-    file(GLOB sources ./dlib/all/*.cpp)
-    file(GLOB headers ./dlib/*.h)
-
-    SET(LIBRARY_OUTPUT_PATH ".")
-    add_library(dlib "SHARED" dlib/all/source.cpp ${sources_var} ${headers_var})
-
-    install(TARGETS dlib DESTINATION lib)
-    install(DIRECTORY dlib/ DESTINATION include/dlib FILES_MATCHING PATTERN "*.h")
-    EOF
-  '';   
-
   enableParallelBuilding = true;
-  buildInputs = [ cmake xlibsWrapper ];
-  propagatedBuildInputs = [ xlibsWrapper ];
+  nativeBuildInputs = [ cmake ];
 
   meta = with stdenv.lib; {
     description = "A general purpose cross-platform C++ machine learning library";
     homepage = http://www.dlib.net;
-    license = stdenv.lib.licenses.boost;
+    license = licenses.boost;
     maintainers = with maintainers; [ christopherpoole ];
-    platforms = stdenv.lib.platforms.all;
+    platforms = platforms.all;
   };
 }
 
diff --git a/pkgs/development/libraries/drumstick/default.nix b/pkgs/development/libraries/drumstick/default.nix
index 809037bb5edfc..7ec72afc2bff4 100644
--- a/pkgs/development/libraries/drumstick/default.nix
+++ b/pkgs/development/libraries/drumstick/default.nix
@@ -4,11 +4,11 @@
 
 stdenv.mkDerivation rec {
   name = "drumstick-${version}";
-  version = "1.0.2";
+  version = "1.1.0";
 
   src = fetchurl {
     url = "mirror://sourceforge/drumstick/${version}/${name}.tar.bz2";
-    sha256 = "0l47gy9yywrc860db5g3wdqg8yc8qdb2lqq6wvw1dfim5j0vbail";
+    sha256 = "13pkfqrav30bbcddgf1imd7jk6lpqbxkz1qv31718pdl446jq7df";
   };
 
   outputs = [ "out" "dev" "man" ];
@@ -28,8 +28,14 @@ stdenv.mkDerivation rec {
     done
   '';
 
+  #Temporarily remove drumstick-piano; Gives segment fault. Submitted ticket
+  postInstall = ''
+    rm $out/bin/drumstick-vpiano
+    '';
+
+  nativeBuildInputs = [ cmake pkgconfig ];
   buildInputs = [
-    alsaLib cmake doxygen fluidsynth pkgconfig qt5.qtbase qt5.qtsvg
+    alsaLib doxygen fluidsynth qt5.qtbase qt5.qtsvg
   ];
 
   meta = with stdenv.lib; {
@@ -37,6 +43,6 @@ stdenv.mkDerivation rec {
     description = "MIDI libraries for Qt5/C++";
     homepage = http://drumstick.sourceforge.net/;
     license = licenses.gpl2Plus;
-    platforms = [ "x86_64-linux" ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/development/libraries/eigen/default.nix b/pkgs/development/libraries/eigen/default.nix
index c38759e0c7575..374f52c9cb062 100644
--- a/pkgs/development/libraries/eigen/default.nix
+++ b/pkgs/development/libraries/eigen/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ cmake ];
 
   postInstall = ''
-    sed -e '/Cflags:/s@''${prefix}@@' -i "$out"/share/pkgconfig/eigen3.pc
+    sed -e '/Cflags:/s@''${prefix}/@@' -i "$out"/share/pkgconfig/eigen3.pc
   '';
   
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/libfilezilla/default.nix b/pkgs/development/libraries/libfilezilla/default.nix
index 4df326e278cc6..d6c0c538a8fe2 100644
--- a/pkgs/development/libraries/libfilezilla/default.nix
+++ b/pkgs/development/libraries/libfilezilla/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "libfilezilla-${version}";
-  version = "0.9.0";
+  version = "0.9.1";
 
   src = fetchurl {
     url = "http://download.filezilla-project.org/libfilezilla/${name}.tar.bz2";
-    sha256 = "0340v5xs48f28q2d16ldb9359dkzlhl4l449mgyv3qabnlz2pl21";
+    sha256 = "06ivj40bk5b76a36zwhnwqvg564hgccncnn5nb5cqc7kf4bkkchq";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/msilbc/default.nix b/pkgs/development/libraries/msilbc/default.nix
index 1e868b79ce660..c7d65f156b8b3 100644
--- a/pkgs/development/libraries/msilbc/default.nix
+++ b/pkgs/development/libraries/msilbc/default.nix
@@ -2,18 +2,19 @@
 
 stdenv.mkDerivation rec {
   name = "msilbc-2.0.3";
-  
+
   src = fetchurl {
     url = "mirror://savannah/linphone/plugins/sources/${name}.tar.gz";
     sha256 = "125yadpc0w1q84839dadin3ahs0gxxfas0zmc4c18mjmf58dmm7d";
   };
 
-#  patchPhase = "sed -i /MS_FILTER_SET_FMTP/d ilbc.c";
-
-  propagatedBuildInputs = [ilbc mediastreamer];
+  propagatedBuildInputs = [ ilbc mediastreamer ];
+  nativeBuildInputs = [ pkgconfig ];
 
-  buildInputs = [pkgconfig];
-  configureFlags = "ILBC_LIBS=ilbc ILBC_CFLAGS=-I${ilbc}/include";
+  configureFlags = [
+    "ILBC_LIBS=ilbc" "ILBC_CFLAGS=-I${ilbc}/include"
+    "MEDIASTREAMER_LIBS=mediastreamer" "MEDIASTREAMER_CFLAGS=-I${mediastreamer}/include"
+  ];
 
   meta = {
     platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch b/pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch
new file mode 100644
index 0000000000000..39c1b9c0d2909
--- /dev/null
+++ b/pkgs/development/libraries/phonon/backends/gst-plugin-paths.patch
@@ -0,0 +1,13 @@
+Index: phonon-gstreamer-4.9.0/gstreamer/backend.cpp
+===================================================================
+--- phonon-gstreamer-4.9.0.orig/gstreamer/backend.cpp
++++ phonon-gstreamer-4.9.0/gstreamer/backend.cpp
+@@ -85,6 +85,8 @@ Backend::Backend(QObject *parent, const
+         "--gst-debug-no-color"
+     };
+ 
++    qputenv("GST_PLUGIN_PATH_1_0", GST_PLUGIN_PATH_1_0);
++
+     int argc = sizeof(args) / sizeof(*args);
+     char **argv = const_cast<char**>(args);
+     GError *err = 0;
diff --git a/pkgs/development/libraries/phonon/backends/gstreamer.nix b/pkgs/development/libraries/phonon/backends/gstreamer.nix
index d8358757094df..e0f24fbc822ab 100644
--- a/pkgs/development/libraries/phonon/backends/gstreamer.nix
+++ b/pkgs/development/libraries/phonon/backends/gstreamer.nix
@@ -29,15 +29,32 @@ stdenv.mkDerivation rec {
     sha256 = "1wc5p1rqglf0n1avp55s50k7fjdzdrhg0gind15k8796w7nfbhyf";
   };
 
+  # Hardcode paths to useful plugins so the backend doesn't depend
+  # on system paths being set.
+  patches = [ ./gst-plugin-paths.patch ];
+
+  NIX_CFLAGS_COMPILE =
+    let gstPluginPaths =
+          lib.makeSearchPathOutput "lib" "/lib/gstreamer-1.0"
+          (with gst_all_1; [
+            gstreamer
+            gst-plugins-base
+            gst-plugins-good
+            gst-plugins-ugly
+            gst-plugins-bad
+            gst-libav
+          ]);
+    in [
+      # This flag should be picked up through pkgconfig, but it isn't.
+      "-I${gst_all_1.gstreamer.dev}/lib/gstreamer-1.0/include"
+
+      ''-DGST_PLUGIN_PATH_1_0="${gstPluginPaths}"''
+    ];
+
   buildInputs = with gst_all_1;
     [ gstreamer gst-plugins-base phonon ]
     ++ (if withQt5 then [ qtbase qtx11extras ] else [ qt4 ]);
 
-  NIX_CFLAGS_COMPILE = [
-    # This flag should be picked up through pkgconfig, but it isn't.
-    "-I${gst_all_1.gstreamer.dev}/lib/gstreamer-1.0/include"
-  ];
-
   # cleanup: the build system creates (empty) $out/$out/share/icons (double prefix)
   # if DESTDIR is unset
   DESTDIR="/";
diff --git a/pkgs/development/libraries/qt-5/5.7/default.nix b/pkgs/development/libraries/qt-5/5.7/default.nix
index 85b38c6fc6ced..f468670674f0d 100644
--- a/pkgs/development/libraries/qt-5/5.7/default.nix
+++ b/pkgs/development/libraries/qt-5/5.7/default.nix
@@ -107,12 +107,12 @@ let
       makeQtWrapper =
         makeSetupHook
         { deps = [ makeWrapper ]; }
-        ../make-qt-wrapper.sh;
+        (if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh);
 
       qmakeHook =
         makeSetupHook
         { deps = [ self.qtbase.dev ]; }
-        ../qmake-hook.sh;
+        (if stdenv.isDarwin then ../qmake-hook-darwin.sh else ../qmake-hook.sh);
 
     };
 
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths-darwin.patch b/pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths-darwin.patch
new file mode 100644
index 0000000000000..2fda5ed8cf0cf
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/cmake-paths-darwin.patch
@@ -0,0 +1,384 @@
+Index: qtbase-opensource-src-5.7.1/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ qtbase-opensource-src-5.7.1/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -9,30 +9,6 @@ if (CMAKE_VERSION VERSION_LESS 3.0.0)
+ endif()
+ !!ENDIF
+ 
+-!!IF !isEmpty(CMAKE_USR_MOVE_WORKAROUND)
+-!!IF !isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ELSE
+-get_filename_component(_IMPORT_PREFIX \"${CMAKE_CURRENT_LIST_FILE}\" PATH)
+-# Use original install prefix when loaded through a
+-# cross-prefix symbolic link such as /lib -> /usr/lib.
+-get_filename_component(_realCurr \"${_IMPORT_PREFIX}\" REALPATH)
+-get_filename_component(_realOrig \"$$CMAKE_INSTALL_LIBS_DIR/cmake/Qt5$${CMAKE_MODULE_NAME}\" REALPATH)
+-if(_realCurr STREQUAL _realOrig)
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$CMAKE_INSTALL_LIBS_DIR/$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}\" ABSOLUTE)
+-else()
+-    get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-endif()
+-unset(_realOrig)
+-unset(_realCurr)
+-unset(_IMPORT_PREFIX)
+-!!ENDIF
+-!!ELIF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-get_filename_component(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE)
+-!!ELSE
+-set(_qt5$${CMAKE_MODULE_NAME}_install_prefix \"$$[QT_INSTALL_PREFIX]\")
+-!!ENDIF
+-
+ !!IF !equals(TEMPLATE, aux)
+ # For backwards compatibility only. Use Qt5$${CMAKE_MODULE_NAME}_VERSION instead.
+ set(Qt5$${CMAKE_MODULE_NAME}_VERSION_STRING "$$eval(QT.$${MODULE}.MAJOR_VERSION).$$eval(QT.$${MODULE}.MINOR_VERSION).$$eval(QT.$${MODULE}.PATCH_VERSION)")
+@@ -59,7 +35,10 @@ macro(_populate_$${CMAKE_MODULE_NAME}_ta
+     set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"@NIX_OUT@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    if(NOT EXISTS \"${imported_location}\")
++        set(imported_location \"@NIX_DEV@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    endif()
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+@@ -74,45 +53,17 @@ macro(_populate_$${CMAKE_MODULE_NAME}_ta
+         \"IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+     )
+ 
+-!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ELSE
+-    set(imported_implib \"IMPORTED_IMPLIB_${Configuration}\" \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+-!!ENDIF
+-    _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_implib})
+-    if(NOT \"${IMPLIB_LOCATION}\" STREQUAL \"\")
+-        set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+-        \"IMPORTED_IMPLIB_${Configuration}\" ${imported_implib}
+-        )
+-    endif()
+-!!ENDIF
+ endmacro()
+ !!ENDIF
+ 
+ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ 
+ !!IF !no_module_headers
+-!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Headers\"
+-    )
+-!!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+-    )
+-!!ELSE
+-    set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+-!!ENDIF
+-!!ELSE
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR\" \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
++    set(_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS \"@NIX_OUT@/lib\" \"@NIX_OUT@/lib/$${MODULE_INCNAME}.framework/Headers\")
+ !!IF isEmpty(CMAKE_NO_PRIVATE_INCLUDES)
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
++        \"\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -128,7 +80,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+ !!ENDIF
+ !!ENDIF
+-!!ENDIF
++
+ !!IF !isEmpty(CMAKE_ADD_SOURCE_INCLUDE_DIRS)
+     include(\"${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake\" OPTIONAL)
+ !!ENDIF
+@@ -253,28 +205,19 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+ 
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_DEBUG_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+-    if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+-        _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
++        \"@NIX_OUT@/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+ !!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\"
+ !!ENDIF
+       AND EXISTS
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
++        \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+ !!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+ !!ENDIF // CMAKE_DEBUG_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+@@ -282,36 +225,23 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+ !!ENDIF // CMAKE_RELEASE_TYPE
+ 
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-    _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" \"\" )
+-!!ELSE
+     _populate_$${CMAKE_MODULE_NAME}_target_properties(DEBUG \"$${CMAKE_LIB_FILE_LOCATION_DEBUG}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_DEBUG}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+ 
+ !!IF !isEmpty(CMAKE_FIND_OTHER_LIBRARY_BUILD)
+ !!IF isEmpty(CMAKE_RELEASE_TYPE)
+-!!IF !isEmpty(CMAKE_STATIC_WINDOWS_BUILD)
+-!!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    if (EXISTS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ELSE // CMAKE_LIB_DIR_IS_ABSOLUTE
+-    if (EXISTS \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_LIB_DIR_IS_ABSOLUTE
+-        _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" \"\" )
+-!!ELSE // CMAKE_STATIC_WINDOWS_BUILD
+     if (EXISTS
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
++        \"@NIX_OUT@/$${CMAKE_DLL_DIR}$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+ !!ELSE
+         \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\"
+ !!ENDIF
+       AND EXISTS
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
++        \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ELSE
+         \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+ !!ENDIF
+         _populate_$${CMAKE_MODULE_NAME}_target_properties(RELEASE \"$${CMAKE_LIB_FILE_LOCATION_RELEASE}\" \"$${CMAKE_IMPLIB_FILE_LOCATION_RELEASE}\" )
+-!!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+ !!ENDIF // CMAKE_RELEASE_TYPE
+ !!ENDIF // CMAKE_FIND_OTHER_LIBRARY_BUILD
+@@ -328,11 +258,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
+     macro(_populate_$${CMAKE_MODULE_NAME}_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-!!IF isEmpty(CMAKE_PLUGIN_DIR_IS_ABSOLUTE)
+-        set(imported_location \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ELSE
+-        set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
+-!!ENDIF
++        set(imported_location \"${PLUGIN_LOCATION}\")
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+Index: qtbase-opensource-src-5.7.1/src/gui/Qt5GuiConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/gui/Qt5GuiConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.1/src/gui/Qt5GuiConfigExtras.cmake.in
+@@ -2,7 +2,7 @@
+ !!IF !isEmpty(CMAKE_ANGLE_EGL_DLL_RELEASE)
+ 
+ !!IF isEmpty(CMAKE_INCLUDE_DIR_IS_ABSOLUTE)
+-set(Qt5Gui_EGL_INCLUDE_DIRS \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$$CMAKE_INCLUDE_DIR/QtANGLE\")
++set(Qt5Gui_EGL_INCLUDE_DIRS \"@NIX_DEV@/$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ELSE
+ set(Qt5Gui_EGL_INCLUDE_DIRS \"$$CMAKE_INCLUDE_DIR/QtANGLE\")
+ !!ENDIF
+@@ -17,13 +17,13 @@ macro(_populate_qt5gui_gl_target_propert
+     set_property(TARGET Qt5::${TargetName} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+ !!IF isEmpty(CMAKE_DLL_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Gui_install_prefix}/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
++    set(imported_location \"@NIX_OUT@/$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+ !!ENDIF
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_implib \"${_qt5Gui_install_prefix}/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
++    set(imported_implib \"@NIX_DEV@/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/widgets/Qt5WidgetsConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.1/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::uic)
+     add_executable(Qt5::uic IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qmake)
+     add_executable(Qt5::qmake IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qmake$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::moc)
+     add_executable(Qt5::moc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}moc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -35,7 +35,7 @@ if (NOT TARGET Qt5::rcc)
+     add_executable(Qt5::rcc IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -131,7 +131,7 @@ if (NOT TARGET Qt5::WinMain)
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ENDIF
+@@ -145,7 +145,7 @@ if (NOT TARGET Qt5::WinMain)
+     set_property(TARGET Qt5::WinMain APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ 
+ !!IF isEmpty(CMAKE_LIB_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Core_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
++++ qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_INSTALL_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"@NIX_DEV@/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
++++ qtbase-opensource-src-5.7.1/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+@@ -1,6 +1,6 @@
+ 
+ !!IF isEmpty(CMAKE_HOST_DATA_DIR_IS_ABSOLUTE)
+-set(_qt5_corelib_extra_includes \"${_qt5Core_install_prefix}/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
++set(_qt5_corelib_extra_includes \"@NIX_DEV@/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/src/dbus/Qt5DBusConfigExtras.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/src/dbus/Qt5DBusConfigExtras.cmake.in
++++ qtbase-opensource-src-5.7.1/src/dbus/Qt5DBusConfigExtras.cmake.in
+@@ -3,7 +3,7 @@ if (NOT TARGET Qt5::qdbuscpp2xml)
+     add_executable(Qt5::qdbuscpp2xml IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -18,7 +18,7 @@ if (NOT TARGET Qt5::qdbusxml2cpp)
+     add_executable(Qt5::qdbusxml2cpp IMPORTED)
+ 
+ !!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5DBus_install_prefix}/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
++    set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+Index: qtbase-opensource-src-5.7.1/mkspecs/features/create_cmake.prf
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/mkspecs/features/create_cmake.prf
++++ qtbase-opensource-src-5.7.1/mkspecs/features/create_cmake.prf
+@@ -136,28 +136,28 @@ contains(CONFIG, plugin) {
+ 
+     win32 {
+         isEmpty(CMAKE_STATIC_TYPE) {
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.dll
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.dll
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}.dll
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}d.dll
+         } else:mingw {
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}.a
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}d.a
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}/$$PLUGIN_TYPE/lib$${TARGET}.a
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}d.a
+         } else {                         # MSVC static
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${TARGET}.lib
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${TARGET}d.lib
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}.lib
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/$${TARGET}d.lib
+         }
+     } else {
+         mac {
+             isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .dylib
+             else: CMAKE_PlUGIN_EXT = .a
+ 
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+         } else {
+             isEmpty(CMAKE_STATIC_TYPE): CMAKE_PlUGIN_EXT = .so
+             else: CMAKE_PlUGIN_EXT = .a
+ 
+-            CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+-            CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_RELEASE = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
++            CMAKE_PLUGIN_LOCATION_DEBUG = $${CMAKE_PLUGIN_DIR}$$PLUGIN_TYPE/lib$${TARGET}$${CMAKE_PlUGIN_EXT}
+         }
+     }
+     cmake_target_file.input = $$PWD/data/cmake/Qt5PluginTarget.cmake.in
+Index: qtbase-opensource-src-5.7.1/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+===================================================================
+--- qtbase-opensource-src-5.7.1.orig/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ qtbase-opensource-src-5.7.1/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -2,10 +2,10 @@
+ add_library(Qt5::$$CMAKE_PLUGIN_NAME MODULE IMPORTED)
+ 
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"@NIX_OUT@/$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"@NIX_OUT@/$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+ !!ENDIF
+ 
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
index 73df6726f4a7c..57b64bca1eabc 100644
--- a/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/default.nix
@@ -4,6 +4,7 @@
 
   coreutils, bison, flex, gdb, gperf, lndir, patchelf, perl, pkgconfig, python2,
   ruby,
+  darwin, libiconv,
 
   dbus, fontconfig, freetype, glib, gtk3, harfbuzz, icu, libX11, libXcomposite,
   libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng, libtiff,
@@ -15,7 +16,8 @@
   cups ? null, mysql ? null, postgresql ? null,
 
   # options
-  mesaSupported, mesa,
+  mesaSupported ? (!stdenv.isDarwin),
+  mesa,
   buildExamples ? false,
   buildTests ? false,
   developerBuild ? false,
@@ -35,6 +37,7 @@ stdenv.mkDerivation {
 
   patches =
     copyPathsToStore (lib.readPathsFromFile ./. ./series)
+    ++ [(if stdenv.isDarwin then ./cmake-paths-darwin.patch else ./cmake-paths.patch)]
     ++ lib.optional decryptSslTraffic ./decrypt-ssl-traffic.patch
     ++ lib.optional mesaSupported [ ./dlopen-gl.patch ./mkspecs-libgl.patch ];
 
@@ -54,11 +57,11 @@ stdenv.mkDerivation {
       substituteInPlace src/network/kernel/qhostinfo_unix.cpp \
         --replace "@glibc@" "${stdenv.cc.libc.out}"
 
-      substituteInPlace src/plugins/platforms/xcb/qxcbcursor.cpp \
-        --replace "@libXcursor@" "${libXcursor.out}"
-
       substituteInPlace src/network/ssl/qsslsocket_openssl_symbols.cpp \
         --replace "@openssl@" "${openssl.out}"
+    '' + lib.optionalString stdenv.isLinux ''
+      substituteInPlace src/plugins/platforms/xcb/qxcbcursor.cpp \
+        --replace "@libXcursor@" "${libXcursor.out}"
 
       substituteInPlace src/dbus/qdbus_symbols.cpp \
         --replace "@dbus_libs@" "${dbus.lib}"
@@ -74,8 +77,23 @@ stdenv.mkDerivation {
       substituteInPlace mkspecs/common/linux.conf \
         --replace "@mesa_lib@" "${mesa.out}" \
         --replace "@mesa_inc@" "${mesa.dev or mesa}"
-    '';
-
+    ''+ lib.optionalString stdenv.isDarwin ''
+      sed -i \
+          -e 's|! /usr/bin/xcode-select --print-path >/dev/null 2>&1;|false;|' \
+          -e 's|! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1;|false;|' \
+          -e 's|sysroot=$(/usr/bin/xcodebuild -sdk $sdk -version Path 2>/dev/null)|sysroot="${darwin.apple_sdk.sdk}"|' \
+          -e 's|QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`|QMAKE_CXX="clang++"\nQMAKE_CONF_COMPILER="clang++"|' \
+          -e 's|XCRUN=`/usr/bin/xcrun -sdk macosx clang -v 2>&1`|XCRUN="clang -v 2>&1"|' \
+          -e 's#sdk_val=$(/usr/bin/xcrun -sdk $sdk -find $(echo $val | cut -d \x27 \x27 -f 1))##' \
+          -e 's#val=$(echo $sdk_val $(echo $val | cut -s -d \x27 \x27 -f 2-))##' \
+          ./configure
+      sed -i '3,$d' ./mkspecs/features/mac/default_pre.prf
+      sed -i '26,$d' ./mkspecs/features/mac/default_post.prf
+      sed -i '1,$d' ./mkspecs/features/mac/sdk.prf
+      sed 's/QMAKE_LFLAGS_RPATH      = -Wl,-rpath,/QMAKE_LFLAGS_RPATH      =/' -i ./mkspecs/common/mac.conf
+     '';
+     # Note on the above: \x27 is a way if including a single-quote
+     # character in the sed string arguments.
 
   setOutputFlags = false;
   preConfigure = ''
@@ -103,7 +121,6 @@ stdenv.mkDerivation {
     ${lib.optionalString developerBuild "-developer-build"}
     -largefile
     -accessibility
-    -rpath
     -optimized-qmake
     -strip
     -no-reduce-relocations
@@ -117,15 +134,6 @@ stdenv.mkDerivation {
     -iconv
     -icu
     -pch
-    -glib
-    -xcb
-    -qpa xcb
-    -${lib.optionalString (cups == null) "no-"}cups
-
-    -no-eglfs
-    -no-directfb
-    -no-linuxfb
-    -no-kms
 
     ${lib.optionalString (!system-x86_64) "-no-sse2"}
     -no-sse3
@@ -141,13 +149,8 @@ stdenv.mkDerivation {
     -system-libpng
     -system-libjpeg
     -system-harfbuzz
-    -system-xcb
-    -system-xkbcommon
     -system-pcre
     -openssl-linked
-    -dbus-linked
-    -libinput
-    -gtk
 
     -system-sqlite
     -${if mysql != null then "plugin" else "no"}-sql-mysql
@@ -158,7 +161,30 @@ stdenv.mkDerivation {
     -${lib.optionalString (buildExamples == false) "no"}make examples
     -${lib.optionalString (buildTests == false) "no"}make tests
     -v
-  '';
+  '' + lib.optionalString (!stdenv.isDarwin) ''
+    -no-rpath
+    -glib
+    -xcb
+    -qpa xcb
+
+    -${lib.optionalString (cups == null) "no-"}cups
+
+    -no-eglfs
+    -no-directfb
+    -no-linuxfb
+    -no-kms
+
+    -libinput
+    -gtk
+    -system-xcb
+    -system-xkbcommon
+    -dbus-linked
+  '' + lib.optionalString stdenv.isDarwin ''
+    -platform macx-clang
+    -no-use-gold-linker
+    -no-fontconfig
+    -qt-freetype
+   '';
 
   # PostgreSQL autodetection fails sporadically because Qt omits the "-lpq" flag
   # if dependency paths contain the string "pq", which can occur in the hash.
@@ -166,32 +192,44 @@ stdenv.mkDerivation {
   PSQL_LIBS = lib.optionalString (postgresql != null) "-L${postgresql.lib}/lib -lpq";
 
   propagatedBuildInputs = [
-    dbus glib libxml2 libxslt openssl pcre16 sqlite udev zlib
+    libxml2 libxslt openssl pcre16 sqlite zlib
+
+    # Text rendering
+    harfbuzz icu
 
     # Image formats
     libjpeg libpng libtiff
+  ]
+  ++ lib.optional mesaSupported mesa
+  ++ lib.optionals (!stdenv.isDarwin) [
+    dbus glib udev
 
     # Text rendering
-    fontconfig freetype harfbuzz icu
+    fontconfig freetype
 
     # X11 libs
     libX11 libXcomposite libXext libXi libXrender libxcb libxkbcommon xcbutil
     xcbutilimage xcbutilkeysyms xcbutilrenderutil xcbutilwm
-  ]
-  ++ lib.optional mesaSupported mesa;
+   ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+    ApplicationServices CoreServices AppKit Carbon OpenGL AGL Cocoa
+    DiskArbitration darwin.cf-private libiconv darwin.apple_sdk.sdk
+  ]);
 
-  buildInputs =
-    [ gtk3 libinput ]
+  buildInputs = [ ]
+    ++ lib.optionals (!stdenv.isDarwin) [ gtk3 libinput ]
     ++ lib.optional developerBuild gdb
     ++ lib.optional (cups != null) cups
     ++ lib.optional (mysql != null) mysql.lib
     ++ lib.optional (postgresql != null) postgresql;
 
-  nativeBuildInputs =
-    [ bison flex gperf lndir patchelf perl pkgconfig python2 ];
+  nativeBuildInputs = [ bison flex gperf lndir perl pkgconfig python2 ] ++ lib.optional (!stdenv.isDarwin) patchelf;
 
   # freetype-2.5.4 changed signedness of some struct fields
-  NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare";
+  NIX_CFLAGS_COMPILE = "-Wno-error=sign-compare"
+    + lib.optionalString stdenv.isDarwin " -D__MAC_OS_X_VERSION_MAX_ALLOWED=1090 -D__AVAILABILITY_INTERNAL__MAC_10_10=__attribute__((availability(macosx,introduced=10.10)))";
+  # Note that nixpkgs's objc4 is from macOS 10.11 while the SDK is
+  # 10.9 which necessitates the above macro definition that mentions
+  # 10.10
 
   postInstall = ''
     find "$out" -name "*.cmake" | while read file; do
@@ -221,7 +259,7 @@ stdenv.mkDerivation {
       # Move libtool archives and qmake projects
       if [ "z''${!outputLib}" != "z''${!outputDev}" ]; then
           pushd "''${!outputLib}"
-          find lib -name '*.a' -o -name '*.la' -o -name '*.prl' | \
+          find lib -name '*.a' -o -name '*.la'${if stdenv.isDarwin then "" else "-o -name '*.prl'"} | \
               while read -r file; do
                   mkdir -p "''${!outputDev}/$(dirname "$file")"
                   mv "''${!outputLib}/$file" "''${!outputDev}/$file"
@@ -258,7 +296,9 @@ stdenv.mkDerivation {
     '';
 
   inherit lndir;
-  setupHook = ../../qtbase-setup-hook.sh;
+  setupHook = if stdenv.isDarwin
+              then ../../qtbase-setup-hook-darwin.sh
+              else ../../qtbase-setup-hook.sh;
 
   enableParallelBuilding = true;
 
@@ -267,7 +307,7 @@ stdenv.mkDerivation {
     description = "A cross-platform application framework for C++";
     license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
     maintainers = with maintainers; [ bbenoist qknight ttuegel ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 
 }
diff --git a/pkgs/development/libraries/qt-5/5.7/qtbase/series b/pkgs/development/libraries/qt-5/5.7/qtbase/series
index 44e2d9040807c..2196d83837527 100644
--- a/pkgs/development/libraries/qt-5/5.7/qtbase/series
+++ b/pkgs/development/libraries/qt-5/5.7/qtbase/series
@@ -7,4 +7,3 @@ xdg-config-dirs.patch
 nix-profiles-library-paths.patch
 compose-search-path.patch
 libressl.patch
-cmake-paths.patch