summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@mailbox.org>2017-05-15 06:44:33 -0500
committerThomas Tuegel <ttuegel@mailbox.org>2017-06-18 08:41:57 -0500
commit3f3d33a07867116446ec9b5e2675ef1c8de8127d (patch)
treeb0c362b10bb8e908c2be61aadae8f9cdb69a8c6e
parent08d25152b85fb24f7b5b85efe25d6be4deb12227 (diff)
downloadnixpkgs-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar
nixpkgs-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar.gz
nixpkgs-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar.bz2
nixpkgs-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar.lz
nixpkgs-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar.xz
nixpkgs-3f3d33a07867116446ec9b5e2675ef1c8de8127d.tar.zst
nixpkgs-3f3d33a07867116446ec9b5e2675ef1c8de8127d.zip
qt5: use distinct `lib/qt-5.x` prefix for each minor version
Using a distinct prefix for plugins and QML libraries allows multiple Qt 5 minor
versions to coexist in the same environment.
-rw-r--r--nixos/modules/services/x11/desktop-managers/plasma5.nix1
-rw-r--r--pkgs/applications/display-managers/sddm/default.nix2
-rw-r--r--pkgs/applications/science/programming/fdr/default.nix2
-rw-r--r--pkgs/applications/science/robotics/qgroundcontrol/default.nix6
-rw-r--r--pkgs/desktops/lxqt/default.nix2
-rw-r--r--pkgs/desktops/plasma-5/libkscreen/default.nix2
-rw-r--r--pkgs/desktops/plasma-5/startkde/default.nix15
-rwxr-xr-xpkgs/desktops/plasma-5/startkde/startkde.sh4
-rw-r--r--pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh13
-rw-r--r--pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix2
-rw-r--r--pkgs/development/libraries/qmltermwidget/default.nix2
-rw-r--r--pkgs/development/libraries/qt-5/5.6/default.nix9
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtbase/default.nix17
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch8
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch20
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix7
-rw-r--r--pkgs/development/libraries/qt-5/5.8/default.nix9
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/default.nix18
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch8
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch20
-rw-r--r--pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh7
-rw-r--r--pkgs/development/libraries/qt-5/make-qt-wrapper.sh7
-rw-r--r--pkgs/development/libraries/qt-5/qt-env.nix7
-rw-r--r--pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh25
-rw-r--r--pkgs/development/libraries/qt-5/qtbase-setup-hook.sh25
-rw-r--r--pkgs/development/libraries/qtwebkit-plugins/default.nix2
-rw-r--r--pkgs/development/qtcreator/default.nix2
-rw-r--r--pkgs/tools/misc/qt5ct/default.nix2
30 files changed, 129 insertions, 123 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix
index 2216104be31..d981cd5328e 100644
--- a/nixos/modules/services/x11/desktop-managers/plasma5.nix
+++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix
@@ -183,7 +183,6 @@ in
       environment.variables = {
         # Enable GTK applications to load SVG icons
         GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache";
-        QT_PLUGIN_PATH = "/run/current-system/sw/lib/qt5/plugins";
       };
 
       fonts.fonts = with pkgs; [ noto-fonts hack-font ];
diff --git a/pkgs/applications/display-managers/sddm/default.nix b/pkgs/applications/display-managers/sddm/default.nix
index d1f487b37ac..07c1e8cee33 100644
--- a/pkgs/applications/display-managers/sddm/default.nix
+++ b/pkgs/applications/display-managers/sddm/default.nix
@@ -53,7 +53,7 @@ let
     ];
 
     preConfigure = ''
-      export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/lib/qt5/qml -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
+      export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/$qtQmlPrefix -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
     '';
 
     enableParallelBuilding = true;
