about summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-5/5.9
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@mailbox.org>2017-10-24 06:39:54 -0500
committerThomas Tuegel <ttuegel@mailbox.org>2017-11-07 07:18:46 -0600
commitfe0ab944db2176e6757ae89aeebea16ab8dc69d0 (patch)
tree9a9c8962bc6a3083900770c980a5b87666f89688 /pkgs/development/libraries/qt-5/5.9
parent4866f16fbadd2fcc702102944b990ff578379b0a (diff)
downloadnixlib-fe0ab944db2176e6757ae89aeebea16ab8dc69d0.tar
nixlib-fe0ab944db2176e6757ae89aeebea16ab8dc69d0.tar.gz
nixlib-fe0ab944db2176e6757ae89aeebea16ab8dc69d0.tar.bz2
nixlib-fe0ab944db2176e6757ae89aeebea16ab8dc69d0.tar.lz
nixlib-fe0ab944db2176e6757ae89aeebea16ab8dc69d0.tar.xz
nixlib-fe0ab944db2176e6757ae89aeebea16ab8dc69d0.tar.zst
nixlib-fe0ab944db2176e6757ae89aeebea16ab8dc69d0.zip
qt5: factor out common definitions and remove symlink farm
The module definitions are factored out and shared between qt56 and qt59. The
symlink farm which was created during builds is no longer needed.
Diffstat (limited to 'pkgs/development/libraries/qt-5/5.9')
-rw-r--r--pkgs/development/libraries/qt-5/5.9/default.nix130
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase.patch1106
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/cmake-paths.patch359
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/compose-search-path.patch18
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/darwin-cf.patch36
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/darwin-series3
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/default.nix366
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-gl.patch19
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-gtkstyle.patch50
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-libXcursor.patch17
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-resolv.patch26
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/library-paths.patch20
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/libressl.patch33
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-common-mac.patch11
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-features-mac.patch292
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/qgtk-env.patch36
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/qnativesocketengine-type-pun.patch14
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/series9
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/tzdir.patch39
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtcharts.nix10
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtconnectivity.nix10
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtdeclarative.patch33
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtdeclarative/default.nix20
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtdeclarative/import-paths.patch20
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtdeclarative/series1
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtdoc.nix7
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtgraphicaleffects.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtimageformats.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtlocation.nix13
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtmacextras.nix10
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtmultimedia.nix21
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtquickcontrols.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtquickcontrols2.nix10
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtscript.patch (renamed from pkgs/development/libraries/qt-5/5.9/qtscript/0001-glib-2.32.patch)12
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtscript/default.nix7
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtsensors.nix13
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtserialport.patch (renamed from pkgs/development/libraries/qt-5/5.9/qtserialport/qtserialport-dlopen-udev.patch)10
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtserialport/default.nix12
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtserialport/series1
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtsvg.nix10
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qttools.patch71
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qttools/cmake-paths.patch88
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qttools/default.nix16
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qttools/series1
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qttranslations.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwayland.nix13
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwebchannel.nix11
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwebengine-paxmark-mksnapshot.patch (renamed from pkgs/development/libraries/qt-5/5.9/qtwebengine/qtwebengine-paxmark-mksnapshot.patch)0
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwebengine/default.nix117
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwebkit.patch77
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwebkit/default.nix40
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-dlopen-gtk.patch64
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-dlopen-udev.patch0
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-icucore-darwin.patch13
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwebkit/series3
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtwebsockets.nix10
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtx11extras.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtxmlpatterns.nix6
58 files changed, 1345 insertions, 2019 deletions
diff --git a/pkgs/development/libraries/qt-5/5.9/default.nix b/pkgs/development/libraries/qt-5/5.9/default.nix
index 8f9be38fc882..879f7f198c92 100644
--- a/pkgs/development/libraries/qt-5/5.9/default.nix
+++ b/pkgs/development/libraries/qt-5/5.9/default.nix
@@ -36,96 +36,68 @@ let
   mirror = "http://download.qt.io";
   srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
 
-  mkDerivation = args:
-    stdenv.mkDerivation (args // {
-
-      qmakeFlags =
-        (args.qmakeFlags or [])
-        ++ optional (debug != null)
-           (if debug then "CONFIG+=debug" else "CONFIG+=release");
-
-      cmakeFlags =
-        (args.cmakeFlags or [])
-        ++ [ "-DBUILD_TESTING=OFF" ]
-        ++ optional (debug != null)
-           (if debug then "-DCMAKE_BUILD_TYPE=Debug"
-                     else "-DCMAKE_BUILD_TYPE=Release");
-
-      enableParallelBuilding = args.enableParallelBuilding or true;
-
-    });
-
-  qtSubmodule = args:
-    let
-      inherit (args) name;
-      version = args.version or srcs."${name}".version;
-      src = args.src or srcs."${name}".src;
-    in mkDerivation (args // {
-      name = "${name}-${version}";
-      inherit src;
-
-      propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
-      nativeBuildInputs =
-        (args.nativeBuildInputs or [])
-        ++ [ perl self.qmake ];
-
-      NIX_QT_SUBMODULE = args.NIX_QT_SUBMODULE or true;
-
-      outputs = args.outputs or [ "out" "dev" ];
-      setOutputFlags = args.setOutputFlags or false;
-
-      setupHook = ../qtsubmodule-setup-hook.sh;
-
-      meta = {
-        homepage = http://www.qt.io;
-        description = "A cross-platform application framework for C++";
-        license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
-        maintainers = with maintainers; [ qknight ttuegel periklis ];
-        platforms = platforms.unix;
-      } // (args.meta or {});
-    });
+  patches = {
+    qtbase = [ ./qtbase.patch ];
+    qtdeclarative = [ ./qtdeclarative.patch ];
+    qtscript = [ ./qtscript.patch ];
+    qtserialport = [ ./qtserialport.patch ];
+    qttools = [ ./qttools.patch ];
+    qtwebengine = optional stdenv.needsPax ./qtwebengine-paxmark-mksnapshot.patch;
+    qtwebkit = [ ./qtwebkit.patch ];
+  };
+
+  mkDerivation =
+    import ../mkDerivation.nix
+    { inherit stdenv; inherit (stdenv) lib; }
+    { inherit debug; };
+
+  qtModule =
+    import ../qtModule.nix
+    { inherit mkDerivation perl; inherit (stdenv) lib; }
+    { inherit self srcs patches; };
 
   addPackages = self: with self;
     let