diff --git a/pkgs/applications/science/programming/fdr/default.nix b/pkgs/applications/science/programming/fdr/default.nix
index a82027a628f..8ed8e0e73b0 100644
--- a/pkgs/applications/science/programming/fdr/default.nix
+++ b/pkgs/applications/science/programming/fdr/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation {
     cp -r * "$out"
     # Hack around lack of libtinfo in NixOS
     ln -s ${ncurses.out}/lib/libncursesw.so.6 $out/lib/libtinfo.so.5
-    ln -s ${qtbase.out}/lib/qt5/plugins $out/lib/qt_plugins
+    ln -s ${qtbase.out}/$qtPluginPrefix $out/lib/qt_plugins
     ln -s ${zlib.out}/lib/libz.so.1 $out/lib/libz.so.1
 
     for b in fdr4 _fdr4 refines _refines cspmprofiler cspmexplorerprof
diff --git a/pkgs/applications/science/robotics/qgroundcontrol/default.nix b/pkgs/applications/science/robotics/qgroundcontrol/default.nix
index e323b42d7ae..580d9f0e76e 100644
--- a/pkgs/applications/science/robotics/qgroundcontrol/default.nix
+++ b/pkgs/applications/science/robotics/qgroundcontrol/default.nix
@@ -56,10 +56,10 @@ stdenv.mkDerivation rec {
 
     # we need to link to our Qt deps in our own output if we want
     # this package to work without being installed as a system pkg
-    mkdir -p $out/lib/qt5 $out/etc/xdg
+    mkdir -p $out/lib/qt-$qtCompatVersion $out/etc/xdg
     for pkg in $qtInputs; do
-      if [[ -d $pkg/lib/qt5 ]]; then
-        for dir in lib/qt5 share etc/xdg; do
+      if [[ -d $pkg/lib/qt-$qtCompatVersion ]]; then
+        for dir in lib/qt-$qtCompatVersion share etc/xdg; do
           if [[ -d $pkg/$dir ]]; then
             ${lndir}/bin/lndir "$pkg/$dir" "$out/$dir"
           fi
diff --git a/pkgs/desktops/lxqt/default.nix b/pkgs/desktops/lxqt/default.nix
index fbcb286f5b2..735ba79b405 100644
--- a/pkgs/desktops/lxqt/default.nix
+++ b/pkgs/desktops/lxqt/default.nix
@@ -13,7 +13,7 @@ let
           --replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg" \
           --replace "DESTINATION \"\''${LXQT_SHARE_DIR}" "DESTINATION \"share/lxqt" \
           --replace "DESTINATION \"\''${LXQT_GRAPHICS_DIR}" "DESTINATION \"share/lxqt/graphics" \
-          --replace "DESTINATION \"\''${QT_PLUGINS_DIR}" "DESTINATION \"lib/qt5/plugins" \
+          --replace "DESTINATION \"\''${QT_PLUGINS_DIR}" "DESTINATION \"$qtPluginPrefix" \
           --replace "\''${LXQT_TRANSLATIONS_DIR}" share/lxqt/translations
         echo ============================
         echo $file
diff --git a/pkgs/desktops/plasma-5/libkscreen/default.nix b/pkgs/desktops/plasma-5/libkscreen/default.nix
index afb2c20e90c..6881f95e6d5 100644
--- a/pkgs/desktops/plasma-5/libkscreen/default.nix
+++ b/pkgs/desktops/plasma-5/libkscreen/default.nix
@@ -14,6 +14,6 @@ plasmaPackage {
   ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   preConfigure = ''
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_LIBKSCREEN_BACKENDS=\"''${!outputLib}/lib/qt5/plugins/kf5/kscreen\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_LIBKSCREEN_BACKENDS=\"''${!outputLib}/$qtPluginPrefix/kf5/kscreen\""
   '';
 }
diff --git a/pkgs/desktops/plasma-5/startkde/default.nix b/pkgs/desktops/plasma-5/startkde/default.nix
index 87c72fdc599..25ebdd7f332 100644
--- a/pkgs/desktops/plasma-5/startkde/default.nix
+++ b/pkgs/desktops/plasma-5/startkde/default.nix
@@ -34,21 +34,8 @@ in runCommand "startkde" env ''
       addToSearchPath suffixPATH "$p/lib/libexec/kf5"
   done
 
-  # Configure Qt search paths
-  QT_PLUGIN_PATH=
-  QML_IMPORT_PATH=
-  QML2_IMPORT_PATH=
-  for p in $libs; do
-      addToSearchPath QT_PLUGIN_PATH "$p/lib/qt5/plugins"
-      addToSearchPath QML_IMPORT_PATH "$p/lib/qt5/imports"
-      addToSearchPath QML2_IMPORT_PATH "$p/lib/qt5/qml"
-  done
-
   substitute ${./startkde.sh} "$out" \
       --subst-var shell \
-      --subst-var suffixPATH \
-      --subst-var QT_PLUGIN_PATH \
-      --subst-var QML_IMPORT_PATH \
-      --subst-var QML2_IMPORT_PATH
+      --subst-var suffixPATH
   chmod +x "$out"
 ''
diff --git a/pkgs/desktops/plasma-5/startkde/startkde.sh b/pkgs/desktops/plasma-5/startkde/startkde.sh
index c38450516e9..53e7fbb0569 100755
--- a/pkgs/desktops/plasma-5/startkde/startkde.sh
+++ b/pkgs/desktops/plasma-5/startkde/startkde.sh
@@ -2,9 +2,7 @@
 
 PATH="$PATH${PATH:+:}@suffixPATH@"
 
-export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}@QT_PLUGIN_PATH@"
-export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}@QML_IMPORT_PATH@"
-export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}@QML2_IMPORT_PATH@"
+echo "NIX_PROFILES=\"$NIX_PROFILES\""
 
 kbuildsycoca5
 