-      callPackage = self.newScope { inherit qtCompatVersion qtSubmodule srcs; };
+      callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
     in {
 
       inherit mkDerivation;
 
-      qtbase = callPackage ./qtbase {
+      qtbase = callPackage ../modules/qtbase.nix {
         inherit (srcs.qtbase) src version;
+        patches = patches.qtbase;
         inherit bison cups harfbuzz mesa;
-        inherit dconf gtk3;
+        withGtk3 = true; inherit dconf gtk3;
         inherit developerBuild decryptSslTraffic;
       };
 
-      qtcharts = callPackage ./qtcharts.nix {};
-      qtconnectivity = callPackage ./qtconnectivity.nix {};
-      qtdeclarative = callPackage ./qtdeclarative {};
-      qtdoc = callPackage ./qtdoc.nix {};
-      qtgraphicaleffects = callPackage ./qtgraphicaleffects.nix {};
-      qtimageformats = callPackage ./qtimageformats.nix {};
-      qtlocation = callPackage ./qtlocation.nix {};
-      qtmacextras = callPackage ./qtmacextras.nix {};
-      qtmultimedia = callPackage ./qtmultimedia.nix {
+      qtcharts = callPackage ../modules/qtcharts.nix {};
+      qtconnectivity = callPackage ../modules/qtconnectivity.nix {};
+      qtdeclarative = callPackage ../modules/qtdeclarative.nix {};
+      qtdoc = callPackage ../modules/qtdoc.nix {};
+      qtgraphicaleffects = callPackage ../modules/qtgraphicaleffects.nix {};
+      qtimageformats = callPackage ../modules/qtimageformats.nix {};
+      qtlocation = callPackage ../modules/qtlocation.nix {};
+      qtmacextras = callPackage ../modules/qtmacextras.nix {};
+      qtmultimedia = callPackage ../modules/qtmultimedia.nix {
         inherit gstreamer gst-plugins-base;
       };
       qtquick1 = null;
-      qtquickcontrols = callPackage ./qtquickcontrols.nix {};
-      qtquickcontrols2 = callPackage ./qtquickcontrols2.nix {};
-      qtscript = callPackage ./qtscript {};
-      qtsensors = callPackage ./qtsensors.nix {};
-      qtserialport = callPackage ./qtserialport {};
-      qtsvg = callPackage ./qtsvg.nix {};
-      qttools = callPackage ./qttools {};
-      qttranslations = callPackage ./qttranslations.nix {};
-      qtwayland = callPackage ./qtwayland.nix {};
-      qtwebchannel = callPackage ./qtwebchannel.nix {};
-      qtwebengine = callPackage ./qtwebengine {};
-      qtwebkit = callPackage ./qtwebkit {};
-      qtwebsockets = callPackage ./qtwebsockets.nix {};
-      qtx11extras = callPackage ./qtx11extras.nix {};
-      qtxmlpatterns = callPackage ./qtxmlpatterns.nix {};
+      qtquickcontrols = callPackage ../modules/qtquickcontrols.nix {};
+      qtquickcontrols2 = callPackage ../modules/qtquickcontrols2.nix {};
+      qtscript = callPackage ../modules/qtscript.nix {};
+      qtsensors = callPackage ../modules/qtsensors.nix {};
+      qtserialport = callPackage ../modules/qtserialport.nix {};
+      qtsvg = callPackage ../modules/qtsvg.nix {};
+      qttools = callPackage ../modules/qttools.nix {};
+      qttranslations = callPackage ../modules/qttranslations.nix {};
+      qtwayland = callPackage ../modules/qtwayland.nix {};
+      qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
+      qtwebengine = callPackage ../modules/qtwebengine.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
+      qtx11extras = callPackage ../modules/qtx11extras.nix {};
+      qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
 
       env = callPackage ../qt-env.nix {};
       full = env "qt-${qtbase.version}" ([
@@ -138,8 +110,12 @@ let
 
       qmake = makeSetupHook {
         deps = [ self.qtbase.dev ];
-        substitutions = { inherit (stdenv) isDarwin; };
-      } ../qmake-hook.sh;
+        substitutions = {
+          inherit (stdenv) isDarwin;
+          qtbase_dev = self.qtbase.dev;
+          fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
+        };
+      } ../hooks/qmake-hook.sh;
     };
 
    self = makeScope newScope addPackages;
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase.patch b/pkgs/development/libraries/qt-5/5.9/qtbase.patch
new file mode 100644
index 000000000000..4f6ed98ba29c
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.9/qtbase.patch
@@ -0,0 +1,1106 @@
+diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
+index 5208379f9a..92fe29a0ac 100644
+--- a/mkspecs/common/mac.conf
++++ b/mkspecs/common/mac.conf
+@@ -23,7 +23,7 @@ QMAKE_INCDIR_OPENGL     = \
+ 
+ QMAKE_FIX_RPATH         = install_name_tool -id
+ 
+-QMAKE_LFLAGS_RPATH      = -Wl,-rpath,
++QMAKE_LFLAGS_RPATH      =
+ QMAKE_LFLAGS_GCSECTIONS = -Wl,-dead_strip
+ 
+ QMAKE_LFLAGS_REL_RPATH  =
+diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
+index bb5083c925..da8e2cb386 100644
+--- a/mkspecs/features/create_cmake.prf
++++ b/mkspecs/features/create_cmake.prf
+@@ -21,7 +21,7 @@ load(cmake_functions)
+ # at cmake time whether package has been found via a symlink, and correct
+ # that to an absolute path. This is only done for installations to
+ # the /usr or / prefix.
+-CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$[QT_INSTALL_LIBS])
++CMAKE_INSTALL_LIBS_DIR = $$cmakeTargetPath($$NIX_OUTPUT_OUT/lib/)
+ contains(CMAKE_INSTALL_LIBS_DIR, ^(/usr)?/lib(64)?.*): CMAKE_USR_MOVE_WORKAROUND = $$CMAKE_INSTALL_LIBS_DIR
+ 
+ CMAKE_OUT_DIR = $$MODULE_BASE_OUTDIR/lib/cmake
+@@ -47,47 +47,22 @@ split_incpath {
+         $$cmake_extra_source_includes.output
+ }
+ 
+-CMAKE_INCLUDE_DIR = $$cmakeRelativePath($$[QT_INSTALL_HEADERS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_INCLUDE_DIR, "^\\.\\./.*") {
+-    CMAKE_INCLUDE_DIR = $$[QT_INSTALL_HEADERS]/
+-    CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_INCLUDE_DIR = $$NIX_OUTPUT_DEV/include/
++CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+ 
+ !exists($$first(QT.$${MODULE}_private.includes)): CMAKE_NO_PRIVATE_INCLUDES = true
+ 
+-CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
+-    CMAKE_LIB_DIR = $$[QT_INSTALL_LIBS]/
+-    CMAKE_LIB_DIR_IS_ABSOLUTE = True
+-} else {
+-    CMAKE_RELATIVE_INSTALL_LIBS_DIR = $$cmakeRelativePath($$[QT_INSTALL_PREFIX], $$[QT_INSTALL_LIBS])
+-    # We need to go up another two levels because the CMake files are
+-    # installed in $${CMAKE_LIB_DIR}/cmake/Qt5$${CMAKE_MODULE_NAME}
+-    CMAKE_RELATIVE_INSTALL_DIR = "$${CMAKE_RELATIVE_INSTALL_LIBS_DIR}../../"
+-}
++CMAKE_LIB_DIR = $$NIX_OUTPUT_DEV/lib/
++CMAKE_LIB_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_BIN_DIR = $$cmakeRelativePath($$[QT_HOST_BINS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_BIN_DIR, "^\\.\\./.*") {
+-    CMAKE_BIN_DIR = $$[QT_HOST_BINS]/
+-    CMAKE_BIN_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_BIN_DIR = $$NIX_OUTPUT_BIN/bin/
++CMAKE_BIN_DIR_IS_ABSOLUTE = True
+ 
+-CMAKE_PLUGIN_DIR = $$cmakeRelativePath($$[QT_INSTALL_PLUGINS], $$[QT_INSTALL_PREFIX])
+-contains(CMAKE_PLUGIN_DIR, "^\\.\\./.*") {
+-    CMAKE_PLUGIN_DIR = $$[QT_INSTALL_PLUGINS]/
+-    CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
+-}
++CMAKE_PLUGIN_DIR = $$NIX_OUTPUT_PLUGIN/
++CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
+ 
+-win32:!static:!staticlib {
+-    CMAKE_DLL_DIR = $$cmakeRelativePath($$[QT_INSTALL_BINS], $$[QT_INSTALL_PREFIX])
+-    contains(CMAKE_DLL_DIR, "^\\.\\./.*") {
+-        CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/
+-        CMAKE_DLL_DIR_IS_ABSOLUTE = True
+-    }
+-} else {
+-    CMAKE_DLL_DIR = $$CMAKE_LIB_DIR
+-    CMAKE_DLL_DIR_IS_ABSOLUTE = $$CMAKE_LIB_DIR_IS_ABSOLUTE
+-}
++CMAKE_DLL_DIR = $$NIX_OUTPUT_DEV/lib/
++CMAKE_DLL_DIR_IS_ABSOLUTE = True
+ 
+ static|staticlib:CMAKE_STATIC_TYPE = true
+ 
+@@ -167,7 +142,7 @@ contains(CONFIG, plugin) {
+       cmake_target_file
+ 
+     cmake_qt5_plugin_file.files = $$cmake_target_file.output
+-    cmake_qt5_plugin_file.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
++    cmake_qt5_plugin_file.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
+     INSTALLS += cmake_qt5_plugin_file
+ 
+     return()
+@@ -314,7 +289,7 @@ exists($$cmake_macros_file.input) {
+     cmake_qt5_module_files.files += $$cmake_macros_file.output
+ }
+ 
+-cmake_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5$${CMAKE_MODULE_NAME}
++cmake_qt5_module_files.path = $$NIX_OUTPUT_OUT/lib/cmake/Qt5$${CMAKE_MODULE_NAME}
+ 
+ # We are generating cmake files. Most developers of Qt are not aware of cmake,
+ # so we require automatic tests to be available. The only module which should
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index 17da8b979e..d648ab4058 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/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}.VERSION)")
+@@ -58,11 +34,7 @@ endmacro()
+ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
+     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}\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_DLL_DIR}${LIB_LOCATION}\")
+-!!ENDIF
+     _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+     set_target_properties(Qt5::$${CMAKE_MODULE_NAME} PROPERTIES
+         \"INTERFACE_LINK_LIBRARIES\" \"${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}\"
+@@ -75,11 +47,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
+     )
+ 
+ !!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
+@@ -95,24 +63,13 @@ 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\"
++      \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
++      \"$${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}\")
+-!!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}\"
++        \"$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
++        \"$${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 \"\")
+@@ -128,7 +85,6 @@ 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
+@@ -280,25 +236,13 @@ 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}\"
+-!!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}\" )
+-!!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()
+@@ -317,25 +261,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+ !!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}\"
+-!!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}\" )
+-!!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()
+@@ -354,11 +286,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
+         _qt5_$${CMAKE_MODULE_NAME}_check_file_exists(${imported_location})
+         set_target_properties(Qt5::${Plugin} PROPERTIES
+             \"IMPORTED_LOCATION_${Configuration}\" ${imported_location}
+diff --git a/mkspecs/features/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
+index 395ac34001..a0e5c68b7e 100644
+--- a/mkspecs/features/mac/default_post.prf
++++ b/mkspecs/features/mac/default_post.prf
+@@ -24,165 +24,3 @@ qt {
+         }
+     }
+ }
+-
+-# Add the same default rpaths as Xcode does for new projects.
+-# This is especially important for iOS/tvOS/watchOS where no other option is possible.
+-!no_default_rpath {
+-    QMAKE_RPATHDIR += @executable_path/Frameworks
+-    equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks
+-}
+-
+-# Don't pass -headerpad_max_install_names when using Bitcode.
+-# In that case the linker emits a warning stating that the flag is ignored when
+-# used with bitcode, for reasons that cannot be determined (rdar://problem/20748962).
+-# Using this flag is also unnecessary in practice on UIKit platforms since they
+-# are sandboxed, and only UIKit platforms support bitcode to begin with.
+-!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
+-
+-app_extension_api_only {
+-    QMAKE_CFLAGS              += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_CXXFLAGS            += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_CXXFLAGS_PRECOMPILE += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-    QMAKE_LFLAGS              += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
+-}
+-
+-macx-xcode {
+-    !isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
+-        debug_information_format.name = DEBUG_INFORMATION_FORMAT
+-        debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT
+-        debug_information_format.build = debug
+-        QMAKE_MAC_XCODE_SETTINGS += debug_information_format
+-    }
+-
+-    QMAKE_XCODE_ARCHS =
+-
+-    arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
+-    arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
+-    QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
+-    QMAKE_MAC_XCODE_SETTINGS += arch_device
+-
+-    simulator {
+-        arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
+-        arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
+-        QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS
+-        QMAKE_MAC_XCODE_SETTINGS += arch_simulator
+-    }
+-
+-    only_active_arch.name = ONLY_ACTIVE_ARCH
+-    only_active_arch.value = YES
+-    only_active_arch.build = debug
+-    QMAKE_MAC_XCODE_SETTINGS += only_active_arch
+-} else {
+-    device|!simulator: VALID_DEVICE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS
+-    simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS
+-    VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS
+-
+-    isEmpty(VALID_ARCHS): \
+-        error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture")
+-
+-    single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
+-
+-    ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
+-    ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
+-
+-    QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
+-
+-    arch_flags = $(EXPORT_ARCH_ARGS)
+-
+-    QMAKE_CFLAGS += $$arch_flags
+-    QMAKE_CXXFLAGS += $$arch_flags
+-    QMAKE_LFLAGS += $$arch_flags
+-
+-    QMAKE_PCH_ARCHS = $$VALID_ARCHS
+-
+-    macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
+-    ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
+-    tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
+-    watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
+-
+-    # If we're doing a simulator and device build, device and simulator
+-    # architectures use different paths and flags for the sysroot and
+-    # deployment target switch, so we must multiplex them across multiple
+-    # architectures using -Xarch. Otherwise we fall back to the simple path.
+-    # This is not strictly necessary, but results in cleaner command lines
+-    # and makes it easier for people to override EXPORT_VALID_ARCHS to limit
+-    # individual rules to a different set of architecture(s) from the overall
+-    # build (such as machtest in QtCore).
+-    simulator:device {
+-        QMAKE_XARCH_CFLAGS =
+-        QMAKE_XARCH_LFLAGS =
+-        QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
+-
+-        for (arch, VALID_ARCHS) {
+-            contains(VALID_SIMULATOR_ARCHS, $$arch) {
+-                sdk = $$simulator.sdk
+-                version_identifier = $$simulator.deployment_identifier
+-            } else {
+-                sdk = $$device.sdk
+-                version_identifier = $$device.deployment_identifier
+-            }
+-
+-            version_min_flags = \
+-                -Xarch_$${arch} \
+-                -m$${version_identifier}-version-min=$$deployment_target
+-            QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \
+-                -Xarch_$${arch} \
+-                -isysroot$$xcodeSDKInfo(Path, $$sdk)
+-            QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
+-                -Xarch_$${arch} \
+-                -Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk)
+-
+-            QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
+-            QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch})
+-
+-            QMAKE_EXTRA_VARIABLES += \
+-                QMAKE_XARCH_CFLAGS_$${arch} \
+-                QMAKE_XARCH_LFLAGS_$${arch}
+-        }
+-
+-        QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+-        QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
+-        QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
+-    } else {
+-        simulator: \
+-            version_identifier = $$simulator.deployment_identifier
+-        else: \
+-            version_identifier = $$device.deployment_identifier
+-        version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
+-        QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
+-        QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
+-        QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag
+-    }
+-
+-    # Enable precompiled headers for multiple architectures
+-    QMAKE_CFLAGS_USE_PRECOMPILE =
+-    for (arch, VALID_ARCHS) {
+-        icc_pch_style: \
+-            use_flag = "-pch-use "
+-        else: \
+-            use_flag = -include
+-
+-        # Only use Xarch with multi-arch, as the option confuses ccache
+-        count(VALID_ARCHS, 1, greaterThan): \
+-            QMAKE_CFLAGS_USE_PRECOMPILE += \
+-                -Xarch_$${arch}
+-
+-        QMAKE_CFLAGS_USE_PRECOMPILE += \
+-            $${use_flag}${QMAKE_PCH_OUTPUT_$${arch}}
+-    }
+-    icc_pch_style {
+-        QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT}
+-        QMAKE_CFLAGS_USE_PRECOMPILE =
+-    } else {
+-        QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-        QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-        QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
+-    }
+-
+-    QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
+-}
+-
+-cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
+-cache(QMAKE_XCODE_VERSION, stash)
+-
+-QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
+diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
+index e21e749ee9..3b01424e67 100644
+--- a/mkspecs/features/mac/default_pre.prf
++++ b/mkspecs/features/mac/default_pre.prf
+@@ -1,51 +1,2 @@
+ CONFIG = asset_catalogs rez $$CONFIG
+ load(default_pre)
+-
+-isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
+-    # Get path of Xcode's Developer directory
+-    QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
+-    isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
+-        error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
+-
+-    # Make sure Xcode path is valid
+-    !exists($$QMAKE_XCODE_DEVELOPER_PATH): \
+-        error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
+-
+-    # Make sure Xcode is set up properly
+-    isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))): \
+-        error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
+-}
+-
+-isEmpty(QMAKE_XCODE_VERSION) {
+-    # Extract Xcode version using xcodebuild
+-    xcode_version = $$system("/usr/bin/xcodebuild -version")
+-    QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
+-    isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
+-    unset(xcode_version)
+-}
+-
+-isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
+-    QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
+-    exists($$QMAKE_XCODE_PREFERENCES_FILE): \
+-        QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")
+-
+-    !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
+-        cache(QMAKE_TARGET_BUNDLE_PREFIX)
+-}
+-
+-QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon
+-
+-# Make the default debug info format for static debug builds
+-# DWARF instead of DWARF with dSYM. This cuts down build times
+-# for application debug builds significantly, as Xcode doesn't
+-# have to pull out all the DWARF info from the Qt static libs
+-# and put it into a dSYM file. We don't need that dSYM file in
+-# the first place, since the information is available in the
+-# object files inside the archives (static libraries).
+-macx-xcode:qtConfig(static): \
+-    QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf
+-
+-# This variable is used by the xcode_dynamic_library_suffix
+-# feature, which allows Xcode to choose the Qt libraries to link to
+-# at build time, depending on the current Xcode SDK and configuration.
+-QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
+diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
+index 68ab7e4053..e69de29bb2 100644
+--- a/mkspecs/features/mac/sdk.prf
++++ b/mkspecs/features/mac/sdk.prf
+@@ -1,49 +0,0 @@
+-
+-isEmpty(QMAKE_MAC_SDK): \
+-    error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.")
+-
+-contains(QMAKE_MAC_SDK, .*/.*): \
+-    error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
+-
+-defineReplace(xcodeSDKInfo) {
+-    info = $$1
+-    sdk = $$2
+-    isEmpty(sdk): \
+-        sdk = $$QMAKE_MAC_SDK
+-
+-    isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
+-        QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcodebuild -sdk $$sdk -version $$info 2>/dev/null")
+-        isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}): error("Could not resolve SDK $$info for \'$$sdk\'")
+-        cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
+-    }
+-
+-    return($$eval(QMAKE_MAC_SDK.$${sdk}.$${info}))
+-}
+-
+-QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
+-QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
+-QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
+-
+-sysrootified =
+-for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
+-QMAKE_INCDIR_OPENGL = $$sysrootified
+-
+-QMAKESPEC_NAME = $$basename(QMAKESPEC)
+-
+-# Resolve SDK version of various tools
+-for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_ACTOOL)) {
+-    tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool}
+-    !isEmpty($$tool_variable) {
+-        $$tool = $$eval($$tool_variable)
+-        next()
+-    }
+-
+-    value = $$eval($$tool)
+-    isEmpty(value): next()
+-
+-    sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
+-    isEmpty(sysrooted): next()
+-
+-    $$tool = $$sysrooted $$member(value, 1, -1)
+-    cache($$tool_variable, set stash, $$tool)
+-}
+diff --git a/mkspecs/features/qml_module.prf b/mkspecs/features/qml_module.prf
+index 4db0040dc5..65d6da1f4d 100644
+--- a/mkspecs/features/qml_module.prf
++++ b/mkspecs/features/qml_module.prf
+@@ -23,13 +23,8 @@ for(qmlf, AUX_QML_FILES): fq_aux_qml_files += $$absolute_path($$qmlf, $$_PRO_FIL
+ 
+ load(qt_build_paths)
+ 
+-qml1_target {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_IMPORTS]
+-} else {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_QML]
+-}
++DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
++instbase = $$NIX_OUTPUT_QML
+ 
+ !qml1_target:static: CONFIG += builtin_resources
+ 
+diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
+index d49f4c49c1..097dcd7d39 100644
+--- a/mkspecs/features/qml_plugin.prf
++++ b/mkspecs/features/qml_plugin.prf
+@@ -48,13 +48,8 @@ exists($$QMLTYPEFILE): AUX_QML_FILES += $$QMLTYPEFILE
+ 
+ load(qt_build_paths)
+ 
+-qml1_target {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/imports/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_IMPORTS]
+-} else {
+-    DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+-    instbase = $$[QT_INSTALL_QML]
+-}
++DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
++instbase = $$NIX_OUTPUT_QML
+ 
+ target.path = $$instbase/$$TARGETPATH
+ INSTALLS += target
+diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf
+index cb84ae0da8..45e16f4302 100644
+--- a/mkspecs/features/qt_app.prf
++++ b/mkspecs/features/qt_app.prf
+@@ -29,7 +29,7 @@ host_build:force_bootstrap {
+     target.path = $$[QT_HOST_BINS]
+ } else {
+     !build_pass:qtConfig(debug_and_release): CONFIG += release
+-    target.path = $$[QT_INSTALL_BINS]
++    target.path = $$NIX_OUTPUT_BIN/bin
+     CONFIG += relative_qt_rpath  # Qt's tools and apps should be relocatable
+ }
+ INSTALLS += target
+diff --git a/mkspecs/features/qt_build_paths.prf b/mkspecs/features/qt_build_paths.prf
+index 1848f00e90..2af93675c5 100644
+--- a/mkspecs/features/qt_build_paths.prf
++++ b/mkspecs/features/qt_build_paths.prf
+@@ -23,6 +23,6 @@ exists($$MODULE_BASE_INDIR/.git): \
+ !force_independent {
+     # If the module is not built independently, everything ends up in qtbase.
+     # This is the case in non-prefix builds, except for selected modules.
+-    MODULE_BASE_OUTDIR = $$[QT_HOST_PREFIX]
+-    MODULE_QMAKE_OUTDIR = $$[QT_HOST_PREFIX]
++    MODULE_BASE_OUTDIR = $$NIX_OUTPUT_OUT
++    MODULE_QMAKE_OUTDIR = $$NIX_OUTPUT_OUT
+ }
+diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
+index 1e138730b3..b7ba74dc3f 100644
+--- a/mkspecs/features/qt_common.prf
++++ b/mkspecs/features/qt_common.prf
+@@ -32,8 +32,8 @@ contains(TEMPLATE, .*lib) {
+         qqt_libdir = \$\$\$\$[QT_HOST_LIBS]
+         qt_libdir = $$[QT_HOST_LIBS]
+     } else {
+-        qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS]
+-        qt_libdir = $$[QT_INSTALL_LIBS]
++        qqt_libdir = \$\$\$\$NIX_OUTPUT_OUT/lib
++        qt_libdir = $$NIX_OUTPUT_OUT/lib
+     }
+     contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) {
+         lib_replace.match = "[^ ']*$$rplbase/lib"
+diff --git a/mkspecs/features/qt_docs.prf b/mkspecs/features/qt_docs.prf
+index 72dde61a40..f891a2baed 100644
+--- a/mkspecs/features/qt_docs.prf
++++ b/mkspecs/features/qt_docs.prf
+@@ -45,7 +45,7 @@ QMAKE_DOCS_OUTPUTDIR = $$QMAKE_DOCS_BASE_OUTDIR/$$QMAKE_DOCS_TARGETDIR
+ 
+ QDOC += -outputdir $$shell_quote($$QMAKE_DOCS_OUTPUTDIR)
+ !build_online_docs: \
+-    QDOC += -installdir $$shell_quote($$[QT_INSTALL_DOCS])
++    QDOC += -installdir $$shell_quote($$NIX_OUTPUT_DOC)
+ PREP_DOC_INDEXES =
+ DOC_INDEXES =
+ !isEmpty(QTREPOS) {
+@@ -64,8 +64,8 @@ DOC_INDEXES =
+         DOC_INDEXES += -indexdir $$shell_quote($$qrep/doc)
+ } else {
+     prepare_docs: \
+-        PREP_DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
+-    DOC_INDEXES += -indexdir $$shell_quote($$[QT_INSTALL_DOCS/get])
++        PREP_DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
++    DOC_INDEXES += -indexdir $$shell_quote($$NIX_OUTPUT_DOC)
+ }
+ 
+ qtattributionsscanner.target = qtattributionsscanner
+@@ -88,12 +88,12 @@ prepare_docs {
+     qch_docs.commands = $$QHELPGENERATOR $$shell_quote($$QMAKE_DOCS_OUTPUTDIR/$${QMAKE_DOCS_TARGET}.qhp) -o $$shell_quote($$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch)
+ 
+     inst_html_docs.files = $$QMAKE_DOCS_OUTPUTDIR
+-    inst_html_docs.path = $$[QT_INSTALL_DOCS]
++    inst_html_docs.path = $$NIX_OUTPUT_DOC
+     inst_html_docs.CONFIG += no_check_exist directory no_default_install no_build
+     INSTALLS += inst_html_docs
+ 
+     inst_qch_docs.files = $$QMAKE_DOCS_BASE_OUTDIR/$${QMAKE_DOCS_TARGET}.qch
+-    inst_qch_docs.path = $$[QT_INSTALL_DOCS]
++    inst_qch_docs.path = $$NIX_OUTPUT_DOC
+     inst_qch_docs.CONFIG += no_check_exist no_default_install no_build
+     INSTALLS += inst_qch_docs
+ 
+diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf
+index 0a008374e5..5e7cd92f6f 100644
+--- a/mkspecs/features/qt_example_installs.prf
++++ b/mkspecs/features/qt_example_installs.prf
+@@ -73,7 +73,7 @@ probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples)
+         $$SOURCES $$HEADERS $$FORMS $$RESOURCES $$TRANSLATIONS \
+         $$DBUS_ADAPTORS $$DBUS_INTERFACES
+     addInstallFiles(sources.files, $$sourcefiles)
+-    sources.path = $$[QT_INSTALL_EXAMPLES]/$$probase
++    sources.path = $$NIX_OUTPUT_DEV/share/examples/$$probase
+     INSTALLS += sources
+ 
+     check_examples {
+diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf
+index c00fdb73f8..6d8ba132cb 100644
+--- a/mkspecs/features/qt_functions.prf
++++ b/mkspecs/features/qt_functions.prf
+@@ -69,7 +69,7 @@ defineTest(qtHaveModule) {
+ defineTest(qtPrepareTool) {
+     cmd = $$eval(QT_TOOL.$${2}.binary)
+     isEmpty(cmd) {
+-        cmd = $$[QT_HOST_BINS]/$$2
++        cmd = $$system("type -p $$2")
+         exists($${cmd}.pl) {
+             $${1}_EXE = $${cmd}.pl
+             cmd = perl -w $$system_path($${cmd}.pl)
+diff --git a/mkspecs/features/qt_installs.prf b/mkspecs/features/qt_installs.prf
+index 0d3dfb6b93..5f935b4424 100644
+--- a/mkspecs/features/qt_installs.prf
++++ b/mkspecs/features/qt_installs.prf
+@@ -12,16 +12,10 @@
+ #library
+ !qt_no_install_library {
+     win32 {
+-       host_build: \
+-           dlltarget.path = $$[QT_HOST_BINS]
+-       else: \
+-           dlltarget.path = $$[QT_INSTALL_BINS]
++        dlltarget.path = $$NIX_OUTPUT_BIN/bin
+        INSTALLS += dlltarget
+     }
+-    host_build: \
+-        target.path = $$[QT_HOST_LIBS]
+-    else: \
+-        target.path = $$[QT_INSTALL_LIBS]
++    target.path = $$NIX_OUTPUT_OUT/lib
+     !static: target.CONFIG = no_dll
+     INSTALLS += target
+ }
+@@ -29,33 +23,33 @@
+ #headers
+ qt_install_headers {
+     class_headers.files = $$SYNCQT.HEADER_CLASSES
+-    class_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    class_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += class_headers
+ 
+     targ_headers.files = $$SYNCQT.HEADER_FILES
+-    targ_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    targ_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += targ_headers
+ 
+     private_headers.files = $$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.INJECTED_PRIVATE_HEADER_FILES
+-    private_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
++    private_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/private
+     INSTALLS += private_headers
+ 
+     qpa_headers.files = $$SYNCQT.QPA_HEADER_FILES
+-    qpa_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
++    qpa_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME/$$VERSION/$$MODULE_INCNAME/qpa
+     INSTALLS += qpa_headers
+ }
+ 
+ #module
+ qt_install_module {
+     !isEmpty(MODULE_PRI) {
+-        pritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
++        pritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
+         pritarget.files = $$MODULE_PRI
+         INSTALLS += pritarget
+     } else: isEmpty(MODULE_PRIVATE_PRI) {
+         warning("Project $$basename(_PRO_FILE_) is a module, but has not defined MODULE_PRI, which is required for Qt to expose the module to other projects.")
+     }
+     !isEmpty(MODULE_PRIVATE_PRI) {
+-        privpritarget.path = $$[QT_HOST_DATA]/mkspecs/modules
++        privpritarget.path = $$NIX_OUTPUT_DEV/mkspecs/modules
+         privpritarget.files = $$MODULE_PRIVATE_PRI
+         INSTALLS += privpritarget
+     }
+diff --git a/mkspecs/features/qt_plugin.prf b/mkspecs/features/qt_plugin.prf
+index 62e1b69fde..abd63123f9 100644
+--- a/mkspecs/features/qt_plugin.prf
++++ b/mkspecs/features/qt_plugin.prf
+@@ -88,7 +88,7 @@ CONFIG(static, static|shared)|prefix_build {
+     }
+ }
+ 
+-target.path = $$[QT_INSTALL_PLUGINS]/$$PLUGIN_TYPE
++target.path = $$NIX_OUTPUT_PLUGIN/$$PLUGIN_TYPE
+ INSTALLS += target
+ 
+ TARGET = $$qt5LibraryTarget($$TARGET)
+diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
+index 545b9a3d1e..6ac0cdefe4 100644
+--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ b/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_OUTPUT_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_OUTPUT_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_OUTPUT_DEV/$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}rcc$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
+@@ -133,7 +133,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_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_RELEASE}\")
+ !!ENDIF
+@@ -147,7 +147,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_OUTPUT_DEV/$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_LIB_DIR}$${CMAKE_WINMAIN_FILE_LOCATION_DEBUG}\")
+ !!ENDIF
+diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
+index c357237d0e..6f0c75de3c 100644
+--- a/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
++++ b/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_OUTPUT_DEV/$${CMAKE_HOST_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_HOST_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff --git a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in b/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
+index 706304cf34..546420f6ad 100644
+--- a/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
++++ b/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_OUTPUT_DEV/$${CMAKE_INSTALL_DATA_DIR}/mkspecs/$${CMAKE_MKSPEC}\")
+ !!ELSE
+ set(_qt5_corelib_extra_includes \"$${CMAKE_INSTALL_DATA_DIR}mkspecs/$${CMAKE_MKSPEC}\")
+ !!ENDIF
+diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
+index 39e7c71a9c..dced1f2811 100644
+--- a/src/corelib/kernel/qcoreapplication.cpp
++++ b/src/corelib/kernel/qcoreapplication.cpp
+@@ -2533,6 +2533,15 @@ QStringList QCoreApplication::libraryPaths()
+         QStringList *app_libpaths = new QStringList;
+         coreappdata()->app_libpaths.reset(app_libpaths);
+ 
++        // Add library paths derived from PATH
++        const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++        const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
++        for (const QString &path: paths) {
++            if (!path.isEmpty()) {
++                app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
++            }
++        }
++
+         const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
+         if (!libPathEnv.isEmpty()) {
+             QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);
+diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
+index 1714c9802f..fd2ebb1336 100644
+--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
++++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
+@@ -70,7 +70,11 @@ typedef QHash<QByteArray, QTzTimeZone> QTzTimeZoneHash;
+ // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
+ static QTzTimeZoneHash loadTzTimeZones()
+ {
+-    QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
++    // Try TZDIR first, in case we're running on NixOS.
++    QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab");
++    // Fallback to traditional paths in case we are not on NixOS.
++    if (!QFile::exists(path))
++        path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
+     if (!QFile::exists(path))
+         path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
+ 
+@@ -643,12 +647,16 @@ void QTzTimeZonePrivate::init(const QByteArray &ianaId)
+         if (!tzif.open(QIODevice::ReadOnly))
+             return;
+     } else {
+-        // Open named tz, try modern path first, if fails try legacy path
+-        tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++        // Try TZDIR first, in case we're running on NixOS
++        tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
+         if (!tzif.open(QIODevice::ReadOnly)) {
+-            tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+-            if (!tzif.open(QIODevice::ReadOnly))
+-                return;
++            // Open named tz, try modern path first, if fails try legacy path
++            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++            if (!tzif.open(QIODevice::ReadOnly)) {
++                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++                if (!tzif.open(QIODevice::ReadOnly))
++                    return;
++            }
+         }
+     }
+ 
+diff --git a/src/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in
+index 1d947159e2..b36865fc48 100644
+--- a/src/dbus/Qt5DBusConfigExtras.cmake.in
++++ b/src/dbus/Qt5DBusConfigExtras.cmake.in
+@@ -2,11 +2,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\")
+-!!ELSE
+-    set(imported_location \"$${CMAKE_BIN_DIR}qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbuscpp2xml$$CMAKE_BIN_SUFFIX\")
+     _qt5_DBus_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qdbuscpp2xml PROPERTIES
+@@ -17,11 +13,7 @@ endif()
+ 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\")
+-!!ELSE
+-    set(imported_location \"$${CMAKE_BIN_DIR}qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    set(imported_location \"$$NIX_OUTPUT_DEV/bin/qdbusxml2cpp$$CMAKE_BIN_SUFFIX\")
+     _qt5_DBus_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qdbusxml2cpp PROPERTIES
+diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in
+index 07869efd7d..37b95d1b6b 100644
+--- a/src/gui/Qt5GuiConfigExtras.cmake.in
++++ b/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_OUTPUT_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_properties TargetName Configuration LIB_LOCATIO
+     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_OUTPUT_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_OUTPUT_DEV/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+diff --git a/src/network/kernel/qdnslookup_unix.cpp b/src/network/kernel/qdnslookup_unix.cpp
+index 1da00813ce..0bf877afcb 100644
+--- a/src/network/kernel/qdnslookup_unix.cpp
++++ b/src/network/kernel/qdnslookup_unix.cpp
+@@ -92,7 +92,7 @@ static bool resolveLibraryInternal()
+     if (!lib.load())
+ #endif
+     {
+-        lib.setFileName(QLatin1String("resolv"));
++        lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV));
+         if (!lib.load())
+             return false;
+     }
+diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
+index cf08a15f96..2310488298 100644
+--- a/src/network/kernel/qhostinfo_unix.cpp
++++ b/src/network/kernel/qhostinfo_unix.cpp
+@@ -102,7 +102,7 @@ static bool resolveLibraryInternal()
+     if (!lib.load())
+ #endif
+     {
+-        lib.setFileName(QLatin1String("resolv"));
++        lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV));
+         if (!lib.load())
+             return false;
+     }
+diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp
+index c92d8fc3f8..6008063bcf 100644
+--- a/src/network/ssl/qsslcontext_openssl.cpp
++++ b/src/network/ssl/qsslcontext_openssl.cpp
+@@ -351,7 +351,7 @@ init_context:
+ 
+     const QVector<QSslEllipticCurve> qcurves = sslContext->sslConfiguration.ellipticCurves();
+     if (!qcurves.isEmpty()) {
+-#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
++#if OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
+         // Set the curves to be used
+         if (q_SSLeay() >= 0x10002000L) {
+             // SSL_CTX_ctrl wants a non-const pointer as last argument,
+@@ -364,7 +364,7 @@ init_context:
+                 sslContext->errorCode = QSslError::UnspecifiedError;
+             }
+         } else
+-#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
++#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
+         {
+             // specific curves requested, but not possible to set -> error
+             sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version too old, need at least v1.0.2"));
+diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+index ca9f7af127..a337ad73bf 100644
+--- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
++++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+@@ -265,12 +265,9 @@ void TableGenerator::initPossibleLocations()
+     m_possibleLocations.reserve(7);
+     if (qEnvironmentVariableIsSet("QTCOMPOSE"))
+         m_possibleLocations.append(QString::fromLocal8Bit(qgetenv("QTCOMPOSE")));
+-    m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/share/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale"));
+-    m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale"));
+     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale"));
++    m_possibleLocations.append(QLatin1String(NIXPKGS_QTCOMPOSE));
+ }
+ 
+ QString TableGenerator::findComposeFile()
+diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+index 7640a711a9..ef9a14d38b 100644
+--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
++++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
+@@ -580,7 +580,14 @@ QFunctionPointer QGLXContext::getProcAddress(const char *procName)
+ #if QT_CONFIG(library)
+                 extern const QString qt_gl_library_name();
+ //                QLibrary lib(qt_gl_library_name());
++                // Check system library paths first
+                 QLibrary lib(QLatin1String("GL"));
++#ifdef NIXPKGS_MESA_GL
++                if (!lib.load()) {
++                    // Fallback to Mesa driver
++                    lib.setFileName(QLatin1String(NIXPKGS_MESA_GL));
++                }
++#endif // NIXPKGS_MESA_GL
+                 glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
+ #endif
+             }
+diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
+index d257ab1242..75853af4e4 100644
+--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
++++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
+@@ -311,10 +311,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
+ #if defined(XCB_USE_XLIB) && QT_CONFIG(library)
+     static bool function_ptrs_not_initialized = true;
+     if (function_ptrs_not_initialized) {
+-        QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
++        QLibrary xcursorLib(QLatin1String(NIXPKGS_LIBXCURSOR), 1);
+         bool xcursorFound = xcursorLib.load();
+         if (!xcursorFound) { // try without the version number
+-            xcursorLib.setFileName(QLatin1String("Xcursor"));
++            xcursorLib.setFileName(QLatin1String(NIXPKGS_LIBXCURSOR));
+             xcursorFound = xcursorLib.load();
+         }
+         if (xcursorFound) {
+diff --git a/src/plugins/platformthemes/gtk3/main.cpp b/src/plugins/platformthemes/gtk3/main.cpp
+index c4cd66c33b..b6f2691587 100644
+--- a/src/plugins/platformthemes/gtk3/main.cpp
++++ b/src/plugins/platformthemes/gtk3/main.cpp
+@@ -39,6 +39,7 @@
+ 
+ #include <qpa/qplatformthemeplugin.h>
+ #include "qgtk3theme.h"
++#include <QFile>
+ 
+ QT_BEGIN_NAMESPACE
+ 
+@@ -54,8 +55,22 @@ public:
+ QPlatformTheme *QGtk3ThemePlugin::create(const QString &key, const QStringList &params)
+ {
+     Q_UNUSED(params);
+-    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive))
++    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive)) {
++
++#ifdef NIXPKGS_QGTK3_XDG_DATA_DIRS
++        QStringList XDG_DATA_DIRS = QFile::decodeName(qgetenv("XDG_DATA_DIRS")).split(':');
++        XDG_DATA_DIRS << QLatin1String(NIXPKGS_QGTK3_XDG_DATA_DIRS);
++        qputenv("XDG_DATA_DIRS", QFile::encodeName(XDG_DATA_DIRS.join(':')));
++#endif
++
++#ifdef NIXPKGS_QGTK3_GIO_EXTRA_MODULES
++        QStringList GIO_EXTRA_MODULES = QFile::decodeName(qgetenv("GIO_EXTRA_MODULES")).split(':');
++        GIO_EXTRA_MODULES << QLatin1String(NIXPKGS_QGTK3_GIO_EXTRA_MODULES);
++        qputenv("GIO_EXTRA_MODULES", QFile::encodeName(GIO_EXTRA_MODULES.join(':')));
++#endif
++
+         return new QGtk3Theme;
++    }
+ 
+     return 0;
+ }
+diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+index 99d87e2e46..a4eab2aa72 100644
+--- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
++++ b/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_OUTPUT_DEV/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
+ !!ENDIF
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/cmake-paths.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/cmake-paths.patch
deleted file mode 100644
index 9616f5812cfd..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/cmake-paths.patch
+++ /dev/null
@@ -1,359 +0,0 @@
-Index: qtbase-opensource-src-5.9.0/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
-+++ qtbase-opensource-src-5.9.0/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,19 +53,6 @@ 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
- 
-@@ -95,24 +61,24 @@ 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\"
-+      \"@NIX_OUT@/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework\"
-+      \"@NIX_OUT@/$${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}\"
-+        \"@NIX_OUT@/$${CMAKE_LIB_DIR}Qt$${CMAKE_MODULE_NAME}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
-+        \"@NIX_OUT@/$${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_DEV@/$$CMAKE_INCLUDE_DIR\" \"@NIX_DEV@/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}\")
- !!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}\"
-+        \"@NIX_DEV@/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION\"
-+        \"@NIX_DEV@/$${CMAKE_INCLUDE_DIR}$${MODULE_INCNAME}/$$VERSION/$${MODULE_INCNAME}\"
-     )
- !!ELSE
-     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
-@@ -281,7 +247,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
- !!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}\" )
-+    if (EXISTS \"@NIX_OUT@/$${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
-@@ -289,13 +255,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
- !!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
-@@ -318,7 +284,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
- !!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}\" )
-+    if (EXISTS \"@NIX_DEV@/$${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
-@@ -326,13 +292,13 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME
- !!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
-@@ -354,11 +320,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.9.0/src/gui/Qt5GuiConfigExtras.cmake.in
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/gui/Qt5GuiConfigExtras.cmake.in
-+++ qtbase-opensource-src-5.9.0/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.9.0/src/widgets/Qt5WidgetsConfigExtras.cmake.in
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/widgets/Qt5WidgetsConfigExtras.cmake.in
-+++ qtbase-opensource-src-5.9.0/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.9.0/src/corelib/Qt5CoreConfigExtras.cmake.in
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/corelib/Qt5CoreConfigExtras.cmake.in
-+++ qtbase-opensource-src-5.9.0/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
-@@ -133,7 +133,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
-@@ -147,7 +147,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.9.0/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/corelib/Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in
-+++ qtbase-opensource-src-5.9.0/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.9.0/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in
-+++ qtbase-opensource-src-5.9.0/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.9.0/src/dbus/Qt5DBusConfigExtras.cmake.in
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/dbus/Qt5DBusConfigExtras.cmake.in
-+++ qtbase-opensource-src-5.9.0/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.9.0/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
-+++ qtbase-opensource-src-5.9.0/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_BIN@/$${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_BIN@/$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
- !!ENDIF
- 
- list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
-Index: qtbase-opensource-src-5.9.0/mkspecs/features/create_cmake.prf
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/mkspecs/features/create_cmake.prf
-+++ qtbase-opensource-src-5.9.0/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
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/compose-search-path.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/compose-search-path.patch
deleted file mode 100644
index 720e7d81fa22..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/compose-search-path.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Index: qtbase-opensource-src-5.9.0/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
-+++ qtbase-opensource-src-5.9.0/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
-@@ -265,12 +265,9 @@ void TableGenerator::initPossibleLocatio
-     m_possibleLocations.reserve(7);
-     if (qEnvironmentVariableIsSet("QTCOMPOSE"))
-         m_possibleLocations.append(QString::fromLocal8Bit(qgetenv("QTCOMPOSE")));
--    m_possibleLocations.append(QStringLiteral("/usr/share/X11/locale"));
--    m_possibleLocations.append(QStringLiteral("/usr/local/share/X11/locale"));
--    m_possibleLocations.append(QStringLiteral("/usr/lib/X11/locale"));
--    m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale"));
-     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale"));
-     m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale"));
-+    m_possibleLocations.append(QLatin1String(NIXPKGS_QTCOMPOSE));
- }
- 
- QString TableGenerator::findComposeFile()
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/darwin-cf.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/darwin-cf.patch
deleted file mode 100644
index 3e6e0e5101a1..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/darwin-cf.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
-index 341d3bc..3368234 100644
---- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
-+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
-@@ -287,7 +287,7 @@ void QScanThread::getUserConfigurations()
-     QMacAutoReleasePool pool;
-     userProfiles.clear();
- 
--    NSArray<NSString *> *wifiInterfaces = [CWWiFiClient interfaceNames];
-+    NSArray *wifiInterfaces = [CWWiFiClient interfaceNames];
-     for (NSString *ifName in wifiInterfaces) {
- 
-         CWInterface *wifiInterface = [[CWWiFiClient sharedWiFiClient] interfaceWithName:ifName];
-@@ -602,7 +602,7 @@ void QCoreWlanEngine::doRequestUpdate()
- 
-     QMacAutoReleasePool pool;
- 
--    NSArray<NSString *> *wifiInterfaces = [CWWiFiClient interfaceNames];
-+    NSArray *wifiInterfaces = [CWWiFiClient interfaceNames];
-     for (NSString *ifName in wifiInterfaces) {
-             scanThread->interfaceName = QString::fromNSString(ifName);
-             scanThread->start();
- QString TableGenerator::findComposeFile()
-diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
-index 59b7637..b91139d 100644
---- a/src/plugins/platforms/cocoa/qcocoawindow.mm
-+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
-@@ -320,7 +320,7 @@ static void qt_closePopups()
- + (void)applicationActivationChanged:(NSNotification*)notification
- {
-     const id sender = self;
--    NSEnumerator<NSWindow*> *windowEnumerator = nullptr;
-+    NSEnumerator *windowEnumerator = nullptr;
-     NSApplication *application = [NSApplication sharedApplication];
- 
- #if QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_12)
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/darwin-series b/pkgs/development/libraries/qt-5/5.9/qtbase/darwin-series
deleted file mode 100644
index 1111ff65f440..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/darwin-series
+++ /dev/null
@@ -1,3 +0,0 @@
-mkspecs-common-mac.patch
-mkspecs-features-mac.patch
-darwin-cf.patch
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.9/qtbase/default.nix
deleted file mode 100644
index eee55dbded38..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/default.nix
+++ /dev/null
@@ -1,366 +0,0 @@
-{
-  stdenv, lib, copyPathsToStore,
-  src, version, qtCompatVersion,
-
-  coreutils, bison, flex, gdb, gperf, lndir, patchelf, perl, pkgconfig, python2,
-  ruby,
-  # darwin support
-  darwin, libiconv, libcxx,
-
-  dbus, dconf, fontconfig, freetype, glib, gtk3, harfbuzz, icu, libX11, libXcomposite,
-  libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng, libtiff,
-  libxcb, libxkbcommon, libxml2, libxslt, openssl, pcre2, sqlite, udev,
-  xcbutil, xcbutilimage, xcbutilkeysyms, xcbutilrenderutil, xcbutilwm, xlibs,
-  zlib,
-
-  # optional dependencies
-  cups ? null, mysql ? null, postgresql ? null,
-
-  # options
-  mesaSupported ? (!stdenv.isDarwin),
-  mesa,
-  buildExamples ? false,
-  buildTests ? false,
-  developerBuild ? false,
-  decryptSslTraffic ? false
-}:
-
-let
-  system-x86_64 = lib.elem stdenv.system lib.platforms.x86_64;
-in
-
-stdenv.mkDerivation {
-
-  name = "qtbase-${version}";
-  inherit qtCompatVersion src version;
-
-  propagatedBuildInputs =
-    [
-      libxml2 libxslt openssl pcre2 sqlite zlib
-
-      # Text rendering
-      harfbuzz icu
-
-      # Image formats
-      libjpeg libpng libtiff
-    ]
-
-    ++ lib.optional (mesaSupported && !stdenv.isDarwin) mesa
-
-    ++ lib.optionals (!stdenv.isDarwin) [
-      dbus glib udev
-
-      # Text rendering
-      fontconfig freetype
-
-      # X11 libs
-      libX11 libXcomposite libXext libXi libXrender libxcb libxkbcommon xcbutil
-      xcbutilimage xcbutilkeysyms xcbutilrenderutil xcbutilwm
-    ]
-
-    ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
-      AGL AppKit ApplicationServices Carbon Cocoa
-      CoreAudio CoreBluetooth CoreLocation CoreServices
-      DiskArbitration Foundation OpenGL
-      darwin.libobjc libiconv
-    ]);
-
-  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 perl pkgconfig python2 ]
-    ++ lib.optional (!stdenv.isDarwin) patchelf;
-
-  outputs = [ "bin" "dev" "out" ];
-
-  patches =
-    copyPathsToStore (lib.readPathsFromFile ./. ./series)
-    ++ stdenv.lib.optional stdenv.isDarwin (copyPathsToStore (lib.readPathsFromFile ./. ./darwin-series));
-
-  postPatch =
-    ''
-      substituteInPlace configure --replace /bin/pwd pwd
-      substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
-      sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i mkspecs/*/*.conf
-
-      sed -i '/PATHS.*NO_DEFAULT_PATH/ d' src/corelib/Qt5Config.cmake.in
-      sed -i '/PATHS.*NO_DEFAULT_PATH/ d' src/corelib/Qt5CoreMacros.cmake
-      sed -i 's/NO_DEFAULT_PATH//' src/gui/Qt5GuiConfigExtras.cmake.in
-      sed -i '/PATHS.*NO_DEFAULT_PATH/ d' mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
-    ''
-
-    + lib.optionalString (mesaSupported && !stdenv.isDarwin) ''
-      sed -i mkspecs/common/linux.conf \
-          -e "/^QMAKE_INCDIR_OPENGL/ s|$|${mesa.dev or mesa}/include|" \
-          -e "/^QMAKE_LIBDIR_OPENGL/ s|$|${mesa.out}/lib|"
-    ''
-
-    + 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=/nonsense|' \
-          -e 's|sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null)|sysroot=/nonsense|' \
-          -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
-          substituteInPlace ./mkspecs/common/mac.conf \
-              --replace "/System/Library/Frameworks/OpenGL.framework/" "${darwin.apple_sdk.frameworks.OpenGL}/Library/Frameworks/OpenGL.framework/"
-          substituteInPlace ./mkspecs/common/mac.conf \
-              --replace "/System/Library/Frameworks/AGL.framework/" "${darwin.apple_sdk.frameworks.AGL}/Library/Frameworks/AGL.framework/"
-     '';
-     # 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/$qtPluginPrefix \
-        -qmldir $out/$qtQmlPrefix \
-        -docdir $out/$qtDocPrefix"
-
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
-  '';
-
-
-  NIX_CFLAGS_COMPILE =
-    [
-      "-Wno-error=sign-compare" # freetype-2.5.4 changed signedness of some struct fields
-      ''-DNIXPKGS_QTCOMPOSE="${libX11.out}/share/X11/locale"''
-      ''-DNIXPKGS_LIBRESOLV="${stdenv.cc.libc.out}/lib/libresolv"''
-      ''-DNIXPKGS_LIBXCURSOR="${libXcursor.out}/lib/libXcursor"''
-    ]
-
-    ++ lib.optional (mesaSupported && !stdenv.isDarwin)
-       ''-DNIXPKGS_MESA_GL="${mesa.out}/lib/libGL"''
-
-    ++ lib.optionals (!stdenv.isDarwin)
-    [
-      ''-DNIXPKGS_QGTK3_XDG_DATA_DIRS="${gtk3}/share/gsettings-schemas/${gtk3.name}"''
-      ''-DNIXPKGS_QGTK3_GIO_EXTRA_MODULES="${dconf.lib}/lib/gio/modules"''
-    ]
-
-    ++ lib.optionals stdenv.isDarwin
-    [
-      "-Wno-missing-sysroot"
-      "-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
-    ]
-
-    ++ lib.optional decryptSslTraffic "-DQT_DECRYPT_SSL_TRAFFIC";
-
-  prefixKey = "-prefix ";
-
-  # PostgreSQL autodetection fails sporadically because Qt omits the "-lpq" flag
-  # if dependency paths contain the string "pq", which can occur in the hash.
-  # To prevent these failures, we need to override PostgreSQL detection.
-  PSQL_LIBS = lib.optionalString (postgresql != null) "-L${postgresql.lib}/lib -lpq";
-
-  # -no-eglfs, -no-directfb, -no-linuxfb and -no-kms because of the current minimalist mesa
-  # TODO Remove obsolete and useless flags once the build will be totally mastered
-  configureFlags =
-    [
-      "-verbose"
-      "-confirm-license"
-      "-opensource"
-
-      "-release"
-      "-shared"
-      "-accessibility"
-      "-optimized-qmake"
-      "-strip"
-      "-system-proxies"
-      "-pkg-config"
-    ]
-    ++ lib.optionals developerBuild [
-      "-developer-build"
-      "-no-warnings-are-errors"
-    ]
-    ++ [
-      "-gui"
-      "-widgets"
-      "-opengl desktop"
-      "-qml-debug"
-      "-icu"
-      "-pch"
-    ]
-
-    ++ [
-      ''${lib.optionalString (!system-x86_64) "-no"}-sse2''
-      "-no-sse3"
-      "-no-ssse3"
-      "-no-sse4.1"
-      "-no-sse4.2"
-      "-no-avx"
-      "-no-avx2"
-      "-no-mips_dsp"
-      "-no-mips_dspr2"
-    ]
-
-    ++ [
-      "-system-zlib"
-      "-system-libjpeg"
-      "-system-harfbuzz"
-      "-system-pcre"
-      "-openssl-linked"
-      "-system-sqlite"
-      ''-${if mysql != null then "plugin" else "no"}-sql-mysql''
-      ''-${if postgresql != null then "plugin" else "no"}-sql-psql''
-
-      "-make libs"
-      "-make tools"
-      ''-${lib.optionalString (buildExamples == false) "no"}make examples''
-      ''-${lib.optionalString (buildTests == false) "no"}make tests''
-      "-v"
-    ]
-
-    ++ lib.optionals (!stdenv.isDarwin) [
-      "-rpath"
-
-      "-system-xcb"
-      "-xcb"
-      "-qpa xcb"
-
-      "-system-xkbcommon"
-      "-libinput"
-      "-xkbcommon-evdev"
-
-      "-no-eglfs"
-      "-no-gbm"
-      "-no-kms"
-      "-no-linuxfb"
-
-      ''-${lib.optionalString (cups == null) "no-"}cups''
-      "-dbus-linked"
-      "-glib"
-      "-gtk"
-      "-inotify"
-      "-system-libjpeg"
-      "-system-libpng"
-      # gold linker of binutils 2.28 generates duplicate symbols
-      # TODO: remove for newer version of binutils 
-      "-no-use-gold-linker"
-    ]
-
-    ++ lib.optionals stdenv.isDarwin [
-      "-platform macx-clang"
-      "-no-use-gold-linker"
-      "-no-fontconfig"
-      "-qt-freetype"
-      "-qt-libpng"
-    ];
-
-  enableParallelBuilding = true;
-
-  postInstall =
-    # Hardcode some CMake module paths.
-    ''
-      find "$out" -name "*.cmake" | while read file; do
-          substituteInPlace "$file" \
-              --subst-var-by NIX_OUT "''${!outputLib}" \
-              --subst-var-by NIX_DEV "''${!outputDev}" \
-              --subst-var-by NIX_BIN "''${!outputBin}"
-      done
-    '';
-
-  preFixup =
-    # Move selected outputs.
-    ''
-      moveToOutput "bin" "$dev"
-      moveToOutput "include" "$dev"
-      moveToOutput "mkspecs" "$dev"
-
-      mkdir -p "$dev/share"
-      moveToOutput "share/doc" "$dev"
-
-      moveToOutput "$qtPluginPrefix" "$bin"
-    '';
-
-  postFixup =
-    # Don't retain build-time dependencies like gdb.
-    ''
-      sed '/QMAKE_DEFAULT_.*DIRS/ d' -i $dev/mkspecs/qconfig.pri
-    ''
-
-    # Move libtool archives into $dev
-    + ''
-      if [ "z''${!outputLib}" != "z''${!outputDev}" ]; then
-          pushd "''${!outputLib}"
-          find lib -name '*.a' -o -name '*.la' | while read -r file; do
-              mkdir -p "''${!outputDev}/$(dirname "$file")"
-              mv "''${!outputLib}/$file" "''${!outputDev}/$file"
-          done
-          popd
-      fi
-    ''
-
-    # Move qmake project files into $dev.
-    # Don't move .prl files on darwin because they end up in
-    # "dev/lib/Foo.framework/Foo.prl" which interferes with subsequent
-    # use of lndir in the qtbase setup-hook. On Linux, the .prl files
-    # are in lib, and so do not cause a subsequent recreation of deep
-    # framework directory trees.
-    + lib.optionalString (!stdenv.isDarwin) ''
-      if [ "z''${!outputLib}" != "z''${!outputDev}" ]; then
-          pushd "''${!outputLib}"
-          find lib -name '*.prl' | while read -r file; do
-              mkdir -p "''${!outputDev}/$(dirname "$file")"
-              mv "''${!outputLib}/$file" "''${!outputDev}/$file"
-          done
-          popd
-      fi
-    ''
-
-    # fixup .pc file (where to find 'moc' etc.)
-    + lib.optionalString (!stdenv.isDarwin) ''
-      sed -i "$dev/lib/pkgconfig/Qt5Core.pc" \
-          -e "/^host_bins=/ c host_bins=$dev/bin"
-    ''
-
-    + lib.optionalString stdenv.isDarwin ''
-      fixDarwinDylibNames_rpath() {
-        local flags=()
-
-        for fn in "$@"; do
-          flags+=(-change "@rpath/$fn.framework/Versions/5/$fn" "$out/lib/$fn.framework/Versions/5/$fn")
-        done
-
-        for fn in "$@"; do
-          echo "$fn: fixing dylib"
-          install_name_tool -id "$out/lib/$fn.framework/Versions/5/$fn" "''${flags[@]}" "$out/lib/$fn.framework/Versions/5/$fn"
-        done
-      }
-      fixDarwinDylibNames_rpath "QtConcurrent" "QtPrintSupport" "QtCore" "QtSql" "QtDBus" "QtTest" "QtGui" "QtWidgets" "QtNetwork" "QtXml" "QtOpenGL"
-    '';
-
-  inherit lndir;
-  setupHook = if stdenv.isDarwin
-              then ../../qtbase-setup-hook-darwin.sh
-              else ../../qtbase-setup-hook.sh;
-
-  meta = with lib; {
-    homepage = http://www.qt.io;
-    description = "A cross-platform application framework for C++";
-    license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
-    maintainers = with maintainers; [ qknight ttuegel periklis ];
-    platforms = platforms.unix;
-  };
-
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-gl.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-gl.patch
deleted file mode 100644
index 9385c7f6678c..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-gl.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-Index: qtbase-opensource-src-5.9.0/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
-+++ qtbase-opensource-src-5.9.0/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp
-@@ -580,7 +580,14 @@ QFunctionPointer QGLXContext::getProcAdd
- #if QT_CONFIG(library)
-                 extern const QString qt_gl_library_name();
- //                QLibrary lib(qt_gl_library_name());
-+                // Check system library paths first
-                 QLibrary lib(QLatin1String("GL"));
-+#ifdef NIXPKGS_MESA_GL
-+                if (!lib.load()) {
-+                    // Fallback to Mesa driver
-+                    lib.setFileName(QLatin1String(NIXPKGS_MESA_GL));
-+                }
-+#endif // NIXPKGS_MESA_GL
-                 glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB");
- #endif
-             }
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-gtkstyle.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-gtkstyle.patch
deleted file mode 100644
index 755b0965cf5f..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-gtkstyle.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-Index: qtbase-opensource-src-5.5.1/src/widgets/styles/qgtk2painter.cpp
-===================================================================
---- qtbase-opensource-src-5.5.1.orig/src/widgets/styles/qgtk2painter.cpp
-+++ qtbase-opensource-src-5.5.1/src/widgets/styles/qgtk2painter.cpp
-@@ -96,7 +96,7 @@ static void initGtk()
-     static bool initialized = false;
-     if (!initialized) {
-         // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
--        QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0);
-+        QLibrary libgtk(QLS("@gtk@/lib/libgtk-x11-2.0"), 0, 0);
- 
-         QGtk2PainterPrivate::gdk_pixmap_new = (Ptr_gdk_pixmap_new)libgtk.resolve("gdk_pixmap_new");
-         QGtk2PainterPrivate::gdk_pixbuf_get_from_drawable = (Ptr_gdk_pixbuf_get_from_drawable)libgtk.resolve("gdk_pixbuf_get_from_drawable");
-Index: qtbase-opensource-src-5.5.1/src/widgets/styles/qgtkstyle_p.cpp
-===================================================================
---- qtbase-opensource-src-5.5.1.orig/src/widgets/styles/qgtkstyle_p.cpp
-+++ qtbase-opensource-src-5.5.1/src/widgets/styles/qgtkstyle_p.cpp
-@@ -327,7 +327,7 @@ void QGtkStylePrivate::gtkWidgetSetFocus
- void QGtkStylePrivate::resolveGtk() const
- {
-     // enforce the "0" suffix, so we'll open libgtk-x11-2.0.so.0
--    QLibrary libgtk(QLS("gtk-x11-2.0"), 0, 0);
-+    QLibrary libgtk(QLS("@gtk@/lib/libgtk-x11-2.0"), 0, 0);
- 
-     gtk_init = (Ptr_gtk_init)libgtk.resolve("gtk_init");
-     gtk_window_new = (Ptr_gtk_window_new)libgtk.resolve("gtk_window_new");
-@@ -425,8 +425,8 @@ void QGtkStylePrivate::resolveGtk() cons
-     pango_font_description_get_family = (Ptr_pango_font_description_get_family)libgtk.resolve("pango_font_description_get_family");
-     pango_font_description_get_style = (Ptr_pango_font_description_get_style)libgtk.resolve("pango_font_description_get_style");
- 
--    gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("gnomeui-2"), 0, "gnome_icon_lookup_sync");
--    gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("gnomevfs-2"), 0, "gnome_vfs_init");
-+    gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("@libgnomeui@/lib/libgnomeui-2"), 0, "gnome_icon_lookup_sync");
-+    gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("@gnome_vfs@/lib/libgnomevfs-2"), 0, "gnome_vfs_init");
- }
- 
- /* \internal
-@@ -594,9 +594,9 @@ void QGtkStylePrivate::cleanupGtkWidgets
- static bool resolveGConf()
- {
-     if (!QGtkStylePrivate::gconf_client_get_default) {
--        QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_default");
--        QGtkStylePrivate::gconf_client_get_string =  (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_string");
--        QGtkStylePrivate::gconf_client_get_bool =  (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("gconf-2"), 4, "gconf_client_get_bool");
-+        QGtkStylePrivate::gconf_client_get_default = (Ptr_gconf_client_get_default)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_default");
-+        QGtkStylePrivate::gconf_client_get_string =  (Ptr_gconf_client_get_string)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_string");
-+        QGtkStylePrivate::gconf_client_get_bool =  (Ptr_gconf_client_get_bool)QLibrary::resolve(QLS("@gconf@/lib/libgconf-2"), 4, "gconf_client_get_bool");
-     }
-     return (QGtkStylePrivate::gconf_client_get_default !=0);
- }
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-libXcursor.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-libXcursor.patch
deleted file mode 100644
index 31339abc7856..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-libXcursor.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Index: qtbase-opensource-src-5.9.0/src/plugins/platforms/xcb/qxcbcursor.cpp
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/plugins/platforms/xcb/qxcbcursor.cpp
-+++ qtbase-opensource-src-5.9.0/src/plugins/platforms/xcb/qxcbcursor.cpp
-@@ -311,10 +311,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *c
- #if defined(XCB_USE_XLIB) && QT_CONFIG(library)
-     static bool function_ptrs_not_initialized = true;
-     if (function_ptrs_not_initialized) {
--        QLibrary xcursorLib(QLatin1String("Xcursor"), 1);
-+        QLibrary xcursorLib(QLatin1String(NIXPKGS_LIBXCURSOR), 1);
-         bool xcursorFound = xcursorLib.load();
-         if (!xcursorFound) { // try without the version number
--            xcursorLib.setFileName(QLatin1String("Xcursor"));
-+            xcursorLib.setFileName(QLatin1String(NIXPKGS_LIBXCURSOR));
-             xcursorFound = xcursorLib.load();
-         }
-         if (xcursorFound) {
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-resolv.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-resolv.patch
deleted file mode 100644
index 598456a49ffb..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/dlopen-resolv.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Index: qtbase-opensource-src-5.9.0/src/network/kernel/qdnslookup_unix.cpp
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/network/kernel/qdnslookup_unix.cpp
-+++ qtbase-opensource-src-5.9.0/src/network/kernel/qdnslookup_unix.cpp
-@@ -92,7 +92,7 @@ static bool resolveLibraryInternal()
-     if (!lib.load())
- #endif
-     {
--        lib.setFileName(QLatin1String("resolv"));
-+        lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV));
-         if (!lib.load())
-             return false;
-     }
-Index: qtbase-opensource-src-5.9.0/src/network/kernel/qhostinfo_unix.cpp
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/network/kernel/qhostinfo_unix.cpp
-+++ qtbase-opensource-src-5.9.0/src/network/kernel/qhostinfo_unix.cpp
-@@ -102,7 +102,7 @@ static bool resolveLibraryInternal()
-     if (!lib.load())
- #endif
-     {
--        lib.setFileName(QLatin1String("resolv"));
-+        lib.setFileName(QLatin1String(NIXPKGS_LIBRESOLV));
-         if (!lib.load())
-             return false;
-     }
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/library-paths.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/library-paths.patch
deleted file mode 100644
index 4c24d73ed364..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/library-paths.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Index: qtbase-opensource-src-5.9.0/src/corelib/kernel/qcoreapplication.cpp
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/corelib/kernel/qcoreapplication.cpp
-+++ qtbase-opensource-src-5.9.0/src/corelib/kernel/qcoreapplication.cpp
-@@ -2533,6 +2533,15 @@ QStringList QCoreApplication::libraryPat
-         QStringList *app_libpaths = new QStringList;
-         coreappdata()->app_libpaths.reset(app_libpaths);
- 
-+        // Add library paths derived from PATH
-+        const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
-+        const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
-+        for (const QString &path: paths) {
-+            if (!path.isEmpty()) {
-+                app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
-+            }
-+        }
-+
-         const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
-         if (!libPathEnv.isEmpty()) {
-             QStringList paths = QFile::decodeName(libPathEnv).split(QDir::listSeparator(), QString::SkipEmptyParts);
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/libressl.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/libressl.patch
deleted file mode 100644
index e9c60e7ab076..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/libressl.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 81494e67eccba04fc3fe554d76a9ca6fe7f2250e Mon Sep 17 00:00:00 2001
-From: hasufell <hasufell@gentoo.org>
-Date: Sat, 10 Oct 2015 01:15:01 +0200
-Subject: [PATCH] Fix compilation with libressl
-
-By additionally checking for defined(SSL_CTRL_SET_CURVES), which
-is defined in openssl, but not in libressl.
----
- src/network/ssl/qsslcontext_openssl.cpp | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-Index: qtbase-opensource-src-5.8.0/src/network/ssl/qsslcontext_openssl.cpp
-===================================================================
---- qtbase-opensource-src-5.8.0.orig/src/network/ssl/qsslcontext_openssl.cpp
-+++ qtbase-opensource-src-5.8.0/src/network/ssl/qsslcontext_openssl.cpp
-@@ -351,7 +351,7 @@ init_context:
- 
-     const QVector<QSslEllipticCurve> qcurves = sslContext->sslConfiguration.ellipticCurves();
-     if (!qcurves.isEmpty()) {
--#if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
-+#if OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
-         // Set the curves to be used
-         if (q_SSLeay() >= 0x10002000L) {
-             // SSL_CTX_ctrl wants a non-const pointer as last argument,
-@@ -364,7 +364,7 @@ init_context:
-                 sslContext->errorCode = QSslError::UnspecifiedError;
-             }
-         } else
--#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(OPENSSL_NO_EC)
-+#endif // OPENSSL_VERSION_NUMBER >= 0x10002000L && defined(SSL_CTRL_SET_CURVES) && !defined(OPENSSL_NO_EC)
-         {
-             // specific curves requested, but not possible to set -> error
-             sslContext->errorStr = msgErrorSettingEllipticCurves(QSslSocket::tr("OpenSSL version too old, need at least v1.0.2"));
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-common-mac.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-common-mac.patch
deleted file mode 100644
index b77f87781226..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-common-mac.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- qtbase-opensource-src-5.9.1.orig/mkspecs/common/mac.conf	2017-09-16 16:40:30.000000000 +0800
-+++ qtbase-opensource-src-5.9.1/mkspecs/common/mac.conf	2017-09-16 16:41:27.000000000 +0800
-@@ -23,7 +23,7 @@
- 
- QMAKE_FIX_RPATH         = install_name_tool -id
- 
--QMAKE_LFLAGS_RPATH      = -Wl,-rpath,
-+QMAKE_LFLAGS_RPATH      =
- QMAKE_LFLAGS_GCSECTIONS = -Wl,-dead_strip
- 
- QMAKE_LFLAGS_REL_RPATH  =
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-features-mac.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-features-mac.patch
deleted file mode 100644
index 46d950a767bb..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-features-mac.patch
+++ /dev/null
@@ -1,292 +0,0 @@
-diff -u -r qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/default_post.prf qtbase-opensource-src-5.9.2/mkspecs/features/mac/default_post.prf
---- qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/default_post.prf	2017-10-14 12:31:04.000000000 +0800
-+++ qtbase-opensource-src-5.9.2/mkspecs/features/mac/default_post.prf	2017-10-14 12:42:02.000000000 +0800
-@@ -24,166 +24,3 @@
-         }
-     }
- }
--
--# Add the same default rpaths as Xcode does for new projects.
--# This is especially important for iOS/tvOS/watchOS where no other option is possible.
--!no_default_rpath {
--    QMAKE_RPATHDIR += @executable_path/Frameworks
--    equals(TEMPLATE, lib):!plugin:lib_bundle: QMAKE_RPATHDIR += @loader_path/Frameworks
--}
--
--# Don't pass -headerpad_max_install_names when using Bitcode.
--# In that case the linker emits a warning stating that the flag is ignored when
--# used with bitcode, for reasons that cannot be determined (rdar://problem/20748962).
--# Using this flag is also unnecessary in practice on UIKit platforms since they
--# are sandboxed, and only UIKit platforms support bitcode to begin with.
--!bitcode: QMAKE_LFLAGS += $$QMAKE_LFLAGS_HEADERPAD
--
--app_extension_api_only {
--    QMAKE_CFLAGS              += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
--    QMAKE_CXXFLAGS            += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
--    QMAKE_CXXFLAGS_PRECOMPILE += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
--    QMAKE_LFLAGS              += $$QMAKE_CFLAGS_APPLICATION_EXTENSION
--}
--
--macx-xcode {
--    !isEmpty(QMAKE_XCODE_DEBUG_INFORMATION_FORMAT) {
--        debug_information_format.name = DEBUG_INFORMATION_FORMAT
--        debug_information_format.value = $$QMAKE_XCODE_DEBUG_INFORMATION_FORMAT
--        debug_information_format.build = debug
--        QMAKE_MAC_XCODE_SETTINGS += debug_information_format
--    }
--
--    QMAKE_XCODE_ARCHS =
--
--    arch_device.name = "ARCHS[sdk=$${device.sdk}*]"
--    arch_device.value = $$QMAKE_APPLE_DEVICE_ARCHS
--    QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_DEVICE_ARCHS
--    QMAKE_MAC_XCODE_SETTINGS += arch_device
--
--    simulator {
--        arch_simulator.name = "ARCHS[sdk=$${simulator.sdk}*]"
--        arch_simulator.value = $$QMAKE_APPLE_SIMULATOR_ARCHS
--        QMAKE_XCODE_ARCHS += $$QMAKE_APPLE_SIMULATOR_ARCHS
--        QMAKE_MAC_XCODE_SETTINGS += arch_simulator
--    }
--
--    only_active_arch.name = ONLY_ACTIVE_ARCH
--    only_active_arch.value = YES
--    only_active_arch.build = debug
--    QMAKE_MAC_XCODE_SETTINGS += only_active_arch
--} else {
--    device|!simulator: VALID_DEVICE_ARCHS = $$QMAKE_APPLE_DEVICE_ARCHS
--    simulator: VALID_SIMULATOR_ARCHS = $$QMAKE_APPLE_SIMULATOR_ARCHS
--    VALID_ARCHS = $$VALID_DEVICE_ARCHS $$VALID_SIMULATOR_ARCHS
--
--    isEmpty(VALID_ARCHS): \
--        error("QMAKE_APPLE_DEVICE_ARCHS or QMAKE_APPLE_SIMULATOR_ARCHS must contain at least one architecture")
--
--    single_arch: VALID_ARCHS = $$first(VALID_ARCHS)
--
--    ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
--    ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
--
--    QMAKE_EXTRA_VARIABLES += VALID_ARCHS ACTIVE_ARCHS ARCH_ARGS
--
--    arch_flags = $(EXPORT_ARCH_ARGS)
--
--    QMAKE_CFLAGS += $$arch_flags
--    QMAKE_CXXFLAGS += $$arch_flags
--    QMAKE_LFLAGS += $$arch_flags
--
--    QMAKE_PCH_ARCHS = $$VALID_ARCHS
--
--    macos: deployment_target = $$QMAKE_MACOSX_DEPLOYMENT_TARGET
--    ios: deployment_target = $$QMAKE_IOS_DEPLOYMENT_TARGET
--    tvos: deployment_target = $$QMAKE_TVOS_DEPLOYMENT_TARGET
--    watchos: deployment_target = $$QMAKE_WATCHOS_DEPLOYMENT_TARGET
--
--    # If we're doing a simulator and device build, device and simulator
--    # architectures use different paths and flags for the sysroot and
--    # deployment target switch, so we must multiplex them across multiple
--    # architectures using -Xarch. Otherwise we fall back to the simple path.
--    # This is not strictly necessary, but results in cleaner command lines
--    # and makes it easier for people to override EXPORT_VALID_ARCHS to limit
--    # individual rules to a different set of architecture(s) from the overall
--    # build (such as machtest in QtCore).
--    simulator:device {
--        QMAKE_XARCH_CFLAGS =
--        QMAKE_XARCH_LFLAGS =
--        QMAKE_EXTRA_VARIABLES += QMAKE_XARCH_CFLAGS QMAKE_XARCH_LFLAGS
--
--        for (arch, VALID_ARCHS) {
--            contains(VALID_SIMULATOR_ARCHS, $$arch) {
--                sdk = $$simulator.sdk
--                version_identifier = $$simulator.deployment_identifier
--            } else {
--                sdk = $$device.sdk
--                version_identifier = $$device.deployment_identifier
--            }
--
--            version_min_flags = \
--                -Xarch_$${arch} \
--                -m$${version_identifier}-version-min=$$deployment_target
--            QMAKE_XARCH_CFLAGS_$${arch} = $$version_min_flags \
--                -Xarch_$${arch} \
--                -isysroot$$xcodeSDKInfo(Path, $$sdk)
--            QMAKE_XARCH_LFLAGS_$${arch} = $$version_min_flags \
--                -Xarch_$${arch} \
--                -Wl,-syslibroot,$$xcodeSDKInfo(Path, $$sdk)
--
--            QMAKE_XARCH_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS_$${arch})
--            QMAKE_XARCH_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS_$${arch})
--
--            QMAKE_EXTRA_VARIABLES += \
--                QMAKE_XARCH_CFLAGS_$${arch} \
--                QMAKE_XARCH_LFLAGS_$${arch}
--        }
--
--        QMAKE_CFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
--        QMAKE_CXXFLAGS += $(EXPORT_QMAKE_XARCH_CFLAGS)
--        QMAKE_LFLAGS += $(EXPORT_QMAKE_XARCH_LFLAGS)
--    } else {
--        simulator: \
--            version_identifier = $$simulator.deployment_identifier
--        else: \
--            version_identifier = $$device.deployment_identifier
--        version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
--        QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
--        QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK_PATH $$version_min_flag
--        QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK_PATH $$version_min_flag
--    }
--
--    # Enable precompiled headers for multiple architectures
--    QMAKE_CFLAGS_USE_PRECOMPILE =
--    for (arch, VALID_ARCHS) {
--        icc_pch_style: \
--            use_flag = "-pch-use "
--        else: \
--            use_flag = -include
--
--        # Only use Xarch with multi-arch, as the option confuses ccache
--        count(VALID_ARCHS, 1, greaterThan): \
--            QMAKE_CFLAGS_USE_PRECOMPILE += \
--                -Xarch_$${arch}
--
--        QMAKE_CFLAGS_USE_PRECOMPILE += \
--            $${use_flag}${QMAKE_PCH_OUTPUT_$${arch}}
--    }
--    icc_pch_style {
--        QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE -include ${QMAKE_PCH_INPUT}
--        QMAKE_CFLAGS_USE_PRECOMPILE =
--    } else {
--        QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
--        QMAKE_OBJCFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
--        QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
--    }
--
--    QMAKE_PCH_OUTPUT_EXT = _${QMAKE_PCH_ARCH}$${QMAKE_PCH_OUTPUT_EXT}
--}
--
--cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
--!isEmpty(QMAKE_XCODE_VERSION): \
--    cache(QMAKE_XCODE_VERSION, stash)
--
--QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
-diff -u -r qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/default_pre.prf qtbase-opensource-src-5.9.2/mkspecs/features/mac/default_pre.prf
---- qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/default_pre.prf	2017-10-14 12:31:04.000000000 +0800
-+++ qtbase-opensource-src-5.9.2/mkspecs/features/mac/default_pre.prf	2017-10-14 12:42:02.000000000 +0800
-@@ -1,56 +1,2 @@
- CONFIG = asset_catalogs rez $$CONFIG
- load(default_pre)
--
--isEmpty(QMAKE_XCODE_DEVELOPER_PATH) {
--    # Get path of Xcode's Developer directory
--    QMAKE_XCODE_DEVELOPER_PATH = $$system("/usr/bin/xcode-select --print-path 2>/dev/null")
--    isEmpty(QMAKE_XCODE_DEVELOPER_PATH): \
--        error("Xcode path is not set. Please use xcode-select to choose Xcode installation path.")
--
--    # Make sure Xcode path is valid
--    !exists($$QMAKE_XCODE_DEVELOPER_PATH): \
--        error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
--}
--
--isEmpty(QMAKE_XCODEBUILD_PATH): \
--    QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")
--
--!isEmpty(QMAKE_XCODEBUILD_PATH) {
--    # Make sure Xcode is set up properly
--    !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \
--        error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.")
--
--    isEmpty(QMAKE_XCODE_VERSION) {
--        # Extract Xcode version using xcodebuild
--        xcode_version = $$system("/usr/bin/xcrun xcodebuild -version")
--        QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
--        isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
--        unset(xcode_version)
--    }
--}
--
--isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
--    QMAKE_XCODE_PREFERENCES_FILE = $$(HOME)/Library/Preferences/com.apple.dt.Xcode.plist
--    exists($$QMAKE_XCODE_PREFERENCES_FILE): \
--        QMAKE_TARGET_BUNDLE_PREFIX = $$system("/usr/libexec/PlistBuddy -c 'print IDETemplateOptions:bundleIdentifierPrefix' $$QMAKE_XCODE_PREFERENCES_FILE 2>/dev/null")
--
--    !isEmpty(_QMAKE_CACHE_):!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
--        cache(QMAKE_TARGET_BUNDLE_PREFIX)
--}
--
--QMAKE_ASSET_CATALOGS_APP_ICON = AppIcon
--
--# Make the default debug info format for static debug builds
--# DWARF instead of DWARF with dSYM. This cuts down build times
--# for application debug builds significantly, as Xcode doesn't
--# have to pull out all the DWARF info from the Qt static libs
--# and put it into a dSYM file. We don't need that dSYM file in
--# the first place, since the information is available in the
--# object files inside the archives (static libraries).
--macx-xcode:qtConfig(static): \
--    QMAKE_XCODE_DEBUG_INFORMATION_FORMAT = dwarf
--
--# This variable is used by the xcode_dynamic_library_suffix
--# feature, which allows Xcode to choose the Qt libraries to link to
--# at build time, depending on the current Xcode SDK and configuration.
--QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
-diff -u -r qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/sdk.prf qtbase-opensource-src-5.9.2/mkspecs/features/mac/sdk.prf
---- qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/sdk.prf	2017-10-14 12:31:04.000000000 +0800
-+++ qtbase-opensource-src-5.9.2/mkspecs/features/mac/sdk.prf	2017-10-14 12:42:10.000000000 +0800
-@@ -1,58 +0,0 @@
--
--isEmpty(QMAKE_MAC_SDK): \
--    error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.")
--
--contains(QMAKE_MAC_SDK, .*/.*): \
--    error("QMAKE_MAC_SDK can only contain short-form SDK names (eg. macosx, iphoneos)")
--
--defineReplace(xcodeSDKInfo) {
--    info = $$1
--    equals(info, "Path"): \
--        info = --show-sdk-path
--    equals(info, "PlatformPath"): \
--        info = --show-sdk-platform-path
--    equals(info, "SDKVersion"): \
--        info = --show-sdk-version
--    sdk = $$2
--    isEmpty(sdk): \
--        sdk = $$QMAKE_MAC_SDK
--
--    isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
--        QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$info 2>/dev/null")
--        # --show-sdk-platform-path won't work for Command Line Tools; this is fine
--        # only used by the XCTest backend to testlib
--        isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(info, "--show-sdk-platform-path")): \
--            error("Could not resolve SDK $$info for \'$$sdk\'")
--        cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
--    }
--
--    return($$eval(QMAKE_MAC_SDK.$${sdk}.$${info}))
--}
--
--QMAKE_MAC_SDK_PATH = $$xcodeSDKInfo(Path)
--QMAKE_MAC_SDK_PLATFORM_PATH = $$xcodeSDKInfo(PlatformPath)
--QMAKE_MAC_SDK_VERSION = $$xcodeSDKInfo(SDKVersion)
--
--sysrootified =
--for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val
--QMAKE_INCDIR_OPENGL = $$sysrootified
--
--QMAKESPEC_NAME = $$basename(QMAKESPEC)
--
--# Resolve SDK version of various tools
--for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_FIX_RPATH QMAKE_AR QMAKE_RANLIB QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_ACTOOL)) {
--    tool_variable = QMAKE_MAC_SDK.$${QMAKESPEC_NAME}.$${QMAKE_MAC_SDK}.$${tool}
--    !isEmpty($$tool_variable) {
--        $$tool = $$eval($$tool_variable)
--        next()
--    }
--
--    value = $$eval($$tool)
--    isEmpty(value): next()
--
--    sysrooted = $$system("/usr/bin/xcrun -sdk $$QMAKE_MAC_SDK -find $$first(value) 2>/dev/null")
--    isEmpty(sysrooted): next()
--
--    $$tool = $$sysrooted $$member(value, 1, -1)
--    cache($$tool_variable, set stash, $$tool)
--}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/qgtk-env.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/qgtk-env.patch
deleted file mode 100644
index 8e5e2c71828a..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/qgtk-env.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Index: qtbase-opensource-src-5.8.0/src/plugins/platformthemes/gtk3/main.cpp
-===================================================================
---- qtbase-opensource-src-5.8.0.orig/src/plugins/platformthemes/gtk3/main.cpp
-+++ qtbase-opensource-src-5.8.0/src/plugins/platformthemes/gtk3/main.cpp
-@@ -39,6 +39,7 @@
- 
- #include <qpa/qplatformthemeplugin.h>
- #include "qgtk3theme.h"
-+#include <QFile>
- 
- QT_BEGIN_NAMESPACE
- 
-@@ -54,8 +55,22 @@ public:
- QPlatformTheme *QGtk3ThemePlugin::create(const QString &key, const QStringList &params)
- {
-     Q_UNUSED(params);
--    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive))
-+    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive)) {
-+
-+#ifdef NIXPKGS_QGTK3_XDG_DATA_DIRS
-+        QStringList XDG_DATA_DIRS = QFile::decodeName(qgetenv("XDG_DATA_DIRS")).split(':');
-+        XDG_DATA_DIRS << QLatin1String(NIXPKGS_QGTK3_XDG_DATA_DIRS);
-+        qputenv("XDG_DATA_DIRS", QFile::encodeName(XDG_DATA_DIRS.join(':')));
-+#endif
-+
-+#ifdef NIXPKGS_QGTK3_GIO_EXTRA_MODULES
-+        QStringList GIO_EXTRA_MODULES = QFile::decodeName(qgetenv("GIO_EXTRA_MODULES")).split(':');
-+        GIO_EXTRA_MODULES << QLatin1String(NIXPKGS_QGTK3_GIO_EXTRA_MODULES);
-+        qputenv("GIO_EXTRA_MODULES", QFile::encodeName(GIO_EXTRA_MODULES.join(':')));
-+#endif
-+
-         return new QGtk3Theme;
-+    }
- 
-     return 0;
- }
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/qnativesocketengine-type-pun.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/qnativesocketengine-type-pun.patch
deleted file mode 100644
index ad40dfab2f7b..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/qnativesocketengine-type-pun.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Index: qtbase-opensource-src-5.8.0/src/network/socket/qnativesocketengine_unix.cpp
-===================================================================
---- qtbase-opensource-src-5.8.0.orig/src/network/socket/qnativesocketengine_unix.cpp
-+++ qtbase-opensource-src-5.8.0/src/network/socket/qnativesocketengine_unix.cpp
-@@ -979,7 +979,8 @@ qint64 QNativeSocketEnginePrivate::nativ
-             if (cmsgptr->cmsg_len == CMSG_LEN(sizeof(int))
-                     && ((cmsgptr->cmsg_level == IPPROTO_IPV6 && cmsgptr->cmsg_type == IPV6_HOPLIMIT)
-                         || (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_TTL))) {
--                header->hopLimit = *reinterpret_cast<int *>(CMSG_DATA(cmsgptr));
-+                int *ttl = reinterpret_cast<int *>(CMSG_DATA(cmsgptr));
-+                header->hopLimit = *ttl;
-             }
- 
- #ifndef QT_NO_SCTP
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/series b/pkgs/development/libraries/qt-5/5.9/qtbase/series
deleted file mode 100644
index 4f354e87c847..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/series
+++ /dev/null
@@ -1,9 +0,0 @@
-dlopen-resolv.patch
-tzdir.patch
-dlopen-libXcursor.patch
-library-paths.patch
-libressl.patch
-dlopen-gl.patch
-compose-search-path.patch
-cmake-paths.patch
-qgtk-env.patch
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/tzdir.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/tzdir.patch
deleted file mode 100644
index d57f24c3ed0a..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/tzdir.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Index: qtbase-opensource-src-5.9.0/src/corelib/tools/qtimezoneprivate_tz.cpp
-===================================================================
---- qtbase-opensource-src-5.9.0.orig/src/corelib/tools/qtimezoneprivate_tz.cpp
-+++ qtbase-opensource-src-5.9.0/src/corelib/tools/qtimezoneprivate_tz.cpp
-@@ -70,7 +70,11 @@ typedef QHash<QByteArray, QTzTimeZone> Q
- // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
- static QTzTimeZoneHash loadTzTimeZones()
- {
--    QString path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
-+    // Try TZDIR first, in case we're running on NixOS.
-+    QString path = QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/zone.tab");
-+    // Fallback to traditional paths in case we are not on NixOS.
-+    if (!QFile::exists(path))
-+        path = QStringLiteral("/usr/share/zoneinfo/zone.tab");
-     if (!QFile::exists(path))
-         path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
- 
-@@ -643,12 +647,16 @@ void QTzTimeZonePrivate::init(const QByt
-         if (!tzif.open(QIODevice::ReadOnly))
-             return;
-     } else {
--        // Open named tz, try modern path first, if fails try legacy path
--        tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
-+        // Try TZDIR first, in case we're running on NixOS
-+        tzif.setFileName(QFile::decodeName(qgetenv("TZDIR")) + QStringLiteral("/") + QString::fromLocal8Bit(ianaId));
-         if (!tzif.open(QIODevice::ReadOnly)) {
--            tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
--            if (!tzif.open(QIODevice::ReadOnly))
--                return;
-+            // Open named tz, try modern path first, if fails try legacy path
-+            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
-+            if (!tzif.open(QIODevice::ReadOnly)) {
-+                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
-+                if (!tzif.open(QIODevice::ReadOnly))
-+                    return;
-+            }
-         }
-     }
- 
diff --git a/pkgs/development/libraries/qt-5/5.9/qtcharts.nix b/pkgs/development/libraries/qt-5/5.9/qtcharts.nix
deleted file mode 100644
index afc09e3eeb58..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtcharts.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ qtSubmodule, qtbase, qtdeclarative }:
-
-qtSubmodule {
-  name = "qtcharts";
-  qtInputs = [ qtbase qtdeclarative ];
-  outputs = [ "bin" "dev" "out" ];
-  postInstall = ''
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtconnectivity.nix b/pkgs/development/libraries/qt-5/5.9/qtconnectivity.nix
deleted file mode 100644
index 8153f0d40785..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtconnectivity.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ qtSubmodule, qtbase, qtdeclarative }:
-
-qtSubmodule {
-  name = "qtconnectivity";
-  qtInputs = [ qtbase qtdeclarative ];
-  outputs = [ "bin" "dev" "out" ];
-  postInstall = ''
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtdeclarative.patch b/pkgs/development/libraries/qt-5/5.9/qtdeclarative.patch
new file mode 100644
index 000000000000..bb1bbbeb05e0
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.9/qtdeclarative.patch
@@ -0,0 +1,33 @@
+diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
+index ee5b38717..bbccef8c4 100644
+--- a/src/qml/qml/qqmlimport.cpp
++++ b/src/qml/qml/qqmlimport.cpp
+@@ -1678,6 +1678,15 @@ QQmlImportDatabase::QQmlImportDatabase(QQmlEngine *e)
+     QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+     addImportPath(installImportsPath);
+ 
++    // Add import paths derived from PATH
++    const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++    const QString qmldir = QStringLiteral("../" NIXPKGS_QML2_IMPORT_PREFIX);
++    for (const QString &path: paths) {
++        if (!path.isEmpty()) {
++            addImportPath(QDir::cleanPath(path + QDir::separator() + qmldir));
++        }
++    }
++
+     // env import paths
+     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+         const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
+diff --git a/tools/qmlcachegen/qmlcache.prf b/tools/qmlcachegen/qmlcache.prf
+index 330da358b..cdf570205 100644
+--- a/tools/qmlcachegen/qmlcache.prf
++++ b/tools/qmlcachegen/qmlcache.prf
+@@ -44,7 +44,7 @@ defineReplace(qmlCacheOutputFileName) {
+ }
+ 
+ qmlcacheinst.base = $$QMLCACHE_DESTDIR
+-qmlcacheinst.path = $$[QT_INSTALL_QML]/$$TARGETPATH
++qmlcacheinst.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ qmlcacheinst.CONFIG = no_check_exist
+ 
+ qmlcachegen.input = CACHEGEN_FILES
diff --git a/pkgs/development/libraries/qt-5/5.9/qtdeclarative/default.nix b/pkgs/development/libraries/qt-5/5.9/qtdeclarative/default.nix
deleted file mode 100644
index 39b4d35ef36c..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtdeclarative/default.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{ stdenv, qtSubmodule, copyPathsToStore, python2, qtbase, qtsvg, qtxmlpatterns }:
-
-with stdenv.lib;
-
-qtSubmodule {
-  name = "qtdeclarative";
-  patches = copyPathsToStore (readPathsFromFile ./. ./series);
-  qtInputs = [ qtbase qtsvg qtxmlpatterns ];
-  nativeBuildInputs = [ python2 ];
-  outputs = [ "bin" "dev" "out" ];
-
-  preConfigure = ''
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
-  '';
-
-  postInstall = ''
-    moveToOutput "$qtPluginPrefix" "$bin"
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtdeclarative/import-paths.patch b/pkgs/development/libraries/qt-5/5.9/qtdeclarative/import-paths.patch
deleted file mode 100644
index d50ee823a78b..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtdeclarative/import-paths.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Index: qtdeclarative-opensource-src-5.8.0/src/qml/qml/qqmlimport.cpp
-===================================================================
---- 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 import paths derived from PATH
-+    const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
-+    const QString qmldir = QStringLiteral("../" NIXPKGS_QML2_IMPORT_PREFIX);
-+    for (const QString &path: paths) {
-+        if (!path.isEmpty()) {
-+            addImportPath(QDir::cleanPath(path + QDir::separator() + qmldir));
-+        }
-+    }
-+
-     // env import paths
-     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
-         const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
diff --git a/pkgs/development/libraries/qt-5/5.9/qtdeclarative/series b/pkgs/development/libraries/qt-5/5.9/qtdeclarative/series
deleted file mode 100644
index 38abb916a508..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtdeclarative/series
+++ /dev/null
@@ -1 +0,0 @@
-import-paths.patch
diff --git a/pkgs/development/libraries/qt-5/5.9/qtdoc.nix b/pkgs/development/libraries/qt-5/5.9/qtdoc.nix
deleted file mode 100644
index 7f979ee94c0f..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtdoc.nix
+++ /dev/null
@@ -1,7 +0,0 @@
-{ qtSubmodule, qtdeclarative }:
-
-qtSubmodule {
-  name = "qtdoc";
-  qtInputs = [ qtdeclarative ];
-  outputs = [ "out" ];
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtgraphicaleffects.nix b/pkgs/development/libraries/qt-5/5.9/qtgraphicaleffects.nix
deleted file mode 100644
index 3273f12eb830..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtgraphicaleffects.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ qtSubmodule, qtdeclarative }:
-
-qtSubmodule {
-  name = "qtgraphicaleffects";
-  qtInputs = [ qtdeclarative ];
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtimageformats.nix b/pkgs/development/libraries/qt-5/5.9/qtimageformats.nix
deleted file mode 100644
index 03d0fffbe80e..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtimageformats.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ qtSubmodule, qtbase }:
-
-qtSubmodule {
-  name = "qtimageformats";
-  qtInputs = [ qtbase ];
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtlocation.nix b/pkgs/development/libraries/qt-5/5.9/qtlocation.nix
deleted file mode 100644
index f883fd4ff40f..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtlocation.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-{ qtSubmodule, qtbase, qtmultimedia }:
-
-qtSubmodule {
-  name = "qtlocation";
-  qtInputs = [ qtbase qtmultimedia ];
-  outputs = [ "bin" "dev" "out" ];
-  postInstall = ''
-    moveToOutput "$qtPluginPrefix" "$bin"
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-  # Linking with -lclipper fails with parallel build enabled
-  enableParallelBuilding = false;
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtmacextras.nix b/pkgs/development/libraries/qt-5/5.9/qtmacextras.nix
deleted file mode 100644
index 582294cc7f76..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtmacextras.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ qtSubmodule, qtbase, lib }:
-
-qtSubmodule {
-  name = "qtmacextras";
-  qtInputs = [ qtbase ];
-  meta = with lib; {
-    maintainers = with maintainers; [ periklis ];
-    platforms = platforms.darwin;
-  };
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtmultimedia.nix b/pkgs/development/libraries/qt-5/5.9/qtmultimedia.nix
deleted file mode 100644
index 1c728b036ad8..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtmultimedia.nix
+++ /dev/null
@@ -1,21 +0,0 @@
-{ stdenv, qtSubmodule, qtbase, qtdeclarative, pkgconfig
-, alsaLib, gstreamer, gst-plugins-base, libpulseaudio
-, darwin
-}:
-
-with stdenv.lib;
-
-qtSubmodule {
-  name = "qtmultimedia";
-  qtInputs = [ qtbase qtdeclarative ];
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ gstreamer gst-plugins-base libpulseaudio]
-    ++ optional (stdenv.isLinux) alsaLib;
-  outputs = [ "bin" "dev" "out" ];
-  qmakeFlags = [ "GST_VERSION=1.0" ];
-  NIX_LDFLAGS = optionalString (stdenv.isDarwin) "-lobjc";
-  postInstall = ''
-    moveToOutput "$qtPluginPrefix" "$bin"
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtquickcontrols.nix b/pkgs/development/libraries/qt-5/5.9/qtquickcontrols.nix
deleted file mode 100644
index 93a864621b82..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtquickcontrols.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ qtSubmodule, qtdeclarative }:
-
-qtSubmodule {
-  name = "qtquickcontrols";
-  qtInputs = [ qtdeclarative ];
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtquickcontrols2.nix b/pkgs/development/libraries/qt-5/5.9/qtquickcontrols2.nix
deleted file mode 100644
index 37d7d59f8153..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtquickcontrols2.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ qtSubmodule, qtdeclarative }:
-
-qtSubmodule {
-  name = "qtquickcontrols2";
-  qtInputs = [ qtdeclarative ];
-  outputs = [ "bin" "dev" "out" ];
-  postInstall = ''
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtscript/0001-glib-2.32.patch b/pkgs/development/libraries/qt-5/5.9/qtscript.patch
index 887e107b6c1b..5508dec1280e 100644
--- a/pkgs/development/libraries/qt-5/5.9/qtscript/0001-glib-2.32.patch
+++ b/pkgs/development/libraries/qt-5/5.9/qtscript.patch
@@ -1,12 +1,3 @@
-From abd80356449bb36c8adcc5c9ca1df6b47715d265 Mon Sep 17 00:00:00 2001
-From: Thomas Tuegel <ttuegel@gmail.com>
-Date: Sun, 23 Aug 2015 09:13:34 -0500
-Subject: [PATCH] glib-2.32
-
----
- src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
 diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
 index 1f6d25e..087c3fb 100644
 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
@@ -20,6 +11,3 @@ index 1f6d25e..087c3fb 100644
  typedef struct _GCond GCond;
  #endif
  
--- 
-2.5.0
-
diff --git a/pkgs/development/libraries/qt-5/5.9/qtscript/default.nix b/pkgs/development/libraries/qt-5/5.9/qtscript/default.nix
deleted file mode 100644
index 127766e2ebd6..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtscript/default.nix
+++ /dev/null
@@ -1,7 +0,0 @@
-{ qtSubmodule, qtbase, qttools }:
-
-qtSubmodule {
-  name = "qtscript";
-  qtInputs = [ qtbase qttools ];
-  patches = [ ./0001-glib-2.32.patch ];
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtsensors.nix b/pkgs/development/libraries/qt-5/5.9/qtsensors.nix
deleted file mode 100644
index 4127d00b7693..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtsensors.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-{ stdenv, qtSubmodule, qtbase, qtdeclarative }:
-
-with stdenv.lib;
-
-qtSubmodule {
-  name = "qtsensors";
-  qtInputs = [ qtbase qtdeclarative ];
-  outputs = [ "bin" "dev" "out" ];
-  postInstall = ''
-    moveToOutput "$qtPluginPrefix" "$bin"
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtserialport/qtserialport-dlopen-udev.patch b/pkgs/development/libraries/qt-5/5.9/qtserialport.patch
index 65bb64710ebd..f25524e80bcf 100644
--- a/pkgs/development/libraries/qt-5/5.9/qtserialport/qtserialport-dlopen-udev.patch
+++ b/pkgs/development/libraries/qt-5/5.9/qtserialport.patch
@@ -1,8 +1,8 @@
-Index: qtserialport-opensource-src-5.8.0/src/serialport/qtudev_p.h
-===================================================================
---- qtserialport-opensource-src-5.8.0.orig/src/serialport/qtudev_p.h
-+++ qtserialport-opensource-src-5.8.0/src/serialport/qtudev_p.h
-@@ -111,9 +111,17 @@ inline QFunctionPointer resolveSymbol(QL
+diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h
+index af2dab2..8e17f64 100644
+--- a/src/serialport/qtudev_p.h
++++ b/src/serialport/qtudev_p.h
+@@ -111,9 +111,17 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN
  inline bool resolveSymbols(QLibrary *udevLibrary)
  {
      if (!udevLibrary->isLoaded()) {
diff --git a/pkgs/development/libraries/qt-5/5.9/qtserialport/default.nix b/pkgs/development/libraries/qt-5/5.9/qtserialport/default.nix
deleted file mode 100644
index 925e8a808f25..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtserialport/default.nix
+++ /dev/null
@@ -1,12 +0,0 @@
-{ stdenv, qtSubmodule, lib, copyPathsToStore, qtbase, substituteAll, systemd }:
-
-let inherit (lib) getLib optional; in
-
-qtSubmodule {
-  name = "qtserialport";
-  qtInputs = [ qtbase ];
-  patches =  copyPathsToStore (lib.readPathsFromFile ./. ./series);
-  NIX_CFLAGS_COMPILE =
-    optional stdenv.isLinux
-    ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtserialport/series b/pkgs/development/libraries/qt-5/5.9/qtserialport/series
deleted file mode 100644
index 83f4abf094e9..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtserialport/series
+++ /dev/null
@@ -1 +0,0 @@
-qtserialport-dlopen-udev.patch
diff --git a/pkgs/development/libraries/qt-5/5.9/qtsvg.nix b/pkgs/development/libraries/qt-5/5.9/qtsvg.nix
deleted file mode 100644
index ce419731dfaf..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtsvg.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ qtSubmodule, qtbase }:
-
-qtSubmodule {
-  name = "qtsvg";
-  qtInputs = [ qtbase ];
-  outputs = [ "bin" "dev" "out" ];
-  postInstall = ''
-    moveToOutput "$qtPluginPrefix" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qttools.patch b/pkgs/development/libraries/qt-5/5.9/qttools.patch
new file mode 100644
index 000000000000..fbba439ef7a5
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.9/qttools.patch
@@ -0,0 +1,71 @@
+diff --git a/src/assistant/help/Qt5HelpConfigExtras.cmake.in b/src/assistant/help/Qt5HelpConfigExtras.cmake.in
+index 3b97923a..63336bd5 100644
+--- a/src/assistant/help/Qt5HelpConfigExtras.cmake.in
++++ b/src/assistant/help/Qt5HelpConfigExtras.cmake.in
+@@ -2,11 +2,10 @@
+ if (NOT TARGET Qt5::qcollectiongenerator)
+     add_executable(Qt5::qcollectiongenerator IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Help_install_prefix}/$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
++    if(NOT EXISTS \"${imported_location}\")
++        set(imported_location \"$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
++    endif()
+     _qt5_Help_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qcollectiongenerator PROPERTIES
+@@ -17,11 +16,7 @@ endif()
+ if (NOT TARGET Qt5::qhelpgenerator)
+     add_executable(Qt5::qhelpgenerator IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5Help_install_prefix}/$${CMAKE_BIN_DIR}qhelpgenerator$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}qhelpgenerator$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_Help_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::qhelpgenerator PROPERTIES
+diff --git a/src/linguist/Qt5LinguistToolsConfig.cmake.in b/src/linguist/Qt5LinguistToolsConfig.cmake.in
+index 4318b16f..d60db4ff 100644
+--- a/src/linguist/Qt5LinguistToolsConfig.cmake.in
++++ b/src/linguist/Qt5LinguistToolsConfig.cmake.in
+@@ -44,11 +44,7 @@ endmacro()
+ if (NOT TARGET Qt5::lrelease)
+     add_executable(Qt5::lrelease IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lrelease PROPERTIES
+@@ -59,11 +55,7 @@ endif()
+ if (NOT TARGET Qt5::lupdate)
+     add_executable(Qt5::lupdate IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lupdate PROPERTIES
+@@ -74,11 +66,7 @@ endif()
+ if (NOT TARGET Qt5::lconvert)
+     add_executable(Qt5::lconvert IMPORTED)
+ 
+-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
+-    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
+-!!ELSE
+     set(imported_location \"$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
+-!!ENDIF
+     _qt5_LinguistTools_check_file_exists(${imported_location})
+ 
+     set_target_properties(Qt5::lconvert PROPERTIES
diff --git a/pkgs/development/libraries/qt-5/5.9/qttools/cmake-paths.patch b/pkgs/development/libraries/qt-5/5.9/qttools/cmake-paths.patch
deleted file mode 100644
index dfcba9045a75..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qttools/cmake-paths.patch
+++ /dev/null
@@ -1,88 +0,0 @@
-Index: qttools-opensource-src-5.8.0/src/assistant/help/Qt5HelpConfigExtras.cmake.in
-===================================================================
---- qttools-opensource-src-5.8.0.orig/src/assistant/help/Qt5HelpConfigExtras.cmake.in
-+++ qttools-opensource-src-5.8.0/src/assistant/help/Qt5HelpConfigExtras.cmake.in
-@@ -2,11 +2,10 @@
- if (NOT TARGET Qt5::qcollectiongenerator)
-     add_executable(Qt5::qcollectiongenerator IMPORTED)
- 
--!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
--    set(imported_location \"${_qt5Help_install_prefix}/$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
--!!ELSE
--    set(imported_location \"$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
--!!ENDIF
-+    set(imported_location \"@NIX_OUT@/$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
-+    if(NOT EXISTS \"${imported_location}\")
-+        set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qcollectiongenerator$$CMAKE_BIN_SUFFIX\")
-+    endif()
-     _qt5_Help_check_file_exists(${imported_location})
- 
-     set_target_properties(Qt5::qcollectiongenerator PROPERTIES
-@@ -17,11 +16,10 @@ endif()
- if (NOT TARGET Qt5::qhelpgenerator)
-     add_executable(Qt5::qhelpgenerator IMPORTED)
- 
--!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
--    set(imported_location \"${_qt5Help_install_prefix}/$${CMAKE_BIN_DIR}qhelpgenerator$$CMAKE_BIN_SUFFIX\")
--!!ELSE
--    set(imported_location \"$${CMAKE_BIN_DIR}qhelpgenerator$$CMAKE_BIN_SUFFIX\")
--!!ENDIF
-+    set(imported_location \"@NIX_OUT@/$${CMAKE_BIN_DIR}qhelpgenerator$$CMAKE_BIN_SUFFIX\")
-+    if(NOT EXISTS \"${imported_location}\")
-+        set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}qhelpgenerator$$CMAKE_BIN_SUFFIX\")
-+    endif()
-     _qt5_Help_check_file_exists(${imported_location})
- 
-     set_target_properties(Qt5::qhelpgenerator PROPERTIES
-Index: qttools-opensource-src-5.8.0/src/linguist/Qt5LinguistToolsConfig.cmake.in
-===================================================================
---- qttools-opensource-src-5.8.0.orig/src/linguist/Qt5LinguistToolsConfig.cmake.in
-+++ qttools-opensource-src-5.8.0/src/linguist/Qt5LinguistToolsConfig.cmake.in
-@@ -44,11 +44,10 @@ endmacro()
- if (NOT TARGET Qt5::lrelease)
-     add_executable(Qt5::lrelease IMPORTED)
- 
--!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
--    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
--!!ELSE
--    set(imported_location \"$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
--!!ENDIF
-+    set(imported_location \"@NIX_OUT@/$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
-+    if(NOT EXISTS \"${imported_location}\")
-+        set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}lrelease$$CMAKE_BIN_SUFFIX\")
-+    endif()
-     _qt5_LinguistTools_check_file_exists(${imported_location})
- 
-     set_target_properties(Qt5::lrelease PROPERTIES
-@@ -59,11 +58,10 @@ endif()
- if (NOT TARGET Qt5::lupdate)
-     add_executable(Qt5::lupdate IMPORTED)
- 
--!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
--    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
--!!ELSE
--    set(imported_location \"$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
--!!ENDIF
-+    set(imported_location \"@NIX_OUT@/$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
-+    if(NOT EXISTS \"${imported_location}\")
-+        set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}lupdate$$CMAKE_BIN_SUFFIX\")
-+    endif()
-     _qt5_LinguistTools_check_file_exists(${imported_location})
- 
-     set_target_properties(Qt5::lupdate PROPERTIES
-@@ -74,11 +72,10 @@ endif()
- if (NOT TARGET Qt5::lconvert)
-     add_executable(Qt5::lconvert IMPORTED)
- 
--!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
--    set(imported_location \"${_qt5_linguisttools_install_prefix}/$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
--!!ELSE
--    set(imported_location \"$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
--!!ENDIF
-+    set(imported_location \"@NIX_OUT@/$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
-+    if(NOT EXISTS \"${imported_location}\")
-+        set(imported_location \"@NIX_DEV@/$${CMAKE_BIN_DIR}lconvert$$CMAKE_BIN_SUFFIX\")
-+    endif()
-     _qt5_LinguistTools_check_file_exists(${imported_location})
- 
-     set_target_properties(Qt5::lconvert PROPERTIES
diff --git a/pkgs/development/libraries/qt-5/5.9/qttools/default.nix b/pkgs/development/libraries/qt-5/5.9/qttools/default.nix
deleted file mode 100644
index 38d8f1ebe647..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qttools/default.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{ stdenv, qtSubmodule, copyPathsToStore, qtbase }:
-
-with stdenv.lib;
-
-qtSubmodule {
-  name = "qttools";
-  qtInputs = [ qtbase ];
-  outputs = [ "bin" "dev" "out" ];
-  patches = copyPathsToStore (readPathsFromFile ./. ./series);
-  # qmake moves all binaries to $dev in preFixup
-  postFixup = ''
-    moveToOutput "bin/qdbus" "$bin"
-    moveToOutput "bin/qdbusviewer" "$bin"
-    moveToOutput "bin/qtpaths" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qttools/series b/pkgs/development/libraries/qt-5/5.9/qttools/series
deleted file mode 100644
index 6cc1d3b87bca..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qttools/series
+++ /dev/null
@@ -1 +0,0 @@
-cmake-paths.patch
diff --git a/pkgs/development/libraries/qt-5/5.9/qttranslations.nix b/pkgs/development/libraries/qt-5/5.9/qttranslations.nix
deleted file mode 100644
index 50fc8cf6826a..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qttranslations.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ qtSubmodule, qttools }:
-
-qtSubmodule {
-  name = "qttranslations";
-  qtInputs = [ qttools ];
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwayland.nix b/pkgs/development/libraries/qt-5/5.9/qtwayland.nix
deleted file mode 100644
index 8b3072c5534d..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtwayland.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-{ qtSubmodule, qtbase, qtquickcontrols, wayland, pkgconfig }:
-
-qtSubmodule {
-  name = "qtwayland";
-  qtInputs = [ qtbase qtquickcontrols ];
-  buildInputs = [ wayland ];
-  nativeBuildInputs = [ pkgconfig ];
-  outputs = [ "bin" "dev" "out" ];
-  postInstall = ''
-    moveToOutput "$qtPluginPrefix" "$bin"
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwebchannel.nix b/pkgs/development/libraries/qt-5/5.9/qtwebchannel.nix
deleted file mode 100644
index e6a2d74e714c..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtwebchannel.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{ qtSubmodule, qtbase, qtdeclarative }:
-
-qtSubmodule {
-  name = "qtwebchannel";
-  qtInputs = [ qtbase qtdeclarative ];
-  outputs = [ "bin" "dev" "out" ];
-  postInstall = ''
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-}
-
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwebengine/qtwebengine-paxmark-mksnapshot.patch b/pkgs/development/libraries/qt-5/5.9/qtwebengine-paxmark-mksnapshot.patch
index 5e170567ce5d..5e170567ce5d 100644
--- a/pkgs/development/libraries/qt-5/5.9/qtwebengine/qtwebengine-paxmark-mksnapshot.patch
+++ b/pkgs/development/libraries/qt-5/5.9/qtwebengine-paxmark-mksnapshot.patch
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwebengine/default.nix b/pkgs/development/libraries/qt-5/5.9/qtwebengine/default.nix
deleted file mode 100644
index 58716f65738f..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtwebengine/default.nix
+++ /dev/null
@@ -1,117 +0,0 @@
-{ qtSubmodule, qtquickcontrols, qtlocation, qtwebchannel
-
-, bison, coreutils, flex, git, gperf, ninja, pkgconfig, python2, which
-
-, xlibs, libXcursor, libXScrnSaver, libXrandr, libXtst
-, fontconfig, freetype, harfbuzz, icu, dbus
-, zlib, minizip, libjpeg, libpng, libtiff, libwebp, libopus
-, jsoncpp, protobuf, libvpx, srtp, snappy, nss, libevent
-, alsaLib
-, libcap
-, pciutils
-, systemd
-
-, enableProprietaryCodecs ? true
-
-, lib, stdenv # lib.optional, needsPax
-}:
-
-with stdenv.lib;
-
-qtSubmodule {
-  name = "qtwebengine";
-  qtInputs = [ qtquickcontrols qtlocation qtwebchannel ];
-  nativeBuildInputs = [
-    bison coreutils flex git gperf ninja pkgconfig python2 which
-  ];
-  doCheck = true;
-  outputs = [ "bin" "dev" "out" ];
-
-  enableParallelBuilding = true;
-
-  postPatch =
-    # Patch Chromium build tools
-    ''
-      ( cd src/3rdparty/chromium; patchShebangs . )
-    ''
-    # Patch Chromium build files
-    + ''
-      substituteInPlace ./src/3rdparty/chromium/build/common.gypi \
-        --replace /bin/echo ${coreutils}/bin/echo
-      substituteInPlace ./src/3rdparty/chromium/v8/gypfiles/toolchain.gypi \
-        --replace /bin/echo ${coreutils}/bin/echo
-      substituteInPlace ./src/3rdparty/chromium/v8/gypfiles/standalone.gypi \
-        --replace /bin/echo ${coreutils}/bin/echo
-    ''
-    # Patch library paths in Qt sources
-    + ''
-      sed -i \
-        -e "s,QLibraryInfo::location(QLibraryInfo::DataPath),QLatin1String(\"$out\"),g" \
-        -e "s,QLibraryInfo::location(QLibraryInfo::TranslationsPath),QLatin1String(\"$out/translations\"),g" \
-        -e "s,QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath),QLatin1String(\"$out/libexec\"),g" \
-        src/core/web_engine_library_info.cpp
-    ''
-    # Patch library paths in Chromium sources
-    + optionalString (!stdenv.isDarwin) ''
-      sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${systemd.lib}/lib/\1!' \
-        src/3rdparty/chromium/device/udev_linux/udev?_loader.cc
-
-      sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
-        src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc
-    '';
-
-  preConfigure = ''
-    export MAKEFLAGS=-j$NIX_BUILD_CORES
- '';
-
-  qmakeFlags =
-    [
-      # Use system Ninja because bootstrapping it is fragile
-      "WEBENGINE_CONFIG+=use_system_ninja"
-    ] ++ optional enableProprietaryCodecs "WEBENGINE_CONFIG+=use_proprietary_codecs";
-
-  propagatedBuildInputs = [
-    # Image formats
-    libjpeg libpng libtiff libwebp
-
-    # Video formats
-    srtp libvpx
-
-    # Audio formats
-    libopus
-
-    # Text rendering
-    harfbuzz icu
-  ]
-  ++ optionals (!stdenv.isDarwin) [
-    dbus zlib minizip snappy nss protobuf jsoncpp libevent
-
-    # Audio formats
-    alsaLib
-
-    # Text rendering
-    fontconfig freetype
-
-    libcap
-    pciutils
-
-    # X11 libs
-    xlibs.xrandr libXScrnSaver libXcursor libXrandr xlibs.libpciaccess libXtst
-    xlibs.libXcomposite
-  ];
-  patches = optional stdenv.needsPax ./qtwebengine-paxmark-mksnapshot.patch;
-
-  dontUseNinjaBuild = true;
-  dontUseNinjaInstall = true;
-
-  postInstall = ''
-    cat > $out/libexec/qt.conf <<EOF
-    [Paths]
-    Prefix = ..
-    EOF
-
-    paxmark m $out/libexec/QtWebEngineProcess
-
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwebkit.patch b/pkgs/development/libraries/qt-5/5.9/qtwebkit.patch
new file mode 100644
index 000000000000..c78cb58f564b
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.9/qtwebkit.patch
@@ -0,0 +1,77 @@
+diff --git a/Source/WTF/WTF.pri b/Source/WTF/WTF.pri
+index 69e4cd1f3..3f729a75e 100644
+--- a/Source/WTF/WTF.pri
++++ b/Source/WTF/WTF.pri
+@@ -12,7 +12,7 @@ mac {
+     # Mac OS does ship libicu but not the associated header files.
+     # Therefore WebKit provides adequate header files.
+     INCLUDEPATH = $${ROOT_WEBKIT_DIR}/Source/WTF/icu $$INCLUDEPATH
+-    LIBS += -licucore
++    LIBS += /usr/lib/libicucore.dylib
+ } else:!use?(wchar_unicode): {
+     win32 {
+         CONFIG(static, static|shared) {
+diff --git a/Source/WebCore/plugins/qt/PluginPackageQt.cpp b/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+index a923d49aa..46772a4bb 100644
+--- a/Source/WebCore/plugins/qt/PluginPackageQt.cpp
++++ b/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+@@ -136,7 +136,11 @@ static void initializeGtk(QLibrary* module = 0)
+         }
+     }
+ 
++#ifdef NIXPKGS_LIBGTK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGTK2), 0);
++#else
+     QLibrary library(QLatin1String("libgtk-x11-2.0"), 0);
++#endif
+     if (library.load()) {
+         typedef void *(*gtk_init_check_ptr)(int*, char***);
+         gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
+diff --git a/Source/WebCore/plugins/qt/PluginViewQt.cpp b/Source/WebCore/plugins/qt/PluginViewQt.cpp
+index de06a2fea..86fe39ef1 100644
+--- a/Source/WebCore/plugins/qt/PluginViewQt.cpp
++++ b/Source/WebCore/plugins/qt/PluginViewQt.cpp
+@@ -697,7 +697,11 @@ static Display *getPluginDisplay()
+     // support gdk based plugins (like flash) that use a different X connection.
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
++#ifdef NIXPKGS_LIBGDK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
++#else
+     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++#endif
+     if (!library.load())
+         return 0;
+ 
+diff --git a/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp b/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+index 8de65216b..38f5c05e5 100644
+--- a/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
++++ b/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+@@ -53,7 +53,11 @@ static void messageHandler(QtMsgType type, const QMessageLogContext&, const QStr
+ 
+ static bool initializeGtk()
+ {
++#ifdef NIXPKGS_LIBGTK2
++    QLibrary gtkLibrary(QLatin1String(NIXPKGS_LIBGTK2), 0);
++#else
+     QLibrary gtkLibrary(QLatin1String("libgtk-x11-2.0"), 0);
++#endif
+     if (!gtkLibrary.load())
+         return false;
+     typedef void* (*gtk_init_ptr)(void*, void*);
+diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+index d734ff684..0f6ff63d1 100644
+--- a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
++++ b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+@@ -64,7 +64,11 @@ static Display* getPluginDisplay()
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
+ 
++#ifdef NIXPKGS_LIBGDK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
++#else
+     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++#endif
+     if (!library.load())
+         return 0;
+ 
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwebkit/default.nix b/pkgs/development/libraries/qt-5/5.9/qtwebkit/default.nix
deleted file mode 100644
index 664281aac311..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtwebkit/default.nix
+++ /dev/null
@@ -1,40 +0,0 @@
-{ qtSubmodule, stdenv, copyPathsToStore, lib
-, qtdeclarative, qtlocation, qtsensors
-, fontconfig, gdk_pixbuf, gtk2, libwebp, libxml2, libxslt
-, sqlite, systemd, glib, gst_all_1
-, bison2, flex, gdb, gperf, perl, pkgconfig, python2, ruby
-, darwin
-, substituteAll
-, flashplayerFix ? false
-}:
-
-let inherit (lib) optional optionals getLib; in
-
-qtSubmodule {
-  name = "qtwebkit";
-  qtInputs = [ qtdeclarative qtlocation qtsensors ];
-  buildInputs = [ fontconfig libwebp libxml2 libxslt sqlite glib gst_all_1.gstreamer gst_all_1.gst-plugins-base ]
-    ++ optionals (stdenv.isDarwin) (with darwin.apple_sdk.frameworks; [ OpenGL ]);
-  nativeBuildInputs = [
-    bison2 flex gdb gperf perl pkgconfig python2 ruby
-  ];
-
-  __impureHostDeps = optionals (stdenv.isDarwin) [
-    "/usr/lib/libicucore.dylib"
-  ];
-
-  patches =  copyPathsToStore (lib.readPathsFromFile ./. ./series);
-
-  NIX_CFLAGS_COMPILE =
-    optionals flashplayerFix
-      [
-        ''-DNIXPKGS_LIBGTK2="${getLib gtk2}/lib/libgtk-x11-2.0"''
-        ''-DNIXPKGS_LIBGDK2="${getLib gdk_pixbuf}/lib/libgdk-x11-2.0"''
-      ]
-    ++ optional (!stdenv.isDarwin) ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
-
-  # Hack to avoid TMPDIR in RPATHs.
-  preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
-
-  meta.maintainers = with stdenv.lib.maintainers; [ abbradar periklis ];
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-dlopen-gtk.patch b/pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-dlopen-gtk.patch
deleted file mode 100644
index e34eda592af7..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-dlopen-gtk.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-Index: qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginPackageQt.cpp
-===================================================================
---- qtwebkit-opensource-src-5.8.0.orig/Source/WebCore/plugins/qt/PluginPackageQt.cpp
-+++ qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginPackageQt.cpp
-@@ -136,7 +136,11 @@ static void initializeGtk(QLibrary* modu
-         }
-     }
- 
-+#ifdef NIXPKGS_LIBGTK2
-+    QLibrary library(QLatin1String(NIXPKGS_LIBGTK2), 0);
-+#else
-     QLibrary library(QLatin1String("libgtk-x11-2.0"), 0);
-+#endif
-     if (library.load()) {
-         typedef void *(*gtk_init_check_ptr)(int*, char***);
-         gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
-Index: qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginViewQt.cpp
-===================================================================
---- qtwebkit-opensource-src-5.8.0.orig/Source/WebCore/plugins/qt/PluginViewQt.cpp
-+++ qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginViewQt.cpp
-@@ -697,7 +697,11 @@ static Display *getPluginDisplay()
-     // support gdk based plugins (like flash) that use a different X connection.
-     // The code below has the same effect as this one:
-     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
-+#ifdef NIXPKGS_LIBGDK2
-+    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
-+#else
-     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
-+#endif
-     if (!library.load())
-         return 0;
- 
-Index: qtwebkit-opensource-src-5.8.0/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
-===================================================================
---- qtwebkit-opensource-src-5.8.0.orig/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
-+++ qtwebkit-opensource-src-5.8.0/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
-@@ -64,7 +64,11 @@ static Display* getPluginDisplay()
-     // The code below has the same effect as this one:
-     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
- 
-+#ifdef NIXPKGS_LIBGDK2
-+    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
-+#else
-     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
-+#endif
-     if (!library.load())
-         return 0;
- 
-Index: qtwebkit-opensource-src-5.8.0/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
-===================================================================
---- qtwebkit-opensource-src-5.8.0.orig/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
-+++ qtwebkit-opensource-src-5.8.0/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
-@@ -53,7 +53,11 @@ static void messageHandler(QtMsgType typ
- 
- static bool initializeGtk()
- {
-+#ifdef NIXPKGS_LIBGTK2
-+    QLibrary gtkLibrary(QLatin1String(NIXPKGS_LIBGTK2), 0);
-+#else
-     QLibrary gtkLibrary(QLatin1String("libgtk-x11-2.0"), 0);
-+#endif
-     if (!gtkLibrary.load())
-         return false;
-     typedef void* (*gtk_init_ptr)(void*, void*);
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-dlopen-udev.patch b/pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-dlopen-udev.patch
deleted file mode 100644
index e69de29bb2d1..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-dlopen-udev.patch
+++ /dev/null
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-icucore-darwin.patch b/pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-icucore-darwin.patch
deleted file mode 100644
index 63c653da94ef..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtwebkit/qtwebkit-icucore-darwin.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: qtwebkit-opensource-src-5.8.0/Source/WTF/WTF.pri
-===================================================================
---- qtwebkit-opensource-src-5.8.0.orig/Source/WTF/WTF.pri
-+++ qtwebkit-opensource-src-5.8.0/Source/WTF/WTF.pri
-@@ -12,7 +12,7 @@ mac {
-     # Mac OS does ship libicu but not the associated header files.
-     # Therefore WebKit provides adequate header files.
-     INCLUDEPATH = $${ROOT_WEBKIT_DIR}/Source/WTF/icu $$INCLUDEPATH
--    LIBS += -licucore
-+    LIBS += /usr/lib/libicucore.dylib
- } else:!use?(wchar_unicode): {
-     win32 {
-         CONFIG(static, static|shared) {
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwebkit/series b/pkgs/development/libraries/qt-5/5.9/qtwebkit/series
deleted file mode 100644
index 140e2a3dd4e2..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtwebkit/series
+++ /dev/null
@@ -1,3 +0,0 @@
-qtwebkit-dlopen-gtk.patch
-qtwebkit-dlopen-udev.patch
-qtwebkit-icucore-darwin.patch
diff --git a/pkgs/development/libraries/qt-5/5.9/qtwebsockets.nix b/pkgs/development/libraries/qt-5/5.9/qtwebsockets.nix
deleted file mode 100644
index 888c1fb65348..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtwebsockets.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ qtSubmodule, qtbase, qtdeclarative }:
-
-qtSubmodule {
-  name = "qtwebsockets";
-  qtInputs = [ qtbase qtdeclarative ];
-  outputs = [ "bin" "dev" "out" ];
-  postInstall = ''
-    moveToOutput "$qtQmlPrefix" "$bin"
-  '';
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtx11extras.nix b/pkgs/development/libraries/qt-5/5.9/qtx11extras.nix
deleted file mode 100644
index a765161e2d7e..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtx11extras.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ qtSubmodule, qtbase }:
-
-qtSubmodule {
-  name = "qtx11extras";
-  qtInputs = [ qtbase ];
-}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtxmlpatterns.nix b/pkgs/development/libraries/qt-5/5.9/qtxmlpatterns.nix
deleted file mode 100644
index 9a8ddbba2bd2..000000000000
--- a/pkgs/development/libraries/qt-5/5.9/qtxmlpatterns.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ qtSubmodule, qtbase }:
-
-qtSubmodule {
-  name = "qtxmlpatterns";
-  qtInputs = [ qtbase ];
-}