diff --git a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
index 9ee9ef90a44..a550cda1fa2 100644
--- a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
+++ b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
@@ -13,10 +13,6 @@ _ecmConfig() {
     cmakeFlags+=" -DKDE_INSTALL_LIBDIR=${!outputLib}/lib"
     cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputBin}/lib/libexec"
     cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake"
-    cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/lib/qt5/plugins"
-    cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/lib/qt5/plugins"
-    cmakeFlags+=" -DKDE_INSTALL_QTQUICKIMPORTSDIR=${!outputBin}/lib/qt5/imports"
-    cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/lib/qt5/qml"
     cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include"
     cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var"
     cmakeFlags+=" -DKDE_INSTALL_DATAROOTDIR=${!outputBin}/share"
@@ -46,6 +42,15 @@ _ecmConfig() {
     cmakeFlags+=" -DKDE_INSTALL_SYSCONFDIR=${!outputBin}/etc"
     cmakeFlags+=" -DKDE_INSTALL_CONFDIR=${!outputBin}/etc/xdg"
     cmakeFlags+=" -DKDE_INSTALL_AUTOSTARTDIR=${!outputBin}/etc/xdg/autostart"
+
+    if [ -n "$qtPluginPrefix" ]; then
+        cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix"
+        cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix"
+    fi
+
+    if [ -n "$qtQmlPrefix" ]; then
+        cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix"
+    fi
 }
 
 preConfigureHooks+=(_ecmConfig)
diff --git a/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix b/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix
index 8a91bdbac52..4e02777e39c 100644
--- a/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix
@@ -14,6 +14,6 @@ kdeFramework {
   propagatedBuildInputs = [ qtx11extras ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   preConfigure = ''
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PATH=\"$out/lib/qt5/plugins\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PATH=\"$out/$qtPluginPrefix\""
   '';
 }
diff --git a/pkgs/development/libraries/qmltermwidget/default.nix b/pkgs/development/libraries/qmltermwidget/default.nix
index bb058711b2e..88d942b9fd7 100644
--- a/pkgs/development/libraries/qmltermwidget/default.nix
+++ b/pkgs/development/libraries/qmltermwidget/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   patchPhase = ''
     substituteInPlace qmltermwidget.pro \
-      --replace '$$[QT_INSTALL_QML]' "/lib/qt5/qml/"
+      --replace '$$[QT_INSTALL_QML]' "/$qtQmlPrefix/"
   '';
 
   installFlags = [ "INSTALL_ROOT=$(out)" ];
diff --git a/pkgs/development/libraries/qt-5/5.6/default.nix b/pkgs/development/libraries/qt-5/5.6/default.nix
index cc6475d31b6..2dccdd065df 100644
--- a/pkgs/development/libraries/qt-5/5.6/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/default.nix
@@ -18,8 +18,9 @@ existing packages here and modify it as necessary.
 1. Update the URL in `./fetch.sh`.
 2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$VERSION/`
    from the top of the Nixpkgs tree.
-3. Use `nox-review wip` to check that everything builds.
-4. Commit the changes and open a pull request.
+3. Update `qtCompatVersion` below if the minor version number changes.
+4. Check that the new packages build correctly.
+5. Commit the changes and open a pull request.
 
 */
 
@@ -38,6 +39,8 @@ with stdenv.lib;
 
 let
 
+  qtCompatVersion = "5.6";
+
   mirror = "http://download.qt.io";
   srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
 
@@ -70,7 +73,7 @@ let
 
   addPackages = self: with self;
     let
-      callPackage = self.newScope { inherit qtSubmodule srcs; };
+      callPackage = self.newScope { inherit qtCompatVersion qtSubmodule srcs; };
     in {
 
       qtbase = callPackage ./qtbase {
diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
index 289a1bbac6c..a4039714a60 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchgit, copyPathsToStore
-, srcs
+, srcs, qtCompatVersion
 
 , xlibs, libX11, libxcb, libXcursor, libXext, libXrender, libXi
 , xcbutil, xcbutilimage, xcbutilkeysyms, xcbutilwm, libxkbcommon
@@ -32,6 +32,7 @@ stdenv.mkDerivation {
 
   name = "qtbase-${srcs.qtbase.version}";
   inherit (srcs.qtbase) src version;
+  inherit qtCompatVersion;
 
   outputs = [ "out" "dev" ];
 
@@ -94,18 +95,22 @@ stdenv.mkDerivation {
     # Note on the above: \x27 is a way if including a single-quote
     # character in the sed string arguments.
 
+  qtPluginPrefix = "lib/qt-${qtCompatVersion}/plugins";
+  qtQmlPrefix = "lib/qt-${qtCompatVersion}/qml";
+  qtDocPrefix = "share/doc/qt-${qtCompatVersion}";
+
   setOutputFlags = false;
   preConfigure = ''
     export LD_LIBRARY_PATH="$PWD/lib:$PWD/plugins/platforms:$LD_LIBRARY_PATH"
     export MAKEFLAGS=-j$NIX_BUILD_CORES
 
     configureFlags+="\
-        -plugindir $out/lib/qt5/plugins \
-        -importdir $out/lib/qt5/imports \
-        -qmldir $out/lib/qt5/qml \
-        -docdir $out/share/doc/qt5"
+        -plugindir $out/$qtPluginPrefix \
+        -qmldir $out/$qtQmlPrefix \
+        -docdir $out/$qtDocPrefix"
 
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/lib/qt5/plugins/platforms\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/$qtPluginPrefix/platforms\""
   '';
 
   prefixKey = "-prefix ";
diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch b/pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch
index 68163fc0c31..dfc2dccdeb6 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch
+++ b/pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch
@@ -7,11 +7,11 @@ Index: qtbase-opensource-src-5.6.2/src/corelib/kernel/qcoreapplication.cpp
          coreappdata()->app_libpaths.reset(app_libpaths);
  
 +        // Add library paths derived from NIX_PROFILES.
-+        const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
-+        const QString plugindir = QString::fromLatin1("/lib/qt5/plugins");
-+        for (const QByteArray &profile: profiles) {
++        const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
++        const QString plugindir = QStringLiteral(NIXPKGS_QT_PLUGIN_PREFIX);
++        for (const QString &profile: profiles) {
 +            if (!profile.isEmpty()) {
-+                app_libpaths->append(QFile::decodeName(profile) + plugindir);
++                app_libpaths->append(profile + QDir::separator() + plugindir);
 +            }
 +        }
 +
diff --git a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix
index 9b6a6c46176..57b8e53b215 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix
@@ -5,4 +5,8 @@ qtSubmodule {
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   qtInputs = [ qtbase qtsvg qtxmlpatterns ];
   nativeBuildInputs = [ python2 ];
+
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
+  '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch
index 06b244b974f..50e9490b6d9 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch
+++ b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch
@@ -1,20 +1,20 @@
-Index: qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
+Index: qtdeclarative-opensource-src-5.6.2/src/qml/qml/qqmlimport.cpp
 ===================================================================
---- qtdeclarative-opensource-src-5.5.1.orig/src/qml/qml/qqmlimport.cpp
-+++ qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
-@@ -1549,6 +1549,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
+--- qtdeclarative-opensource-src-5.6.2.orig/src/qml/qml/qqmlimport.cpp
++++ qtdeclarative-opensource-src-5.6.2/src/qml/qml/qqmlimport.cpp
+@@ -1568,6 +1568,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
      QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
      addImportPath(installImportsPath);
  
 +    // Add library paths derived from NIX_PROFILES.
-+    const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
-+    const QString qmldir = QString::fromLatin1("/lib/qt5/qml");
-+    Q_FOREACH (const QByteArray &profile, profiles) {
++    const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
++    const QString qmldir = QStringLiteral(NIXPKGS_QML2_IMPORT_PREFIX);
++    for (const QString &profile: profiles) {
 +        if (!profile.isEmpty()) {
-+            addImportPath(QFile::decodeName(profile) + qmldir);
++            addImportPath(profile + QDir::separator() + qmldir);
 +        }
 +    }
 +
      // env import paths
-     QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
-     if (!envImportPath.isEmpty()) {
+     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+         const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
diff --git a/pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix b/pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix
index 1234c825b14..7ffc42fe7f6 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix
@@ -42,10 +42,9 @@ qtSubmodule {
     sed -i -e 's,/cert.pem,/certs/ca-bundle.crt,' src/3rdparty/chromium/third_party/boringssl/src/crypto/x509/x509_def.c
 
     configureFlags+="\
-        -plugindir $out/lib/qt5/plugins \
-        -importdir $out/lib/qt5/imports \
-        -qmldir $out/lib/qt5/qml \
-        -docdir $out/share/doc/qt5"
+        -plugindir $out/$qtPluginPrefix \
+        -qmldir $out/$qtQmlPrefix \
+        -docdir $out/$qtDocPrefix"
   '';
   propagatedBuildInputs = [
     # Image formats
diff --git a/pkgs/development/libraries/qt-5/5.8/default.nix b/pkgs/development/libraries/qt-5/5.8/default.nix
index 2865a879f47..5a737441fa8 100644
--- a/pkgs/development/libraries/qt-5/5.8/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/default.nix
@@ -9,8 +9,9 @@ top-level attribute to `top-level/all-packages.nix`.
 1. Update the URL in `maintainers/scripts/generate-qt.sh`.
 2. From the top of the Nixpkgs tree, run
    `./maintainers/scripts/generate-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
-3. Check that the new packages build correctly.
-4. Commit the changes and open a pull request.
+3. Update `qtCompatVersion` below if the minor version number changes.
+4. Check that the new packages build correctly.
+5. Commit the changes and open a pull request.
 
 */
 
@@ -29,6 +30,8 @@ with stdenv.lib;
 
 let
 
+  qtCompatVersion = "5.8";
+
   mirror = "http://download.qt.io";
   srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
 
@@ -61,7 +64,7 @@ let
 
   addPackages = self: with self;
     let
-      callPackage = self.newScope { inherit qtSubmodule srcs; };
+      callPackage = self.newScope { inherit qtCompatVersion qtSubmodule srcs; };
     in {
 
       qtbase = callPackage ./qtbase {
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
index ee6399c2bd4..008eb1e3709 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
@@ -1,6 +1,6 @@
 {
   stdenv, lib, copyPathsToStore,
-  src, version,
+  src, version, qtCompatVersion,
 
   coreutils, bison, flex, gdb, gperf, lndir, patchelf, perl, pkgconfig, python2,
   ruby,
@@ -32,7 +32,7 @@ in
 stdenv.mkDerivation {
 
   name = "qtbase-${version}";
-  inherit src version;
+  inherit qtCompatVersion src version;
 
   propagatedBuildInputs =
     [
@@ -117,18 +117,22 @@ stdenv.mkDerivation {
      # Note on the above: \x27 is a way if including a single-quote
      # character in the sed string arguments.
 
+  qtPluginPrefix = "lib/qt-${qtCompatVersion}/plugins";
+  qtQmlPrefix = "lib/qt-${qtCompatVersion}/qml";
+  qtDocPrefix = "share/doc/qt-${qtCompatVersion}";
+
   setOutputFlags = false;
   preConfigure = ''
     export LD_LIBRARY_PATH="$PWD/lib:$PWD/plugins/platforms:$LD_LIBRARY_PATH"
     export MAKEFLAGS=-j$NIX_BUILD_CORES
 
     configureFlags+="\
-        -plugindir $out/lib/qt5/plugins \
-        -importdir $out/lib/qt5/imports \
-        -qmldir $out/lib/qt5/qml \
-        -docdir $out/share/doc/qt5"
+        -plugindir $out/$qtPluginPrefix \
+        -qmldir $out/$qtQmlPrefix \
+        -docdir $out/$qtDocPrefix"
 
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/lib/qt5/plugins/platforms\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/$qtPluginPrefix/platforms\""
   '';
 
 
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch b/pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch
index 553c71d0ace..f626e399288 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch
@@ -7,11 +7,11 @@ Index: qtbase-opensource-src-5.8.0/src/corelib/kernel/qcoreapplication.cpp
          coreappdata()->app_libpaths.reset(app_libpaths);
  
 +        // Add library paths derived from NIX_PROFILES.
-+        const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
-+        const QString plugindir = QString::fromLatin1("/lib/qt5/plugins");
-+        for (const QByteArray &profile: profiles) {
++        const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
++        const QString plugindir = QStringLiteral(NIXPKGS_QT_PLUGIN_PREFIX);
++        for (const QString &profile: profiles) {
 +            if (!profile.isEmpty()) {
-+                app_libpaths->append(QFile::decodeName(profile) + plugindir);
++                app_libpaths->append(profile + QDir::separator() + plugindir);
 +            }
 +        }
 +
diff --git a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix
index acddbd9e365..28ea571adca 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix
@@ -8,6 +8,10 @@ qtSubmodule {
   qtInputs = [ qtbase qtsvg qtxmlpatterns ];
   nativeBuildInputs = [ python2 makeQtWrapper ];
 
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
+  '';
+
   postInstall = ''
     wrapQtProgram $out/bin/qmleasing
     wrapQtProgram $out/bin/qmlscene
diff --git a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch
index 06b244b974f..2d51f7b6759 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch
+++ b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch
@@ -1,20 +1,20 @@
-Index: qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
+Index: qtdeclarative-opensource-src-5.8.0/src/qml/qml/qqmlimport.cpp
 ===================================================================
---- qtdeclarative-opensource-src-5.5.1.orig/src/qml/qml/qqmlimport.cpp
-+++ qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
-@@ -1549,6 +1549,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
+--- qtdeclarative-opensource-src-5.8.0.orig/src/qml/qml/qqmlimport.cpp
++++ qtdeclarative-opensource-src-5.8.0/src/qml/qml/qqmlimport.cpp
+@@ -1630,6 +1630,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
      QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
      addImportPath(installImportsPath);
  
 +    // Add library paths derived from NIX_PROFILES.
-+    const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
-+    const QString qmldir = QString::fromLatin1("/lib/qt5/qml");
-+    Q_FOREACH (const QByteArray &profile, profiles) {
++    const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
++    const QString qmldir = QStringLiteral(NIXPKGS_QML2_IMPORT_PREFIX);
++    for (const QString &profile: profiles) {
 +        if (!profile.isEmpty()) {
-+            addImportPath(QFile::decodeName(profile) + qmldir);
++            addImportPath(profile + QDir::separator() + qmldir);
 +        }
 +    }
 +
      // env import paths
-     QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
-     if (!envImportPath.isEmpty()) {
+     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+         const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
diff --git a/pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh b/pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh
index 576c03d8c76..a42c418fde6 100644
--- a/pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh
+++ b/pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh
@@ -3,7 +3,6 @@ wrapQtProgram() {
     shift
     wrapProgram "$prog" \
         --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
-        --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
         --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
         --set DYLD_FRAMEWORK_PATH "/System/Library/Frameworks" \
         --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
@@ -18,7 +17,6 @@ makeQtWrapper() {
     shift
     makeWrapper "$old" "$new" \
         --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
-        --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
         --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
         --set DYLD_FRAMEWORK_PATH "/System/Library/Frameworks" \
         --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
@@ -28,9 +26,8 @@ makeQtWrapper() {
 
 _makeQtWrapperSetup() {
     # cannot use addToSearchPath because these directories may not exist yet
-    export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
-    export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
-    export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
+    export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/$qtPluginPrefix"
+    export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/$qtQmlPrefix"
     export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share"
     export RUNTIME_XDG_CONFIG_DIRS="$RUNTIME_XDG_CONFIG_DIRS${RUNTIME_XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
 }
diff --git a/pkgs/development/libraries/qt-5/make-qt-wrapper.sh b/pkgs/development/libraries/qt-5/make-qt-wrapper.sh
index 4a5651f74c9..33dc8b6370f 100644
--- a/pkgs/development/libraries/qt-5/make-qt-wrapper.sh
+++ b/pkgs/development/libraries/qt-5/make-qt-wrapper.sh
@@ -3,7 +3,6 @@ wrapQtProgram() {
     shift
     wrapProgram "$prog" \
         --prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
-        --prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
         --prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
         --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
         --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
@@ -18,7 +17,6 @@ makeQtWrapper() {
     shift
     makeWrapper "$old" "$new" \
         --prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
-        --prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
         --prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
         --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
         --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
@@ -28,9 +26,8 @@ makeQtWrapper() {
 
 _makeQtWrapperSetup() {
     # cannot use addToSearchPath because these directories may not exist yet
-    export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
-    export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
-    export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
+    export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/$qtPluginPrefix"
+    export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/$qtQmlPrefix"
     export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share${GSETTINGS_SCHEMAS_PATH:+:$GSETTINGS_SCHEMAS_PATH}"
     export RUNTIME_XDG_CONFIG_DIRS="$RUNTIME_XDG_CONFIG_DIRS${RUNTIME_XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
 }
diff --git a/pkgs/development/libraries/qt-5/qt-env.nix b/pkgs/development/libraries/qt-5/qt-env.nix
index fad68fbd745..728761689b4 100644
--- a/pkgs/development/libraries/qt-5/qt-env.nix
+++ b/pkgs/development/libraries/qt-5/qt-env.nix
@@ -13,10 +13,9 @@ buildEnv {
     cat >"$out/bin/qt.conf" <<EOF
     [Paths]
     Prefix = $out
-    Plugins = lib/qt5/plugins
-    Imports = lib/qt5/imports
-    Qml2Imports = lib/qt5/qml
-    Documentation = share/doc/qt5
+    Plugins = $qtPluginPrefix
+    Qml2Imports = $qtQmlPrefix
+    Documentation = $qtDocPrefix
     EOF
   '';
 }
diff --git a/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh b/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
index aa2d24a741c..81fcf5fc3d3 100644
--- a/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
+++ b/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
@@ -1,3 +1,7 @@
+qtPluginPrefix=@qtPluginPrefix@
+qtQmlPrefix=@qtQmlPrefix@
+qtDocPrefix=@qtDocPrefix@
+
 addToSearchPathOnceWithCustomDelimiter() {
     local delim="$1"
     local search="$2"
@@ -25,30 +29,28 @@ propagateOnce() {
 }
 
 _qtPropagate() {
-    for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
+    for dir in $qtPluginPrefix $qtQmlPrefix; do
         if [ -d "$1/$dir" ]; then
             propagateOnce propagatedBuildInputs "$1"
             break
         fi
     done
-    addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
-    addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
-    addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
+    addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
+    addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
 }
 
 crossEnvHooks+=(_qtPropagate)
 
 _qtPropagateNative() {
-    for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
+    for dir in $qtPluginPrefix $qtQmlPrefix; do
         if [ -d "$1/$dir" ]; then
             propagateOnce propagatedNativeBuildInputs "$1"
             break
         fi
     done
     if [ -z "$crossConfig" ]; then
-        addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
-        addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
-        addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
+    addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
+    addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
     fi
 }
 
@@ -112,10 +114,9 @@ if [ -z "$NIX_QT5_TMP" ]; then
     cat >"$NIX_QT5_TMP/bin/qt.conf" <<EOF
 [Paths]
 Prefix = $NIX_QT5_TMP
-Plugins = lib/qt5/plugins
-Imports = lib/qt5/imports
-Qml2Imports = lib/qt5/qml
-Documentation = share/doc/qt5
+Plugins = $qtPluginPrefix
+Qml2Imports = $qtQmlPrefix
+Documentation = $qtDocPrefix
 EOF
     echo "bin/qt.conf" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
 
diff --git a/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh
index 47d196cec26..66f5d3f5818 100644
--- a/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh
+++ b/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh
@@ -1,3 +1,7 @@
+qtPluginPrefix=@qtPluginPrefix@
+qtQmlPrefix=@qtQmlPrefix@
+qtDocPrefix=@qtDocPrefix@
+
 addToSearchPathOnceWithCustomDelimiter() {
     local delim="$1"
     local search="$2"
@@ -25,30 +29,28 @@ propagateOnce() {
 }
 
 _qtPropagate() {
-    for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
+    for dir in $qtPluginPrefix $qtQmlPrefix; do
         if [ -d "$1/$dir" ]; then
             propagateOnce propagatedBuildInputs "$1"
             break
         fi
     done
-    addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
-    addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
-    addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
+    addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
+    addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
 }
 
 crossEnvHooks+=(_qtPropagate)
 
 _qtPropagateNative() {
-    for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
+    for dir in $qtPluginPrefix $qtQmlPrefix; do
         if [ -d "$1/$dir" ]; then
             propagateOnce propagatedNativeBuildInputs "$1"
             break
         fi
     done
     if [ -z "$crossConfig" ]; then
-        addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
-        addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
-        addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
+    addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
+    addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
     fi
 }
 
@@ -111,10 +113,9 @@ if [ -z "$NIX_QT5_TMP" ]; then
     cat >"$NIX_QT5_TMP/bin/qt.conf" <<EOF
 [Paths]
 Prefix = $NIX_QT5_TMP
-Plugins = lib/qt5/plugins
-Imports = lib/qt5/imports
-Qml2Imports = lib/qt5/qml
-Documentation = share/doc/qt5
+Plugins = $qtPluginPrefix
+Qml2Imports = $qtQmlPrefix
+Documentation = $qtDocPrefix
 EOF
     echo "bin/qt.conf" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
 
diff --git a/pkgs/development/libraries/qtwebkit-plugins/default.nix b/pkgs/development/libraries/qtwebkit-plugins/default.nix
index 73e62945113..716e6cb2809 100644
--- a/pkgs/development/libraries/qtwebkit-plugins/default.nix
+++ b/pkgs/development/libraries/qtwebkit-plugins/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
 
   postPatch = ''
     sed -i "s,-lhunspell,-lhunspell-1.6," src/spellcheck/spellcheck.pri
-    sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/lib/qt5/plugins," src/src.pro
+    sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/$qtPluginPrefix," src/src.pro
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/qtcreator/default.nix b/pkgs/development/qtcreator/default.nix
index 6fadf530ed0..d82098852cc 100644
--- a/pkgs/development/qtcreator/default.nix
+++ b/pkgs/development/qtcreator/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
   installFlags = [ "INSTALL_ROOT=$(out)" ] ++ optional withDocumentation "install_docs";
 
   preBuild = optional withDocumentation ''
-    ln -s ${qtbase}/share/doc $NIX_QT5_TMP/share
+    ln -s ${qtbase}/$qtDocPrefix $NIX_QT5_TMP/share
   '';
 
   postInstall = ''
diff --git a/pkgs/tools/misc/qt5ct/default.nix b/pkgs/tools/misc/qt5ct/default.nix
index 016e9726ad9..f6ba699211c 100644
--- a/pkgs/tools/misc/qt5ct/default.nix
+++ b/pkgs/tools/misc/qt5ct/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ qtbase qtsvg ];
 
   preConfigure = ''
-    qmakeFlags="$qmakeFlags PLUGINDIR=$out/lib/qt5/plugins"
+    qmakeFlags="$qmakeFlags PLUGINDIR=$out/$qtPluginPrefix"
   '';
 
   preFixup = ''