about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/qt-5
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/qt-5')
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix213
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/fetch.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch403
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0002-qtbase-mac.patch116
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0003-qtbase-mkspecs.patch465
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0004-qtbase-replace-libdir.patch68
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0005-qtbase-cmake.patch194
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0006-qtbase-gtk3.patch48
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0007-qtbase-xcursor.patch29
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0008-qtbase-xcompose.patch30
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0009-qtbase-tzdir.patch51
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0010-qtbase-qtpluginpath.patch32
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0011-qtbase-assert.patch32
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0012-fix-header_module.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0013-define-kiosurfacesuccess.patch16
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0014-qtbase-pkg-config.patch14
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtdeclarative.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtscript.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtserialport.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qttools.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-fix-failed-static-assertion.patch31
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-no-platform-check.patch71
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-no-build-skip.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-qos-classes.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-readline.patch45
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/srcs.nix325
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/default.nix182
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/fetch.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch411
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0002-qtbase-mac.patch116
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0003-qtbase-mkspecs.patch464
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0004-qtbase-replace-libdir.patch68
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0005-qtbase-cmake.patch194
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0006-qtbase-gtk3.patch48
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0007-qtbase-xcursor.patch29
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0008-qtbase-tzdir.patch64
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0009-qtbase-qtpluginpath.patch19
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0010-qtbase-assert.patch32
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0011-fix-header_module.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtdeclarative.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtscript.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtserialport.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qttools.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebengine-darwin-no-platform-check.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit-darwin-no-qos-classes.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit-darwin-no-readline.patch45
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/srcs.nix342
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/default.nix176
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/fetch.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch411
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0002-qtbase-mac.patch118
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0003-qtbase-mkspecs.patch464
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0004-qtbase-replace-libdir.patch68
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0005-qtbase-cmake.patch194
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0006-qtbase-gtk3.patch48
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0007-qtbase-xcursor.patch29
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0008-qtbase-tzdir.patch64
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0009-qtbase-qtpluginpath.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0010-qtbase-assert.patch32
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0011-fix-header_module.patch25
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtdeclarative.patch114
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtscript.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtserialport.patch22
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qttools.patch15
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebengine-darwin-no-platform-check.patch33
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit-darwin-no-qos-classes.patch11
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit-darwin-no-readline.patch45
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit.patch12
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/srcs.nix342
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/README.md81
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qmake-libtool.sh14
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-builtin-paths.sh64
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh36
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh34
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh36
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh66
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh1
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh102
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/mkDerivation.nix32
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix413
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtcharts.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtconnectivity.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix26
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtdoc.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtgamepad.nix9
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtgraphicaleffects.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtimageformats.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtlocation.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtmacextras.nix10
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix17
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtnetworkauth.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtscript.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtscxml.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtsensors.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialbus.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtspeech.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtsvg.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix45
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qttranslations.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtvirtualkeyboard.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwayland.nix9
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix8
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix242
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebglplugin.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix78
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebsockets.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix14
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtx11extras.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtxmlpatterns.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/qt-env.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/qtModule.nix59
116 files changed, 8351 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix
new file mode 100644
index 000000000000..fcceb6d6cf2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix
@@ -0,0 +1,213 @@
+/*
+
+# Updates
+
+Before a major version update, make a copy of this directory. (We like to
+keep the old version around for a short time after major updates.) Add a
+top-level attribute to `top-level/all-packages.nix`.
+
+1. Update the URL in `pkgs/development/libraries/qt-5/$VERSION/fetch.sh`.
+2. From the top of the Nixpkgs tree, run
+   `./maintainers/scripts/fetch-kde-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
+3. Check that the new packages build correctly.
+4. Commit the changes and open a pull request.
+
+*/
+
+{
+  newScope,
+  stdenv, fetchurl, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper,
+  bison, cups ? null, harfbuzz, libGL, perl,
+  gstreamer, gst-plugins-base, gtk3, dconf,
+  llvmPackages_5,
+
+  # options
+  developerBuild ? false,
+  decryptSslTraffic ? false,
+  debug ? false,
+}:
+
+with stdenv.lib;
+
+let
+
+  qtCompatVersion = srcs.qtbase.version;
+
+  stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
+
+  mirror = "https://download.qt.io";
+  srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
+    # Community port of the now unmaintained upstream qtwebkit.
+    qtwebkit = rec {
+      src = fetchFromGitHub {
+        owner = "qtwebkit";
+        repo = "qtwebkit";
+        rev = "qtwebkit-${version}";
+        sha256 = "11lc5sk10d9cyg8jqkbgkqiap72b9rax7hy61nm90zw9749y2yfg";
+      };
+      version = "5.212.0-alpha4";
+    };
+  };
+
+  patches = {
+    qtbase =
+      optionals stdenv.isDarwin [
+        ./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
+        ./qtbase.patch.d/0002-qtbase-mac.patch
+        ./qtbase.patch.d/0013-define-kiosurfacesuccess.patch
+      ]
+      ++ [
+        ./qtbase.patch.d/0003-qtbase-mkspecs.patch
+        ./qtbase.patch.d/0004-qtbase-replace-libdir.patch
+        ./qtbase.patch.d/0005-qtbase-cmake.patch
+        ./qtbase.patch.d/0006-qtbase-gtk3.patch
+        ./qtbase.patch.d/0007-qtbase-xcursor.patch
+        ./qtbase.patch.d/0008-qtbase-xcompose.patch
+        ./qtbase.patch.d/0009-qtbase-tzdir.patch
+        ./qtbase.patch.d/0010-qtbase-qtpluginpath.patch
+        ./qtbase.patch.d/0011-qtbase-assert.patch
+        ./qtbase.patch.d/0012-fix-header_module.patch
+
+        # Ensure -I${includedir} is added to Cflags in pkg-config files.
+        # See https://github.com/NixOS/nixpkgs/issues/52457
+        ./qtbase.patch.d/0014-qtbase-pkg-config.patch
+
+        # https://bugreports.qt.io/browse/QTBUG-81715
+        # remove after updating to qt > 5.12.7
+        (fetchpatch {
+          name = "fix-qt5_make_output_file-cmake-macro.patch";
+          url = "https://code.qt.io/cgit/qt/qtbase.git/patch/?id=8a3fde00bf53d99e9e4853e8ab97b0e1bcf74915";
+          sha256 = "1gpcbdpyazdxnmldvhsf3pfwr2gjvi08x3j6rxf543rq01bp6cpx";
+        })
+        (fetchpatch {
+          name = "QTBUG-78937.patch";
+          url = "https://code.qt.io/cgit/qt/qtbase.git/patch/?id=67a9c600ad14ee44501a6df3509daa8234b97606";
+          sha256 = "1jiky1w9j8rka78r4q0yabb8w2l5j6csdjysynz7gs1ry4xjfdxd";
+        })
+      ];
+    qtdeclarative = [ ./qtdeclarative.patch ];
+    qtscript = [ ./qtscript.patch ];
+    qtserialport = [ ./qtserialport.patch ];
+    qtwebengine = [
+      ./qtwebengine-no-build-skip.patch
+      # https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/707
+      # https://bugreports.qt.io/browse/QTBUG-77037
+      (fetchpatch {
+        name = "fix-build-with-pulseaudio-13.0.patch";
+        url = "https://git.archlinux.org/svntogit/packages.git/plain/trunk/qtbug-77037-workaround.patch?h=packages/qt5-webengine&id=fc77d6b3d5ec74e421b58f199efceb2593cbf951";
+        sha256 = "1gv733qfdn9746nbqqxzyjx4ijjqkkb7zb71nxax49nna5bri3am";
+      })
+    ] ++ optionals stdenv.isDarwin [
+      ./qtwebengine-darwin-no-platform-check.patch
+      ./qtwebengine-darwin-fix-failed-static-assertion.patch
+    ];
+    qtwebkit = [
+      (fetchpatch {
+        name = "qtwebkit-bison-3.7-build.patch";
+        url = "https://github.com/qtwebkit/qtwebkit/commit/d92b11fea65364fefa700249bd3340e0cd4c5b31.patch";
+        sha256 = "0h8ymfnwgkjkwaankr3iifiscsvngqpwb91yygndx344qdiw9y0n";
+      })
+      ./qtwebkit.patch
+    ] ++ optionals stdenv.isDarwin [
+      ./qtwebkit-darwin-no-readline.patch
+      ./qtwebkit-darwin-no-qos-classes.patch
+    ];
+    qttools = [ ./qttools.patch ];
+  };
+
+  qtModule =
+    import ../qtModule.nix
+    {
+      inherit perl;
+      inherit (stdenv) lib;
+      # Use a variant of mkDerivation that does not include wrapQtApplications
+      # to avoid cyclic dependencies between Qt modules.
+      mkDerivation =
+        import ../mkDerivation.nix
+        { inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
+        stdenvActual.mkDerivation;
+    }
+    { inherit self srcs patches; };
+
+  addPackages = self: with self;
+    let
+      callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
+    in {
+
+      mkDerivationWith =
+        import ../mkDerivation.nix
+        { inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
+
+      mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
+
+      qtbase = callPackage ../modules/qtbase.nix {
+        inherit (srcs.qtbase) src version;
+        patches = patches.qtbase;
+        inherit bison cups harfbuzz libGL;
+        withGtk3 = true; inherit dconf gtk3;
+        inherit developerBuild decryptSslTraffic;
+      };
+
+      qtcharts = callPackage ../modules/qtcharts.nix {};
+      qtconnectivity = callPackage ../modules/qtconnectivity.nix {};
+      qtdeclarative = callPackage ../modules/qtdeclarative.nix {};
+      qtdoc = callPackage ../modules/qtdoc.nix {};
+      qtgamepad = callPackage ../modules/qtgamepad.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;
+      };
+      qtnetworkauth = callPackage ../modules/qtnetworkauth.nix {};
+      qtquick1 = null;
+      qtquickcontrols = callPackage ../modules/qtquickcontrols.nix {};
+      qtquickcontrols2 = callPackage ../modules/qtquickcontrols2.nix {};
+      qtscript = callPackage ../modules/qtscript.nix {};
+      qtsensors = callPackage ../modules/qtsensors.nix {};
+      qtserialbus = callPackage ../modules/qtserialbus.nix {};
+      qtserialport = callPackage ../modules/qtserialport.nix {};
+      qtspeech = callPackage ../modules/qtspeech.nix {};
+      qtsvg = callPackage ../modules/qtsvg.nix {};
+      qtscxml = callPackage ../modules/qtscxml.nix {};
+      qttools = callPackage ../modules/qttools.nix {};
+      qttranslations = callPackage ../modules/qttranslations.nix {};
+      qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix {};
+      qtwayland = callPackage ../modules/qtwayland.nix {};
+      qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
+      qtwebengine = callPackage ../modules/qtwebengine.nix {};
+      qtwebglplugin = callPackage ../modules/qtwebglplugin.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
+      qtwebview = callPackage ../modules/qtwebview.nix {};
+      qtx11extras = callPackage ../modules/qtx11extras.nix {};
+      qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
+
+      env = callPackage ../qt-env.nix {};
+      full = env "qt-full-${qtbase.version}" ([
+        qtcharts qtconnectivity qtdeclarative qtdoc qtgamepad qtgraphicaleffects
+        qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2
+        qtscript qtsensors qtserialport qtsvg qttools qttranslations
+        qtvirtualkeyboard qtwebchannel qtwebengine qtwebkit qtwebsockets
+        qtwebview qtx11extras qtxmlpatterns
+      ] ++ optional (!stdenv.isDarwin) qtwayland
+        ++ optional (stdenv.isDarwin) qtmacextras);
+
+      qmake = makeSetupHook {
+        deps = [ self.qtbase.dev ];
+        substitutions = {
+          fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh;
+        };
+      } ../hooks/qmake-hook.sh;
+
+      wrapQtAppsHook = makeSetupHook {
+        deps =
+          [ self.qtbase.dev makeWrapper ]
+          ++ optional stdenv.isLinux self.qtwayland.dev;
+      } ../hooks/wrap-qt-apps-hook.sh;
+    };
+
+   self = makeScope newScope addPackages;
+
+in self
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/fetch.sh b/nixpkgs/pkgs/development/libraries/qt-5/5.12/fetch.sh
new file mode 100644
index 000000000000..016b4985ed1e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/fetch.sh
@@ -0,0 +1 @@
+WGET_ARGS=( http://download.qt.io/official_releases/qt/5.12/5.12.7/submodules/ )
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
new file mode 100644
index 000000000000..bb535b8a0c0e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
@@ -0,0 +1,403 @@
+From 361a9395704ca1ee170a8bb3823ba860293eecee Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:34:00 -0500
+Subject: [PATCH 01/12] qtbase-mkspecs-mac
+
+---
+ mkspecs/common/mac.conf               |   2 +-
+ mkspecs/features/mac/default_post.prf | 202 ----------------------------------
+ mkspecs/features/mac/default_pre.prf  |  58 ----------
+ mkspecs/features/mac/sdk.mk           |  25 -----
+ mkspecs/features/mac/sdk.prf          |  61 ----------
+ 5 files changed, 1 insertion(+), 347 deletions(-)
+
+diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
+index b77494ec9b..470c38e772 100644
+--- a/mkspecs/common/mac.conf
++++ b/mkspecs/common/mac.conf
+@@ -24,7 +24,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/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
+index 993f4d56a9..b80ec1e801 100644
+--- a/mkspecs/features/mac/default_post.prf
++++ b/mkspecs/features/mac/default_post.prf
+@@ -68,208 +68,6 @@ 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 {
+-    qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO
+-    !isEmpty(QMAKE_PKGINFO_TYPEINFO): \
+-        qmake_pkginfo_typeinfo.value = $$QMAKE_PKGINFO_TYPEINFO
+-    else: \
+-        qmake_pkginfo_typeinfo.value = "????"
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_pkginfo_typeinfo
+-
+-    bundle_version = $$VERSION
+-    isEmpty(bundle_version): bundle_version = 1.0.0
+-
+-    l = $$split(bundle_version, '.') 0 0  # make sure there are at least three
+-    VER_MAJ = $$member(l, 0, 0)
+-    VER_MIN = $$member(l, 1, 1)
+-    VER_PAT = $$member(l, 2, 2)
+-    unset(l)
+-
+-    qmake_full_version.name = QMAKE_FULL_VERSION
+-    qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
+-
+-    qmake_short_version.name = QMAKE_SHORT_VERSION
+-    qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
+-
+-    !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}
+-}
+-
+-!equals(sdk_version, $$QMAKE_MAC_SDK_VERSION) {
+-    # Explicit SDK version has been set, respect that
+-    QMAKE_LFLAGS += -Wl,-sdk_version -Wl,$$sdk_version
+-}
+-
+-cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
+-!isEmpty(QMAKE_XCODE_VERSION): \
+-    cache(QMAKE_XCODE_VERSION, stash)
+-
+-QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
+-
+-xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER
+-xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX
+-isEmpty(xcode_product_bundle_identifier_setting.value): \
+-    xcode_product_bundle_identifier_setting.value = "com.yourcompany"
+-xcode_product_bundle_target = $$QMAKE_BUNDLE
+-isEmpty(xcode_product_bundle_target): \
+-    xcode_product_bundle_target = ${PRODUCT_NAME:rfc1034identifier}
+-xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.$${xcode_product_bundle_target}"
+-QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
+-
+ !macx-xcode {
+     generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS
+     generate_xcode_project.target = xcodeproj
+diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
+index e3534561a5..3b01424e67 100644
+--- a/mkspecs/features/mac/default_pre.prf
++++ b/mkspecs/features/mac/default_pre.prf
+@@ -1,60 +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
+-
+-xcode_copy_phase_strip_setting.name = COPY_PHASE_STRIP
+-xcode_copy_phase_strip_setting.value = NO
+-QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
+diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk
+index c40f58c987..e69de29bb2 100644
+--- a/mkspecs/features/mac/sdk.mk
++++ b/mkspecs/features/mac/sdk.mk
+@@ -1,25 +0,0 @@
+-
+-ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),)
+-    CHECK_SDK_COMMAND = /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version 2>&1
+-    CURRENT_MAC_SDK_VERSION := $(shell DEVELOPER_DIR=$(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) $(CHECK_SDK_COMMAND))
+-    ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION))
+-        # We don't want to complain about out of date SDK unless the target needs to be remade.
+-        # This covers use-cases such as running 'make check' after moving the build to a
+-        # computer without Xcode or with a different Xcode version.
+-        TARGET_UP_TO_DATE := $(shell QT_MAC_SDK_NO_VERSION_CHECK=1 $(MAKE) --question $(QMAKE_TARGET) && echo 1 || echo 0)
+-        ifeq ($(TARGET_UP_TO_DATE),0)
+-            ifneq ($(findstring missing DEVELOPER_DIR path,$(CURRENT_MAC_SDK_VERSION)),)
+-                $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) is no longer valid.)
+-            else ifneq ($(findstring SDK "$(EXPORT_QMAKE_MAC_SDK)" cannot be located,$(CURRENT_MAC_SDK_VERSION)),)
+-                $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) no longer contains the $(EXPORT_QMAKE_MAC_SDK_VERSION) platform SDK.)
+-            else ifneq ($(CURRENT_MAC_SDK_VERSION),)
+-                $(info The platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).)
+-            else
+-                $(info Unknown error resolving current platform SDK version.)
+-            endif
+-            $(info This requires a fresh build. Please wipe the build directory completely,)
+-            $(info including any .qmake.stash and .qmake.cache files generated by qmake.)
+-            $(error ^)
+-        endif
+-    endif
+-endif
+diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
+index 3a9c2778bb..e69de29bb2 100644
+--- a/mkspecs/features/mac/sdk.prf
++++ b/mkspecs/features/mac/sdk.prf
+@@ -1,61 +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"): \
+-        infoarg = --show-sdk-path
+-    equals(info, "PlatformPath"): \
+-        infoarg = --show-sdk-platform-path
+-    equals(info, "SDKVersion"): \
+-        infoarg = --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 $$infoarg 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(infoarg, "--show-sdk-platform-path")): \
+-            error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg")
+-        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)
+-
+-isEmpty(QMAKE_EXPORT_INCDIR_OPENGL) {
+-    QMAKE_EXPORT_INCDIR_OPENGL = $$QMAKE_INCDIR_OPENGL
+-    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 QMAKE_LINK_C QMAKE_LINK_C_SHLIB)) {
+-    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)
+-}
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0002-qtbase-mac.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0002-qtbase-mac.patch
new file mode 100644
index 000000000000..9f0c66651844
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0002-qtbase-mac.patch
@@ -0,0 +1,116 @@
+From 203c9338dc92c2c36007cfe6633387348976637e Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:37:15 -0500
+Subject: [PATCH 02/12] qtbase-mac
+
+---
+ src/corelib/kernel/qcore_mac_p.h | 16 ++++++++++++++--
+ src/testlib/qappletestlogger.cpp |  2 +-
+ src/testlib/qappletestlogger_p.h |  2 +-
+ src/testlib/qtestcase.cpp        |  2 +-
+ src/testlib/qtestlog.cpp         |  2 +-
+ src/testlib/qtestlog_p.h         |  2 +-
+ 6 files changed, 19 insertions(+), 7 deletions(-)
+
+diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
+index f96e7358..650946b7 100644
+--- a/src/corelib/kernel/qcore_mac_p.h
++++ b/src/corelib/kernel/qcore_mac_p.h
+@@ -212,7 +212,7 @@ private:
+ 
+ // --------------------------------------------------------------------------
+ 
+-#if !defined(QT_BOOTSTRAPPED)
++#if 0
+ 
+ QT_END_NAMESPACE
+ #include <os/activity.h>
+@@ -290,7 +290,19 @@ QT_MAC_WEAK_IMPORT(_os_activity_current);
+ 
+ #define QT_APPLE_SCOPED_LOG_ACTIVITY(...) QAppleLogActivity scopedLogActivity = QT_APPLE_LOG_ACTIVITY(__VA_ARGS__).enter();
+ 
+-#endif // !defined(QT_BOOTSTRAPPED)
++#else // !defined(QT_BOOTSTRAPPED)
++
++#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT3(...)
++#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT2(...)
++#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT(...)
++
++#define QT_APPLE_LOG_ACTIVITY2(...)
++#define QT_APPLE_LOG_ACTIVITY1(...)
++#define QT_APPLE_LOG_ACTIVITY(...)
++
++#define QT_APPLE_SCOPED_LOG_ACTIVITY(...)
++
++#endif
+ 
+ // -------------------------------------------------------------------------
+ 
+diff --git a/src/testlib/qappletestlogger.cpp b/src/testlib/qappletestlogger.cpp
+index dfeadebd..2a74330c 100644
+--- a/src/testlib/qappletestlogger.cpp
++++ b/src/testlib/qappletestlogger.cpp
+@@ -43,7 +43,7 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+ 
+ using namespace QTestPrivate;
+ 
+diff --git a/src/testlib/qappletestlogger_p.h b/src/testlib/qappletestlogger_p.h
+index 62c6d95c..f8e0a3b7 100644
+--- a/src/testlib/qappletestlogger_p.h
++++ b/src/testlib/qappletestlogger_p.h
+@@ -57,7 +57,7 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+ class QAppleTestLogger : public QAbstractTestLogger
+ {
+ public:
+diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
+index 0c935a1f..22f2d75d 100644
+--- a/src/testlib/qtestcase.cpp
++++ b/src/testlib/qtestcase.cpp
+@@ -850,7 +850,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
+ 
+     bool addFallbackLogger = !explicitLoggerRequested;
+ 
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+     // Any explicitly requested loggers will be added by now, so we can check if they use stdout
+     const bool safeToAddAppleLogger = !AppleUnifiedLogger::willMirrorToStderr() || !QTestLog::loggerUsingStdout();
+     if (safeToAddAppleLogger && QAppleTestLogger::debugLoggingEnabled()) {
+diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
+index 57bb7d95..33fb8162 100644
+--- a/src/testlib/qtestlog.cpp
++++ b/src/testlib/qtestlog.cpp
+@@ -460,7 +460,7 @@ void QTestLog::addLogger(LogMode mode, const char *filename)
+     case QTestLog::TAP:
+         logger = new QTapTestLogger(filename);
+         break;
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+     case QTestLog::Apple:
+         logger = new QAppleTestLogger;
+         break;
+diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
+index e63e89a7..213b6945 100644
+--- a/src/testlib/qtestlog_p.h
++++ b/src/testlib/qtestlog_p.h
+@@ -68,7 +68,7 @@ class Q_TESTLIB_EXPORT QTestLog
+ public:
+     enum LogMode {
+         Plain = 0, XML, LightXML, XunitXML, CSV, TeamCity, TAP
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+         , Apple
+ #endif
+ #if defined(HAVE_XCTEST)
+-- 
+2.23.0
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0003-qtbase-mkspecs.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0003-qtbase-mkspecs.patch
new file mode 100644
index 000000000000..d5d8e70b788f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0003-qtbase-mkspecs.patch
@@ -0,0 +1,465 @@
+From 8bdbddc2e5fef1553b1ba0297d3c03b38e9b947b Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Wed, 18 Sep 2019 05:39:39 -0500
+Subject: [PATCH 03/12] qtbase-mkspecs
+
+---
+ mkspecs/features/create_cmake.prf             | 53 ++++--------
+ .../data/cmake/Qt5BasicConfig.cmake.in        | 80 +------------------
+ mkspecs/features/qml_module.prf               |  2 +-
+ mkspecs/features/qml_plugin.prf               |  2 +-
+ mkspecs/features/qt_app.prf                   |  2 +-
+ mkspecs/features/qt_build_paths.prf           |  4 +-
+ mkspecs/features/qt_docs.prf                  | 10 +--
+ mkspecs/features/qt_example_installs.prf      |  2 +-
+ mkspecs/features/qt_functions.prf             |  2 +-
+ mkspecs/features/qt_installs.prf              | 22 ++---
+ mkspecs/features/qt_plugin.prf                |  2 +-
+ 11 files changed, 39 insertions(+), 142 deletions(-)
+
+diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
+index 00da9bd33f..bd166fbfea 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
+@@ -70,45 +70,20 @@ 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
+ 
+-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_BIN_DIR = $$NIX_OUTPUT_BIN/bin/
++CMAKE_BIN_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_LIB_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_LIB_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
+-}
+-
+-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_PLUGIN_DIR = $$NIX_OUTPUT_PLUGIN/
++CMAKE_PLUGIN_DIR_IS_ABSOLUTE = True
++ 
++CMAKE_DLL_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_DLL_DIR_IS_ABSOLUTE = True
+ 
+ static|staticlib:CMAKE_STATIC_TYPE = true
+ 
+@@ -188,7 +163,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()
+@@ -333,7 +308,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 c729892889..c60ef16e64 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -3,30 +3,6 @@ if (CMAKE_VERSION VERSION_LESS 3.1.0)
+     message(FATAL_ERROR \"Qt 5 $${CMAKE_MODULE_NAME} module requires at least CMake version 3.1.0\")
+ 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)")
+@@ -52,11 +28,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}\"
+@@ -69,11 +41,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
+@@ -89,24 +57,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}$${CMAKE_QT_STEM}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework/Headers\"
++      \"$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework\"
++      \"$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.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}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.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}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
++        \"$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -122,7 +79,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
+@@ -272,25 +228,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()
+@@ -309,25 +253,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()
+@@ -346,11 +278,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/qml_module.prf b/mkspecs/features/qml_module.prf
+index 57cfec78b3..5cbd7c52ef 100644
+--- a/mkspecs/features/qml_module.prf
++++ b/mkspecs/features/qml_module.prf
+@@ -51,7 +51,7 @@ builtin_resources {
+ # Install rules
+ qmldir.base = $$qmldir_path
+ qmldir.files = $$qmldir_file
+-qmldir.path = $$[QT_INSTALL_QML]/$$TARGETPATH
++qmldir.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ INSTALLS += qmldir
+ 
+ qmlfiles.base = $$_PRO_FILE_PWD_
+diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
+index ad8ecdf5f1..804634b22e 100644
+--- a/mkspecs/features/qml_plugin.prf
++++ b/mkspecs/features/qml_plugin.prf
+@@ -50,7 +50,7 @@ load(qt_build_paths)
+ 
+ DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+ 
+-target.path = $$[QT_INSTALL_QML]/$$TARGETPATH
++target.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ INSTALLS += target
+ 
+ # Some final setup
+diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf
+index 8354f30eea..62028fef8e 100644
+--- a/mkspecs/features/qt_app.prf
++++ b/mkspecs/features/qt_app.prf
+@@ -30,7 +30,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 3bb3823a8e..655b7b7db8 100644
+--- a/mkspecs/features/qt_build_paths.prf
++++ b/mkspecs/features/qt_build_paths.prf
+@@ -24,6 +24,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_docs.prf b/mkspecs/features/qt_docs.prf
+index 3b74cd4dd5..6bfbbe6e2d 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 43b58817fe..e635b8f67a 100644
+--- a/mkspecs/features/qt_example_installs.prf
++++ b/mkspecs/features/qt_example_installs.prf
+@@ -88,7 +88,7 @@ sourcefiles += \
+     $$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 1903e509c8..ae7b585989 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("command -v $$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 1ebca17366..b784441da0 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,35 +23,35 @@
+ #headers
+ qt_install_headers {
+     gen_headers.files = $$SYNCQT.GENERATED_HEADER_FILES
+-    gen_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    gen_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += gen_headers
+ 
+     targ_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.INJECTED_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
+     generated_privates: \
+         private_headers.CONFIG += no_check_exist
+     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 40528a65e2..903f795284 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)
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0004-qtbase-replace-libdir.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0004-qtbase-replace-libdir.patch
new file mode 100644
index 000000000000..f2cf54880d4a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0004-qtbase-replace-libdir.patch
@@ -0,0 +1,68 @@
+From 492f6555bb09f207c83387441f0f23ba4602dfff Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Wed, 18 Sep 2019 05:39:50 -0500
+Subject: [PATCH 04/12] qtbase-replace-libdir
+
+---
+ mkspecs/features/qt_common.prf | 20 ++------------------
+ mkspecs/features/qt_module.prf |  5 +----
+ 2 files changed, 3 insertions(+), 22 deletions(-)
+
+diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
+index caecb68a84..d3aa3ba570 100644
+--- a/mkspecs/features/qt_common.prf
++++ b/mkspecs/features/qt_common.prf
+@@ -30,32 +30,16 @@ contains(TEMPLATE, .*lib) {
+         rplbase = $$dirname(_QMAKE_SUPER_CACHE_)/[^/][^/]*
+     else: \
+         rplbase = $$MODULE_BASE_OUTDIR
+-    host_build {
+-        qqt_libdir = \$\$\$\$[QT_HOST_LIBS]
+-        qt_libdir = $$[QT_HOST_LIBS]
+-    } else {
+-        qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS]
+-        qt_libdir = $$[QT_INSTALL_LIBS]
+-    }
++    qt_libdir = $$NIX_OUTPUT_OUT/lib
+     contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) {
+-        lib_replace0.match = $$rplbase/lib/
+-        lib_replace0.replace = $$qqt_libdir/
+-        lib_replace0.CONFIG = path
+-        QMAKE_PRL_INSTALL_REPLACE += lib_replace0
+         lib_replace.match = "[^ ']*$$rplbase/lib"
+         lib_replace.replace =
+     } else {
+         lib_replace.match = $$rplbase/lib
+-        lib_replace.replace = $$qqt_libdir
++        lib_replace.replace = $$qt_libdir
+     }
+     lib_replace.CONFIG = path
+     QMAKE_PRL_INSTALL_REPLACE += lib_replace
+-    !equals(qt_libdir, $$rplbase/lib) {
+-        qtlibdir_replace.match = $$qt_libdir
+-        qtlibdir_replace.replace = $$qqt_libdir
+-        qtlibdir_replace.CONFIG = path
+-        QMAKE_PRL_INSTALL_REPLACE += qtlibdir_replace
+-    }
+ }
+ 
+ # The remainder of this file must not apply to host tools/libraries,
+diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
+index ee7de22059..9015b30d73 100644
+--- a/mkspecs/features/qt_module.prf
++++ b/mkspecs/features/qt_module.prf
+@@ -303,10 +303,7 @@ load(qt_targets)
+ }
+ !lib_bundle:unix {
+     CONFIG += create_libtool
+-    host_build: \
+-        QMAKE_LIBTOOL_LIBDIR = $$[QT_HOST_LIBS]
+-    else: \
+-        QMAKE_LIBTOOL_LIBDIR = "=$$[QT_INSTALL_LIBS/raw]"
++    QMAKE_LIBTOOL_LIBDIR = $$NIX_OUTPUT_OUT/lib
+     !isEmpty(lib_replace0.match) {
+         ltlib_replace0.match = $$lib_replace0.match
+         ltlib_replace0.replace = $$QMAKE_LIBTOOL_LIBDIR/
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0005-qtbase-cmake.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0005-qtbase-cmake.patch
new file mode 100644
index 000000000000..64a88f300d84
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0005-qtbase-cmake.patch
@@ -0,0 +1,194 @@
+From 6f53835deae80b28ec5c1c9a5c0294bbcc87f91b Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:34:28 -0500
+Subject: [PATCH 05/12] qtbase-cmake
+
+---
+ mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in  |  2 +-
+ mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in |  4 ++--
+ src/corelib/Qt5CoreConfigExtras.cmake.in             | 10 +++++-----
+ src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in    |  2 +-
+ .../Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in  |  2 +-
+ src/dbus/Qt5DBusConfigExtras.cmake.in                | 12 ++----------
+ src/gui/Qt5GuiConfigExtras.cmake.in                  |  6 +++---
+ src/widgets/Qt5WidgetsConfigExtras.cmake.in          |  2 +-
+ 8 files changed, 16 insertions(+), 24 deletions(-)
+
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index c60ef16e64..e354ab9156 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -278,7 +278,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})
+ 
+-        set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++        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}
+diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+index 5baf0fdb10..3583745aea 100644
+--- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ b/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 \"$${CMAKE_PLUGIN_DIR}$${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 \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
+ !!ENDIF
+ 
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
+diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
+index e0652fdcf9..450b2a2d28 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
+@@ -116,7 +116,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
+@@ -130,7 +130,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/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 84dbbfebd4..8ad0720c5c 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_OUT/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+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
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0006-qtbase-gtk3.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0006-qtbase-gtk3.patch
new file mode 100644
index 000000000000..ed1c61e76787
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0006-qtbase-gtk3.patch
@@ -0,0 +1,48 @@
+From 5bf1785809baf6be7fb5904ce6cefdb761f2c278 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:35:33 -0500
+Subject: [PATCH 06/12] qtbase-gtk3
+
+---
+ src/plugins/platformthemes/gtk3/main.cpp | 17 ++++++++++++++++-
+ 1 file changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/src/plugins/platformthemes/gtk3/main.cpp b/src/plugins/platformthemes/gtk3/main.cpp
+index fb1c425d8e..bb8bab9795 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;
+ }
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0007-qtbase-xcursor.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0007-qtbase-xcursor.patch
new file mode 100644
index 000000000000..2fd9e9509d63
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0007-qtbase-xcursor.patch
@@ -0,0 +1,29 @@
+From 35e80f303ae6a6c4c53ba8eb3d84574cc03d68d8 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:35:58 -0500
+Subject: [PATCH 07/12] qtbase-xcursor
+
+---
+ src/plugins/platforms/xcb/qxcbcursor.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
+index fbadab4d50..c83ce0af5b 100644
+--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
++++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
+@@ -317,10 +317,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
+ #if QT_CONFIG(xcb_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) {
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0008-qtbase-xcompose.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0008-qtbase-xcompose.patch
new file mode 100644
index 000000000000..af45be94fecb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0008-qtbase-xcompose.patch
@@ -0,0 +1,30 @@
+From b7c1c103ba04e76ae498f87ca9ef2c4e09e36d7e Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:36:10 -0500
+Subject: [PATCH 08/12] qtbase-xcompose
+
+---
+ .../compose/generator/qtablegenerator.cpp                    | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp
+index b5a0a5bbeb..6c20305f4d 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()
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0009-qtbase-tzdir.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0009-qtbase-tzdir.patch
new file mode 100644
index 000000000000..03466b69afbe
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0009-qtbase-tzdir.patch
@@ -0,0 +1,51 @@
+From db9686362ae34e02538e449e0edfe3d61065b2e9 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:36:25 -0500
+Subject: [PATCH 09/12] qtbase-tzdir
+
+---
+ src/corelib/tools/qtimezoneprivate_tz.cpp | 20 ++++++++++++++------
+ 1 file changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/src/corelib/tools/qtimezoneprivate_tz.cpp b/src/corelib/tools/qtimezoneprivate_tz.cpp
+index 57bc000af5..d7d8119682 100644
+--- a/src/corelib/tools/qtimezoneprivate_tz.cpp
++++ b/src/corelib/tools/qtimezoneprivate_tz.cpp
+@@ -77,7 +77,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");
+ 
+@@ -656,12 +660,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;
++            }
+         }
+     }
+ 
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0010-qtbase-qtpluginpath.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0010-qtbase-qtpluginpath.patch
new file mode 100644
index 000000000000..2c03521286a6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0010-qtbase-qtpluginpath.patch
@@ -0,0 +1,32 @@
+From a3aaebda6d4b302cd202c21e306c55d3715e9b0d Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:36:41 -0500
+Subject: [PATCH 10/12] qtbase-qtpluginpath
+
+---
+ src/corelib/kernel/qcoreapplication.cpp | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
+index db6546028a..cc97c46004 100644
+--- a/src/corelib/kernel/qcoreapplication.cpp
++++ b/src/corelib/kernel/qcoreapplication.cpp
+@@ -2694,6 +2694,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));
++            }
++        }
++
+         QString libPathEnv = qEnvironmentVariable("QT_PLUGIN_PATH");
+         if (!libPathEnv.isEmpty()) {
+             QStringList paths = libPathEnv.split(QDir::listSeparator(), QString::SkipEmptyParts);
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0011-qtbase-assert.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0011-qtbase-assert.patch
new file mode 100644
index 000000000000..b4e0ab762298
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0011-qtbase-assert.patch
@@ -0,0 +1,32 @@
+From 4f93027de0e9b825c4b7853d583e9b02a0443c6b Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:37:04 -0500
+Subject: [PATCH 11/12] qtbase-assert
+
+---
+ src/testlib/qtestassert.h | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h
+index 6498ea84ef..d821ced7fc 100644
+--- a/src/testlib/qtestassert.h
++++ b/src/testlib/qtestassert.h
+@@ -44,10 +44,13 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-
++#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
++#define QTEST_ASSERT(cond) do { } while ((false) && (cond))
++#define QTEST_ASSERT_X(cond, where, what) do { } while ((false) && (cond))
++#else
+ #define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false)
+-
+ #define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false)
++#endif
+ 
+ QT_END_NAMESPACE
+ 
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0012-fix-header_module.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0012-fix-header_module.patch
new file mode 100644
index 000000000000..1e2c68688b04
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0012-fix-header_module.patch
@@ -0,0 +1,25 @@
+From 821db0c3056a813e2d0d36fbb2c7361df5559b05 Mon Sep 17 00:00:00 2001
+From: Will Dietz <w@wdtz.org>
+Date: Mon, 30 Sep 2019 20:15:40 -0500
+Subject: [PATCH 12/12] fix header_module
+
+---
+ mkspecs/features/qt_module.prf | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
+index 9015b30d73..7347c791b4 100644
+--- a/mkspecs/features/qt_module.prf
++++ b/mkspecs/features/qt_module.prf
+@@ -84,7 +84,7 @@ header_module {
+         CONFIG  += qt_no_install_library
+ 
+     # Allow creation of .prl, .la and .pc files.
+-    target.path = $$[QT_INSTALL_LIBS]
++    target.path = $$NIX_OUTPUT_OUT/lib
+     target.CONFIG += dummy_install
+     INSTALLS    += target
+ } else {
+-- 
+2.23.GIT
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0013-define-kiosurfacesuccess.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0013-define-kiosurfacesuccess.patch
new file mode 100644
index 000000000000..a43a46d8a69b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0013-define-kiosurfacesuccess.patch
@@ -0,0 +1,16 @@
+diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
+index a367487e..c3aeca1d 100644
+--- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
++++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
+@@ -49,6 +49,11 @@
+ // but was only added in the 10.14 SDK, so declare it just in case.
+ extern "C" CFPropertyListRef CGColorSpaceCopyPropertyList(CGColorSpaceRef space);
+ 
++// Introduced in 10.13: http://codeworkshop.net/objc-diff/sdkdiffs/macos/10.13/IOSurface.html
++#if !defined(kIOSurfaceSuccess)
++#define kIOSurfaceSuccess KERN_SUCCESS
++#endif
++
+ QT_BEGIN_NAMESPACE
+ 
+ Q_LOGGING_CATEGORY(lcQpaIOSurface, "qt.qpa.backingstore.iosurface");
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0014-qtbase-pkg-config.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0014-qtbase-pkg-config.patch
new file mode 100644
index 000000000000..90caaea1cf4d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtbase.patch.d/0014-qtbase-pkg-config.patch
@@ -0,0 +1,14 @@
+diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
+--- a/qmake/generators/makefile.cpp
++++ b/qmake/generators/makefile.cpp
+@@ -3390,8 +3390,7 @@ MakefileGenerator::writePkgConfigFile()
+       << varGlue("QMAKE_PKGCONFIG_CFLAGS", "", " ", " ")
+         //      << varGlue("DEFINES","-D"," -D"," ")
+          ;
+-    if (!project->values("QMAKE_DEFAULT_INCDIRS").contains(includeDir))
+-        t << "-I${includedir}";
++    t << "-I${includedir}";
+     if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")
+         && libDir != QLatin1String("/Library/Frameworks")) {
+             t << " -F${libdir}";
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtdeclarative.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtdeclarative.patch
new file mode 100644
index 000000000000..8f5b5d4790fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtdeclarative.patch
@@ -0,0 +1,33 @@
+diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
+index 005db4248..685c5b1b2 100644
+--- a/src/qml/qml/qqmlimport.cpp
++++ b/src/qml/qml/qqmlimport.cpp
+@@ -1760,6 +1760,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 QString envImportPath = qEnvironmentVariable("QML2_IMPORT_PATH");
+diff --git a/tools/qmlcachegen/qmlcache.prf b/tools/qmlcachegen/qmlcache.prf
+index 537eaf62e..e21de58f6 100644
+--- a/tools/qmlcachegen/qmlcache.prf
++++ b/tools/qmlcachegen/qmlcache.prf
+@@ -26,7 +26,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/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtscript.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtscript.patch
new file mode 100644
index 000000000000..5508dec1280e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtscript.patch
@@ -0,0 +1,13 @@
+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
++++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+@@ -81,7 +81,7 @@
+ #include <pthread.h>
+ #elif PLATFORM(GTK)
+ #include <wtf/gtk/GOwnPtr.h>
+-typedef struct _GMutex GMutex;
++typedef union _GMutex GMutex;
+ typedef struct _GCond GCond;
+ #endif
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtserialport.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtserialport.patch
new file mode 100644
index 000000000000..f25524e80bcf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtserialport.patch
@@ -0,0 +1,22 @@
+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()) {
++#ifdef NIXPKGS_LIBUDEV
++        udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
++#else
+         udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++#endif
+         if (!udevLibrary->load()) {
++#ifdef NIXPKGS_LIBUDEV
++            udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
++#else
+             udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++#endif
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qttools.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qttools.patch
new file mode 100644
index 000000000000..8ae12198ca25
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qttools.patch
@@ -0,0 +1,15 @@
+--- a/src/macdeployqt/shared/shared.cpp
++++ b/src/macdeployqt/shared/shared.cpp
+@@ -1241,6 +1241,12 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
+     if (!QFile(qmlImportScannerPath).exists())
+         qmlImportScannerPath = QCoreApplication::applicationDirPath() + "/qmlimportscanner";
+ 
++#ifdef NIXPKGS_QMLIMPORTSCANNER
++    // Fallback: Nixpkgs hardcoded path
++    if (!QFile(qmlImportScannerPath).exists())
++        qmlImportScannerPath = NIXPKGS_QMLIMPORTSCANNER;
++#endif
++
+     // Verify that we found a qmlimportscanner binary
+     if (!QFile(qmlImportScannerPath).exists()) {
+         LogError() << "qmlimportscanner not found at" << qmlImportScannerPath;
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-fix-failed-static-assertion.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-fix-failed-static-assertion.patch
new file mode 100644
index 000000000000..510e25f56a4d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-fix-failed-static-assertion.patch
@@ -0,0 +1,31 @@
+Fix a following build error:
+
+In file included from ../../3rdparty/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm:7:
+../../3rdparty/chromium/base/bind.h:59:3: error: static_assert failed "Bound argument |i| of type |Arg| cannot be forwarded as |Unwrapped| to the bound functor, which declares it as |Param|."
+  static_assert(
+  ^
+../../3rdparty/chromium/base/bind.h:91:7: note: in instantiation of template class 'base::internal::AssertConstructible<1, long, long, const long &, NSError *>' requested here
+    : AssertConstructible<Ns, Args, std::decay_t<Args>, Unwrapped, Params>... {
+      ^
+../../3rdparty/chromium/base/bind.h:213:27: note: in instantiation of template class 'base::internal::AssertBindArgsValidity<std::__1::integer_sequence<unsigned long, 0, 1>, base::internal::TypeList<base::WeakPtr<device::BluetoothRemoteGattCharacteristicMac>, long>, base::internal::TypeList<device::BluetoothRemoteGattCharacteristicMac *, const long &>, base::internal::TypeList<device::BluetoothRemoteGattCharacteristicMac *, NSError *> >' requested here
+  static_assert(internal::AssertBindArgsValidity<
+                          ^
+../../3rdparty/chromium/base/bind.h:242:16: note: in instantiation of function template specialization 'base::BindRepeating<void (device::BluetoothRemoteGattCharacteristicMac::*)(NSError *), base::WeakPtr<device::BluetoothRemoteGattCharacteristicMac>, long>' requested here
+  return base::BindRepeating(std::forward<Functor>(functor),
+               ^
+../../3rdparty/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm:211:15: note: in instantiation of function template specialization 'base::Bind<void (device::BluetoothRemoteGattCharacteristicMac::*)(NSError *), base::WeakPtr<device::BluetoothRemoteGattCharacteristicMac>, long>' requested here
+        base::Bind(&BluetoothRemoteGattCharacteristicMac::DidWriteValue,
+              ^
+
+Resurrected from https://github.com/NixOS/nixpkgs/blob/ddcf01bca6c7a7a7f096bec836a1e6a707ad473d/pkgs/development/libraries/qt-5/5.11/qtwebengine-clang-fix.patch because the same problem is present in 5.12 when compiling on macOS.
+
+--- a/src/3rdparty/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
++++ b/src/3rdparty/chromium/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
+@@ -209,7 +209,7 @@ void BluetoothRemoteGattCharacteristicMac::WriteRemoteCharacteristic(
+     base::ThreadTaskRunnerHandle::Get()->PostTask(
+         FROM_HERE,
+         base::Bind(&BluetoothRemoteGattCharacteristicMac::DidWriteValue,
+-                   weak_ptr_factory_.GetWeakPtr(), nil));
++                   weak_ptr_factory_.GetWeakPtr(), nullptr));
+   }
+ }
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-no-platform-check.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-no-platform-check.patch
new file mode 100644
index 000000000000..8ed3fe59a5a2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-darwin-no-platform-check.patch
@@ -0,0 +1,71 @@
+diff --git a/configure.pri b/configure.pri
+index 897bea54..6f834c20 100644
+--- a/configure.pri
++++ b/configure.pri
+@@ -269,7 +269,7 @@ defineReplace(webEngineGetMacOSVersion) {
+ }
+ 
+ defineReplace(webEngineGetMacOSSDKVersion) {
+-    value = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version ProductVersion 2>/dev/null")
++    value = $$system("xcrun --show-sdk-version")
+     return($$value)
+ }
+ 
+diff --git a/mkspecs/features/platform.prf b/mkspecs/features/platform.prf
+index 35eb6b89..7eed640a 100644
+--- a/mkspecs/features/platform.prf
++++ b/mkspecs/features/platform.prf
+@@ -40,8 +40,6 @@ defineTest(isPlatformSupported) {
+   } else:osx {
+     # FIXME: Try to get it back down to 8.2 for building on OS X 10.11
+     !isMinXcodeVersion(8, 3, 3) {
+-      skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 8.3.3 is required to build Qt WebEngine.")
+-      return(false)
+     }
+     !clang|intel_icc {
+         skipBuild("Qt WebEngine on macOS requires Clang.")
+@@ -54,8 +52,6 @@ defineTest(isPlatformSupported) {
+       return(false)
+     }
+     !isMinOSXSDKVersion(10, 12): {
+-      skipBuild("Building Qt WebEngine requires a macOS SDK version of 10.12 or newer. Current version is $${WEBENGINE_OSX_SDK_PRODUCT_VERSION}.")
+-      return(false)
+     }
+   } else {
+     skipBuild("Unknown platform. Qt WebEngine only supports Linux, Windows, and macOS.")
+@@ -111,7 +107,7 @@ defineTest(isMinOSXSDKVersion) {
+     requested_minor = $$2
+     requested_patch = $$3
+     isEmpty(requested_patch): requested_patch = 0
+-    WEBENGINE_OSX_SDK_PRODUCT_VERSION = $$system("/usr/bin/xcodebuild -sdk $$QMAKE_MAC_SDK -version ProductVersion 2>/dev/null")
++    WEBENGINE_OSX_SDK_PRODUCT_VERSION = $$system("xcrun --show-sdk-version")
+     export(WEBENGINE_OSX_SDK_PRODUCT_VERSION)
+     isEmpty(WEBENGINE_OSX_SDK_PRODUCT_VERSION) {
+         skipBuild("Could not resolve SDK product version for \'$$QMAKE_MAC_SDK\'.")
+diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri
+index 4426901c..3aa6057e 100644
+--- a/src/core/config/mac_osx.pri
++++ b/src/core/config/mac_osx.pri
+@@ -5,16 +5,16 @@ load(functions)
+ # otherwise query for it.
+ QMAKE_MAC_SDK_VERSION = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.SDKVersion)
+ isEmpty(QMAKE_MAC_SDK_VERSION) {
+-     QMAKE_MAC_SDK_VERSION = $$system("/usr/bin/xcodebuild -sdk $${QMAKE_MAC_SDK} -version SDKVersion 2>/dev/null")
++     QMAKE_MAC_SDK_VERSION = $$system("xcrun --show-sdk-version")
+      isEmpty(QMAKE_MAC_SDK_VERSION): error("Could not resolve SDK version for \'$${QMAKE_MAC_SDK}\'")
+ }
+ 
+ QMAKE_CLANG_DIR = "/usr"
+-QMAKE_CLANG_PATH = $$eval(QMAKE_MAC_SDK.macx-clang.$${QMAKE_MAC_SDK}.QMAKE_CXX)
+-!isEmpty(QMAKE_CLANG_PATH) {
+-    clang_dir = $$clean_path("$$dirname(QMAKE_CLANG_PATH)/../")
+-    exists($$clang_dir): QMAKE_CLANG_DIR = $$clang_dir
+-}
++# QMAKE_CLANG_PATH = $$eval(QMAKE_MAC_SDK.macx-clang.$${QMAKE_MAC_SDK}.QMAKE_CXX)
++# !isEmpty(QMAKE_CLANG_PATH) {
++#     clang_dir = $$clean_path("$$dirname(QMAKE_CLANG_PATH)/../")
++#     exists($$clang_dir): QMAKE_CLANG_DIR = $$clang_dir
++# }
+ 
+ QMAKE_CLANG_PATH = "$${QMAKE_CLANG_DIR}/bin/clang++"
+ message("Using clang++ from $${QMAKE_CLANG_PATH}")
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-no-build-skip.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-no-build-skip.patch
new file mode 100644
index 000000000000..f332d5e1bb2b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebengine-no-build-skip.patch
@@ -0,0 +1,12 @@
+diff --git a/qtwebengine.pro b/qtwebengine.pro
+--- a/qtwebengine.pro
++++ b/qtwebengine.pro
+@@ -5,7 +5,7 @@ runConfigure()
+ 
+ !isEmpty(skipBuildReason) {
+     SUBDIRS =
+-    log($${skipBuildReason}$${EOL})
++    error($${skipBuildReason}$${EOL})
+     log(QtWebEngine will not be built.$${EOL})
+ }
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-qos-classes.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-qos-classes.patch
new file mode 100644
index 000000000000..a7087f517623
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-qos-classes.patch
@@ -0,0 +1,11 @@
+diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake
+--- a/Source/cmake/OptionsQt.cmake
++++ b/Source/cmake/OptionsQt.cmake
+@@ -683,7 +683,6 @@ if (WIN32 AND COMPILER_IS_GCC_OR_CLANG)
+ endif ()
+ 
+ if (APPLE)
+-    SET_AND_EXPOSE_TO_BUILD(HAVE_QOS_CLASSES 1)
+ endif ()
+ 
+ if (ENABLE_MATHML)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-readline.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-readline.patch
new file mode 100644
index 000000000000..26d189d86019
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit-darwin-no-readline.patch
@@ -0,0 +1,45 @@
+diff --git a/Source/JavaScriptCore/shell/CMakeLists.txt b/Source/JavaScriptCore/shell/CMakeLists.txt
+--- a/Source/JavaScriptCore/shell/CMakeLists.txt
++++ b/Source/JavaScriptCore/shell/CMakeLists.txt
+@@ -9,7 +9,6 @@ set(JSC_LIBRARIES
+ )
+ 
+ if (WTF_OS_MAC_OS_X)
+-    list(APPEND JSC_LIBRARIES edit)
+ endif ()
+ 
+ if ("${JavaScriptCore_LIBRARY_TYPE}" MATCHES "STATIC")
+diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
+--- a/Source/WTF/wtf/Platform.h
++++ b/Source/WTF/wtf/Platform.h
+@@ -563,7 +563,6 @@
+ #if PLATFORM(IOS)
+ 
+ #define HAVE_NETWORK_EXTENSION 1
+-#define HAVE_READLINE 1
+ #if USE(APPLE_INTERNAL_SDK)
+ #define USE_CFNETWORK 1
+ #endif
+@@ -650,7 +649,6 @@
+ #define HAVE_MADV_DONTNEED 1
+ #define HAVE_MERGESORT 1
+ #define HAVE_PTHREAD_SETNAME_NP 1
+-#define HAVE_READLINE 1
+ #define HAVE_SYS_TIMEB_H 1
+ 
+ #if !PLATFORM(GTK) && !PLATFORM(QT)
+diff --git a/Source/WTF/wtf/PlatformMac.cmake b/Source/WTF/wtf/PlatformMac.cmake
+--- a/Source/WTF/wtf/PlatformMac.cmake
++++ b/Source/WTF/wtf/PlatformMac.cmake
+@@ -2,11 +2,9 @@ set(WTF_LIBRARY_TYPE SHARED)
+ 
+ find_library(COCOA_LIBRARY Cocoa)
+ find_library(COREFOUNDATION_LIBRARY CoreFoundation)
+-find_library(READLINE_LIBRARY Readline)
+ list(APPEND WTF_LIBRARIES
+     ${COREFOUNDATION_LIBRARY}
+     ${COCOA_LIBRARY}
+-    ${READLINE_LIBRARY}
+     libicucore.dylib
+ )
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit.patch
new file mode 100644
index 000000000000..b94a4b76cbab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/qtwebkit.patch
@@ -0,0 +1,12 @@
+diff --git a/Source/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake
+--- a/Source/WebKit2/PlatformQt.cmake
++++ b/Source/WebKit2/PlatformQt.cmake
+@@ -261,6 +261,7 @@
+ list(APPEND WebKit2_SYSTEM_INCLUDE_DIRECTORIES
+     ${GLIB_INCLUDE_DIRS}
+     ${GSTREAMER_INCLUDE_DIRS}
++    ${GSTREAMER_PBUTILS_INCLUDE_DIRS}
+     ${Qt5Quick_INCLUDE_DIRS}
+     ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
+     ${SQLITE_INCLUDE_DIR}
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.12/srcs.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.12/srcs.nix
new file mode 100644
index 000000000000..293d017c2dc7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/srcs.nix
@@ -0,0 +1,325 @@
+# DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh
+{ fetchurl, mirror }:
+
+{
+  qt3d = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qt3d-everywhere-src-5.12.7.tar.xz";
+      sha256 = "2030de3dc93fd4062f677f61938229af9cd7aa4c3d2932cdda2ccb663d681126";
+      name = "qt3d-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtactiveqt = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtactiveqt-everywhere-src-5.12.7.tar.xz";
+      sha256 = "302ce1e74dae8ead602ac663e208e6c9b98bdf9a2b7795de4198a28eba2d895d";
+      name = "qtactiveqt-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtandroidextras = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtandroidextras-everywhere-src-5.12.7.tar.xz";
+      sha256 = "a5acc927bd46ed87627e2ae0f0bfc199189d383a3e17c2f34b8c34ea57b2aea1";
+      name = "qtandroidextras-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtbase = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtbase-everywhere-src-5.12.7.tar.xz";
+      sha256 = "b18939cb25d90aef8721fb12ec34c3632d3490ced958e41f6c7a52064643665d";
+      name = "qtbase-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtcanvas3d = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtcanvas3d-everywhere-src-5.12.7.tar.xz";
+      sha256 = "b63a513a2ee11548b122e0fd640b1fa22d3eb83cdc51ddfdf3b97c2ecd0d0c50";
+      name = "qtcanvas3d-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtcharts = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtcharts-everywhere-src-5.12.7.tar.xz";
+      sha256 = "434065526d0b1d8921e96cc1827b1a3579e073b930fe536455c4c1da2f15cf5f";
+      name = "qtcharts-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtconnectivity = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtconnectivity-everywhere-src-5.12.7.tar.xz";
+      sha256 = "647148b9b1a0d3e54f788b66797b81bb87434faf6fb12ac481f9165eda0d071a";
+      name = "qtconnectivity-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtdatavis3d = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtdatavis3d-everywhere-src-5.12.7.tar.xz";
+      sha256 = "07ff5713cfcdf073681d905912e8d871e4451508494c789df805eb241ed98b27";
+      name = "qtdatavis3d-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtdeclarative = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtdeclarative-everywhere-src-5.12.7.tar.xz";
+      sha256 = "5cdc05a035f240ab73b6b37dd3831c1350cd80e5799da47929974085f6eae9bd";
+      name = "qtdeclarative-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtdoc = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtdoc-everywhere-src-5.12.7.tar.xz";
+      sha256 = "6c07918cec8494ea05a42234d8f281a2958de7380458f3fb5a189949ce1233e9";
+      name = "qtdoc-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtgamepad = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtgamepad-everywhere-src-5.12.7.tar.xz";
+      sha256 = "07638c42be94be1e5e622b020c6192341b5bb87be34d7b38f2899672d83a1e94";
+      name = "qtgamepad-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtgraphicaleffects = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtgraphicaleffects-everywhere-src-5.12.7.tar.xz";
+      sha256 = "02f0328420c623da8f9ae949fec01e99ba84213dd2ad559cb00c204502bbcace";
+      name = "qtgraphicaleffects-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtimageformats = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtimageformats-everywhere-src-5.12.7.tar.xz";
+      sha256 = "9bd19ee24fb85f249d01c78e637c95377dd738feb61da0deeee6b770fa62f70b";
+      name = "qtimageformats-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtlocation = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtlocation-everywhere-src-5.12.7.tar.xz";
+      sha256 = "d1e905b80befda3c9aaad92ea984e6dbf722568b5c91e8d15b027bc5bc22781f";
+      name = "qtlocation-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtmacextras = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtmacextras-everywhere-src-5.12.7.tar.xz";
+      sha256 = "265b5607664927e1c92af3abc4b034244f37abd83db1f0a8f22f6952f7d6abb8";
+      name = "qtmacextras-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtmultimedia = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtmultimedia-everywhere-src-5.12.7.tar.xz";
+      sha256 = "28bdaa81371f922223775ae5171c4d589a2c07f255abbe5ccf130ecbbdb4db1d";
+      name = "qtmultimedia-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtnetworkauth = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtnetworkauth-everywhere-src-5.12.7.tar.xz";
+      sha256 = "cbfb7c71a25e74b92b927a5aeae2d099e4142968424a0fcebc1a52fa4fb4576b";
+      name = "qtnetworkauth-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtpurchasing = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtpurchasing-everywhere-src-5.12.7.tar.xz";
+      sha256 = "6f7ecb1e6b6d290b268344ddb031bb7114cd36139c76323732d12661eeb15a76";
+      name = "qtpurchasing-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtquickcontrols = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtquickcontrols-everywhere-src-5.12.7.tar.xz";
+      sha256 = "1038bbc76bba53f9634f40cd9c8ebf0ed8ae82e791f727b228bd81bdcf1859e5";
+      name = "qtquickcontrols-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtquickcontrols2 = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtquickcontrols2-everywhere-src-5.12.7.tar.xz";
+      sha256 = "3a9526e5ad01edbfb796a6631983c391ea1b7e22ae6e07840048156a9e92a237";
+      name = "qtquickcontrols2-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtremoteobjects = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtremoteobjects-everywhere-src-5.12.7.tar.xz";
+      sha256 = "6d6aaec4e9c140c027b0badaabc6322ea3c16cf649495a27fec1f261e891120f";
+      name = "qtremoteobjects-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtscript = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtscript-everywhere-src-5.12.7.tar.xz";
+      sha256 = "ca1dbc66d4125a678638dd0c9c030b72fdfc4ec2c229b9316a8bc80a86104019";
+      name = "qtscript-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtscxml = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtscxml-everywhere-src-5.12.7.tar.xz";
+      sha256 = "afa950bc95f881c90eea564511f3e9918d53fddf0823afb641d20dc6f794fbb6";
+      name = "qtscxml-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtsensors = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtsensors-everywhere-src-5.12.7.tar.xz";
+      sha256 = "2b9aea9f4e2f681b4067f2b9d97c5073c135e41d26601c71f18f199bc980e740";
+      name = "qtsensors-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtserialbus = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtserialbus-everywhere-src-5.12.7.tar.xz";
+      sha256 = "82201edf971e957d849b041ab2914f7497226939c62884ec2906b37576987eae";
+      name = "qtserialbus-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtserialport = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtserialport-everywhere-src-5.12.7.tar.xz";
+      sha256 = "224c282ebed750f46b72dfe18260c3d26fbb74e928dec64bd8c51e7beed8721f";
+      name = "qtserialport-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtspeech = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtspeech-everywhere-src-5.12.7.tar.xz";
+      sha256 = "0cc4f14aa21172b84c8ebca442037cd94927dad4921f6f6bfb4d7f2468aa6060";
+      name = "qtspeech-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtsvg = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtsvg-everywhere-src-5.12.7.tar.xz";
+      sha256 = "4bf60916d4e398d9609f1b3a17fc7345a0e13c7c1cc407298df20da4c7c67bb8";
+      name = "qtsvg-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qttools = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qttools-everywhere-src-5.12.7.tar.xz";
+      sha256 = "860a97114d518f83c0a9ab3742071da16bb018e6eb387179d5764a8dcca03948";
+      name = "qttools-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qttranslations = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qttranslations-everywhere-src-5.12.7.tar.xz";
+      sha256 = "2c8d1169f1f20ba32639181f1853b4159940cbaaac41adaa018b6f43ca31323f";
+      name = "qttranslations-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtvirtualkeyboard = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtvirtualkeyboard-everywhere-src-5.12.7.tar.xz";
+      sha256 = "aaa52aaff923df22de8472d71843dadb80f3f6fe0312122e64ffe5436db40daa";
+      name = "qtvirtualkeyboard-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtwayland = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtwayland-everywhere-src-5.12.7.tar.xz";
+      sha256 = "fc1ab8e25461580e37090e4f82422411dee71a3de48a54be1f4b6569e00f66c5";
+      name = "qtwayland-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtwebchannel = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtwebchannel-everywhere-src-5.12.7.tar.xz";
+      sha256 = "b0ae72e5957aa4b281a37d2e169fcf91f92382bc36bd0cf09c80b2bb961bce75";
+      name = "qtwebchannel-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtwebengine = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtwebengine-everywhere-src-5.12.7.tar.xz";
+      sha256 = "83b754dca3dafeb21be6c7cb5ea99f11f5dbe9055bc1680f5bd7159224bb46fa";
+      name = "qtwebengine-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtwebglplugin = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtwebglplugin-everywhere-src-5.12.7.tar.xz";
+      sha256 = "e049ed855bc772a56808844a803aac653d2d64f092a1fd1fe6a73ab460b55c3b";
+      name = "qtwebglplugin-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtwebsockets = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtwebsockets-everywhere-src-5.12.7.tar.xz";
+      sha256 = "6fd13c2558f532a32f20d977b44c0146107a0e93861df84978e4fd72af283b17";
+      name = "qtwebsockets-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtwebview = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtwebview-everywhere-src-5.12.7.tar.xz";
+      sha256 = "d3f82d2ceab59dc4dee3b6f54f4b70869c199d63f4534b299d900cdacc9b7be7";
+      name = "qtwebview-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtwinextras = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtwinextras-everywhere-src-5.12.7.tar.xz";
+      sha256 = "cfeec81ee1f75b9786ed28382deecc5e38fd142c0b48476beccadb587f93118c";
+      name = "qtwinextras-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtx11extras = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtx11extras-everywhere-src-5.12.7.tar.xz";
+      sha256 = "23895f4b1e84f3783526b9e17680df38c587601d4dfa6ff1b81ace432c480b96";
+      name = "qtx11extras-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+  qtxmlpatterns = {
+    version = "5.12.7";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.12/5.12.7/submodules/qtxmlpatterns-everywhere-src-5.12.7.tar.xz";
+      sha256 = "9002014129a1f2a44700df333a7776e23bdfd689e7a619c3540fd9f6819b417b";
+      name = "qtxmlpatterns-everywhere-src-5.12.7.tar.xz";
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/default.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.14/default.nix
new file mode 100644
index 000000000000..469157a5f727
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/default.nix
@@ -0,0 +1,182 @@
+/*
+
+# Updates
+
+Before a major version update, make a copy of this directory. (We like to
+keep the old version around for a short time after major updates.) Add a
+top-level attribute to `top-level/all-packages.nix`.
+
+1. Update the URL in `pkgs/development/libraries/qt-5/$VERSION/fetch.sh`.
+2. From the top of the Nixpkgs tree, run
+   `./maintainers/scripts/fetch-kde-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
+3. Check that the new packages build correctly.
+4. Commit the changes and open a pull request.
+
+*/
+
+{
+  newScope,
+  stdenv, fetchurl, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper,
+  bison, cups ? null, harfbuzz, libGL, perl,
+  gstreamer, gst-plugins-base, gtk3, dconf,
+  llvmPackages_5,
+
+  # options
+  developerBuild ? false,
+  decryptSslTraffic ? false,
+  debug ? false,
+}:
+
+with stdenv.lib;
+
+let
+
+  qtCompatVersion = srcs.qtbase.version;
+
+  stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
+
+  mirror = "https://download.qt.io";
+  srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
+    # qtwebkit does not have an official release tarball on the qt mirror and is
+    # mostly maintained by the community.
+    qtwebkit = rec {
+      src = fetchFromGitHub {
+        owner = "qt";
+        repo = "qtwebkit";
+        rev = "v${version}";
+        sha256 = "0x8rng96h19xirn7qkz3lydal6v4vn00bcl0s3brz36dfs0z8wpg";
+      };
+      version = "5.212.0-alpha4";
+    };
+  };
+
+  patches = {
+    qtbase =
+      optionals stdenv.isDarwin [
+        ./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
+        ./qtbase.patch.d/0002-qtbase-mac.patch
+      ]
+      ++ [
+        ./qtbase.patch.d/0003-qtbase-mkspecs.patch
+        ./qtbase.patch.d/0004-qtbase-replace-libdir.patch
+        ./qtbase.patch.d/0005-qtbase-cmake.patch
+        ./qtbase.patch.d/0006-qtbase-gtk3.patch
+        ./qtbase.patch.d/0007-qtbase-xcursor.patch
+        ./qtbase.patch.d/0008-qtbase-tzdir.patch
+        ./qtbase.patch.d/0009-qtbase-qtpluginpath.patch
+        ./qtbase.patch.d/0010-qtbase-assert.patch
+        ./qtbase.patch.d/0011-fix-header_module.patch
+      ];
+    qtdeclarative = [ ./qtdeclarative.patch ];
+    qtscript = [ ./qtscript.patch ];
+    qtserialport = [ ./qtserialport.patch ];
+    qtwebengine = [ ]
+      ++ optional stdenv.isDarwin ./qtwebengine-darwin-no-platform-check.patch;
+    qtwebkit = [
+      (fetchpatch {
+        name = "qtwebkit-bison-3.7-build.patch";
+        url = "https://github.com/qtwebkit/qtwebkit/commit/d92b11fea65364fefa700249bd3340e0cd4c5b31.patch";
+        sha256 = "0h8ymfnwgkjkwaankr3iifiscsvngqpwb91yygndx344qdiw9y0n";
+      })
+      ./qtwebkit.patch
+    ] ++ optionals stdenv.isDarwin [
+      ./qtwebkit-darwin-no-readline.patch
+      ./qtwebkit-darwin-no-qos-classes.patch
+    ];
+    qttools = [ ./qttools.patch ];
+  };
+
+  qtModule =
+    import ../qtModule.nix
+    {
+      inherit perl;
+      inherit (stdenv) lib;
+      # Use a variant of mkDerivation that does not include wrapQtApplications
+      # to avoid cyclic dependencies between Qt modules.
+      mkDerivation =
+        import ../mkDerivation.nix
+        { inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
+        stdenvActual.mkDerivation;
+    }
+    { inherit self srcs patches; };
+
+  addPackages = self: with self;
+    let
+      callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
+    in {
+
+      mkDerivationWith =
+        import ../mkDerivation.nix
+        { inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
+
+      mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
+
+      qtbase = callPackage ../modules/qtbase.nix {
+        inherit (srcs.qtbase) src version;
+        patches = patches.qtbase;
+        inherit bison cups harfbuzz libGL;
+        withGtk3 = true; inherit dconf gtk3;
+        inherit developerBuild decryptSslTraffic;
+      };
+
+      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;
+      };
+      qtnetworkauth = callPackage ../modules/qtnetworkauth.nix {};
+      qtquick1 = null;
+      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 {};
+      qtspeech = callPackage ../modules/qtspeech.nix {};
+      qtsvg = callPackage ../modules/qtsvg.nix {};
+      qtscxml = callPackage ../modules/qtscxml.nix {};
+      qttools = callPackage ../modules/qttools.nix {};
+      qttranslations = callPackage ../modules/qttranslations.nix {};
+      qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix {};
+      qtwayland = callPackage ../modules/qtwayland.nix {};
+      qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
+      qtwebengine = callPackage ../modules/qtwebengine.nix {};
+      qtwebglplugin = callPackage ../modules/qtwebglplugin.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
+      qtwebview = callPackage ../modules/qtwebview.nix {};
+      qtx11extras = callPackage ../modules/qtx11extras.nix {};
+      qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
+
+      env = callPackage ../qt-env.nix {};
+      full = env "qt-full-${qtbase.version}" ([
+        qtcharts qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
+        qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2
+        qtscript qtsensors qtserialport qtsvg qttools qttranslations
+        qtvirtualkeyboard qtwebchannel qtwebengine qtwebkit qtwebsockets
+        qtwebview qtx11extras qtxmlpatterns
+      ] ++ optional (!stdenv.isDarwin) qtwayland
+        ++ optional (stdenv.isDarwin) qtmacextras);
+
+      qmake = makeSetupHook {
+        deps = [ self.qtbase.dev ];
+        substitutions = {
+          fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh;
+        };
+      } ../hooks/qmake-hook.sh;
+
+      wrapQtAppsHook = makeSetupHook {
+        deps =
+          [ self.qtbase.dev makeWrapper ]
+          ++ optional stdenv.isLinux self.qtwayland.dev;
+      } ../hooks/wrap-qt-apps-hook.sh;
+    };
+
+   self = makeScope newScope addPackages;
+
+in self
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/fetch.sh b/nixpkgs/pkgs/development/libraries/qt-5/5.14/fetch.sh
new file mode 100644
index 000000000000..2d266b529776
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/fetch.sh
@@ -0,0 +1 @@
+WGET_ARGS=( http://download.qt.io/official_releases/qt/5.14/5.14.2/submodules/ )
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
new file mode 100644
index 000000000000..0951b6646ab7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
@@ -0,0 +1,411 @@
+From a5848991db270ffdd9f2fa05220475bb3194d12f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
+Date: Fri, 3 Apr 2020 21:07:58 +0200
+Subject: [PATCH 01/10] qtbase-mkspecs-mac
+
+---
+ mkspecs/common/mac.conf               |   2 +-
+ mkspecs/features/mac/default_post.prf | 206 --------------------------
+ mkspecs/features/mac/default_pre.prf  |  58 --------
+ mkspecs/features/mac/sdk.mk           |  25 ----
+ mkspecs/features/mac/sdk.prf          |  61 --------
+ 5 files changed, 1 insertion(+), 351 deletions(-)
+ delete mode 100644 mkspecs/features/mac/sdk.mk
+ delete mode 100644 mkspecs/features/mac/sdk.prf
+
+diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
+index 61bea952b2..9909dae726 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/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
+index ba163efc18..b80ec1e801 100644
+--- a/mkspecs/features/mac/default_post.prf
++++ b/mkspecs/features/mac/default_post.prf
+@@ -68,212 +68,6 @@ 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 {
+-    uikit: QMAKE_RPATHDIR += @executable_path/Frameworks
+-    else: 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 {
+-    qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO
+-    !isEmpty(QMAKE_PKGINFO_TYPEINFO): \
+-        qmake_pkginfo_typeinfo.value = $$QMAKE_PKGINFO_TYPEINFO
+-    else: \
+-        qmake_pkginfo_typeinfo.value = "????"
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_pkginfo_typeinfo
+-
+-    bundle_version = $$VERSION
+-    isEmpty(bundle_version): bundle_version = 1.0.0
+-
+-    l = $$split(bundle_version, '.') 0 0  # make sure there are at least three
+-    VER_MAJ = $$member(l, 0, 0)
+-    VER_MIN = $$member(l, 1, 1)
+-    VER_PAT = $$member(l, 2, 2)
+-    unset(l)
+-
+-    qmake_full_version.name = QMAKE_FULL_VERSION
+-    qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
+-
+-    qmake_short_version.name = QMAKE_SHORT_VERSION
+-    qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
+-
+-    !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
+-            sysroot_path  = $$xcodeSDKInfo(Path, $$simulator.sdk)
+-        } else {
+-            version_identifier = $$device.deployment_identifier
+-            sysroot_path  = $$xcodeSDKInfo(Path, $$device.sdk)
+-        }
+-        version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
+-        QMAKE_CFLAGS += -isysroot $$sysroot_path $$version_min_flag
+-        QMAKE_CXXFLAGS += -isysroot $$sysroot_path $$version_min_flag
+-        QMAKE_LFLAGS += -Wl,-syslibroot,$$sysroot_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}
+-}
+-
+-!equals(sdk_version, $$QMAKE_MAC_SDK_VERSION) {
+-    # Explicit SDK version has been set, respect that
+-    QMAKE_LFLAGS += -Wl,-sdk_version -Wl,$$sdk_version
+-}
+-
+-cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
+-!isEmpty(QMAKE_XCODE_VERSION): \
+-    cache(QMAKE_XCODE_VERSION, stash)
+-
+-QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
+-
+-xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER
+-xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX
+-isEmpty(xcode_product_bundle_identifier_setting.value): \
+-    xcode_product_bundle_identifier_setting.value = "com.yourcompany"
+-xcode_product_bundle_target = $$QMAKE_BUNDLE
+-isEmpty(xcode_product_bundle_target): \
+-    xcode_product_bundle_target = ${PRODUCT_NAME:rfc1034identifier}
+-xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.$${xcode_product_bundle_target}"
+-QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
+-
+ !macx-xcode {
+     generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS
+     generate_xcode_project.target = xcodeproj
+diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
+index e3534561a5..3b01424e67 100644
+--- a/mkspecs/features/mac/default_pre.prf
++++ b/mkspecs/features/mac/default_pre.prf
+@@ -1,60 +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
+-
+-xcode_copy_phase_strip_setting.name = COPY_PHASE_STRIP
+-xcode_copy_phase_strip_setting.value = NO
+-QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
+diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk
+deleted file mode 100644
+index c40f58c987..0000000000
+--- a/mkspecs/features/mac/sdk.mk
++++ /dev/null
+@@ -1,25 +0,0 @@
+-
+-ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),)
+-    CHECK_SDK_COMMAND = /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version 2>&1
+-    CURRENT_MAC_SDK_VERSION := $(shell DEVELOPER_DIR=$(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) $(CHECK_SDK_COMMAND))
+-    ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION))
+-        # We don't want to complain about out of date SDK unless the target needs to be remade.
+-        # This covers use-cases such as running 'make check' after moving the build to a
+-        # computer without Xcode or with a different Xcode version.
+-        TARGET_UP_TO_DATE := $(shell QT_MAC_SDK_NO_VERSION_CHECK=1 $(MAKE) --question $(QMAKE_TARGET) && echo 1 || echo 0)
+-        ifeq ($(TARGET_UP_TO_DATE),0)
+-            ifneq ($(findstring missing DEVELOPER_DIR path,$(CURRENT_MAC_SDK_VERSION)),)
+-                $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) is no longer valid.)
+-            else ifneq ($(findstring SDK "$(EXPORT_QMAKE_MAC_SDK)" cannot be located,$(CURRENT_MAC_SDK_VERSION)),)
+-                $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) no longer contains the $(EXPORT_QMAKE_MAC_SDK_VERSION) platform SDK.)
+-            else ifneq ($(CURRENT_MAC_SDK_VERSION),)
+-                $(info The platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).)
+-            else
+-                $(info Unknown error resolving current platform SDK version.)
+-            endif
+-            $(info This requires a fresh build. Please wipe the build directory completely,)
+-            $(info including any .qmake.stash and .qmake.cache files generated by qmake.)
+-            $(error ^)
+-        endif
+-    endif
+-endif
+diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
+deleted file mode 100644
+index 3a9c2778bb..0000000000
+--- a/mkspecs/features/mac/sdk.prf
++++ /dev/null
+@@ -1,61 +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"): \
+-        infoarg = --show-sdk-path
+-    equals(info, "PlatformPath"): \
+-        infoarg = --show-sdk-platform-path
+-    equals(info, "SDKVersion"): \
+-        infoarg = --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 $$infoarg 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(infoarg, "--show-sdk-platform-path")): \
+-            error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg")
+-        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)
+-
+-isEmpty(QMAKE_EXPORT_INCDIR_OPENGL) {
+-    QMAKE_EXPORT_INCDIR_OPENGL = $$QMAKE_INCDIR_OPENGL
+-    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 QMAKE_LINK_C QMAKE_LINK_C_SHLIB)) {
+-    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)
+-}
+-- 
+2.25.1
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0002-qtbase-mac.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0002-qtbase-mac.patch
new file mode 100644
index 000000000000..2e28466c5032
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0002-qtbase-mac.patch
@@ -0,0 +1,116 @@
+From ccaa916eab33093704293bc911eedd85fbe5f160 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
+Date: Fri, 3 Apr 2020 21:15:27 +0200
+Subject: [PATCH 02/10] qtbase-mac
+
+---
+ src/corelib/kernel/qcore_mac_p.h | 16 ++++++++++++++--
+ src/testlib/qappletestlogger.cpp |  2 +-
+ src/testlib/qappletestlogger_p.h |  2 +-
+ src/testlib/qtestcase.cpp        |  2 +-
+ src/testlib/qtestlog.cpp         |  2 +-
+ src/testlib/qtestlog_p.h         |  2 +-
+ 6 files changed, 19 insertions(+), 7 deletions(-)
+
+diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
+index 535d3579b2..3d70bf39c1 100644
+--- a/src/corelib/kernel/qcore_mac_p.h
++++ b/src/corelib/kernel/qcore_mac_p.h
+@@ -225,7 +225,7 @@ private:
+ 
+ // --------------------------------------------------------------------------
+ 
+-#if !defined(QT_BOOTSTRAPPED)
++#if 0
+ 
+ QT_END_NAMESPACE
+ #include <os/activity.h>
+@@ -303,7 +303,19 @@ QT_MAC_WEAK_IMPORT(_os_activity_current);
+ 
+ #define QT_APPLE_SCOPED_LOG_ACTIVITY(...) QAppleLogActivity scopedLogActivity = QT_APPLE_LOG_ACTIVITY(__VA_ARGS__).enter();
+ 
+-#endif // !defined(QT_BOOTSTRAPPED)
++#else // !defined(QT_BOOTSTRAPPED)
++
++#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT3(...)
++#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT2(...)
++#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT(...)
++
++#define QT_APPLE_LOG_ACTIVITY2(...)
++#define QT_APPLE_LOG_ACTIVITY1(...)
++#define QT_APPLE_LOG_ACTIVITY(...)
++
++#define QT_APPLE_SCOPED_LOG_ACTIVITY(...)
++
++#endif
+ 
+ // -------------------------------------------------------------------------
+ 
+diff --git a/src/testlib/qappletestlogger.cpp b/src/testlib/qappletestlogger.cpp
+index dfeadebdef..2a74330c1d 100644
+--- a/src/testlib/qappletestlogger.cpp
++++ b/src/testlib/qappletestlogger.cpp
+@@ -43,7 +43,7 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+ 
+ using namespace QTestPrivate;
+ 
+diff --git a/src/testlib/qappletestlogger_p.h b/src/testlib/qappletestlogger_p.h
+index 62c6d95c5a..f8e0a3b767 100644
+--- a/src/testlib/qappletestlogger_p.h
++++ b/src/testlib/qappletestlogger_p.h
+@@ -57,7 +57,7 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+ class QAppleTestLogger : public QAbstractTestLogger
+ {
+ public:
+diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
+index 70733a692a..8bcda17858 100644
+--- a/src/testlib/qtestcase.cpp
++++ b/src/testlib/qtestcase.cpp
+@@ -852,7 +852,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
+ 
+     bool addFallbackLogger = !explicitLoggerRequested;
+ 
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+     // Any explicitly requested loggers will be added by now, so we can check if they use stdout
+     const bool safeToAddAppleLogger = !AppleUnifiedLogger::willMirrorToStderr() || !QTestLog::loggerUsingStdout();
+     if (safeToAddAppleLogger && QAppleTestLogger::debugLoggingEnabled()) {
+diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
+index f3ebf343c5..9b4f526b2e 100644
+--- a/src/testlib/qtestlog.cpp
++++ b/src/testlib/qtestlog.cpp
+@@ -465,7 +465,7 @@ void QTestLog::addLogger(LogMode mode, const char *filename)
+     case QTestLog::TAP:
+         logger = new QTapTestLogger(filename);
+         break;
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+     case QTestLog::Apple:
+         logger = new QAppleTestLogger;
+         break;
+diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
+index fff36f290d..f737ccf064 100644
+--- a/src/testlib/qtestlog_p.h
++++ b/src/testlib/qtestlog_p.h
+@@ -72,7 +72,7 @@ public:
+ 
+     enum LogMode {
+         Plain = 0, XML, LightXML, XunitXML, CSV, TeamCity, TAP
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+         , Apple
+ #endif
+ #if defined(HAVE_XCTEST)
+-- 
+2.25.1
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0003-qtbase-mkspecs.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0003-qtbase-mkspecs.patch
new file mode 100644
index 000000000000..b704d0dc8722
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0003-qtbase-mkspecs.patch
@@ -0,0 +1,464 @@
+From 1cb5581d7f20bf87ac8d67a7295447a78a1d9645 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
+Date: Sat, 4 Apr 2020 00:25:52 +0200
+Subject: [PATCH 03/10] qtbase-mkspecs
+
+---
+ mkspecs/features/create_cmake.prf             | 51 +++---------
+ .../data/cmake/Qt5BasicConfig.cmake.in        | 80 +------------------
+ mkspecs/features/qml_module.prf               |  2 +-
+ mkspecs/features/qml_plugin.prf               |  2 +-
+ mkspecs/features/qt_app.prf                   |  2 +-
+ mkspecs/features/qt_build_paths.prf           |  4 +-
+ mkspecs/features/qt_docs.prf                  | 10 +--
+ mkspecs/features/qt_example_installs.prf      |  2 +-
+ mkspecs/features/qt_functions.prf             |  2 +-
+ mkspecs/features/qt_installs.prf              | 22 ++---
+ mkspecs/features/qt_plugin.prf                |  2 +-
+ 11 files changed, 38 insertions(+), 141 deletions(-)
+
+diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
+index 0e71fd0015..ba071d9a70 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
+@@ -77,45 +77,20 @@ 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
+ 
+-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_BIN_DIR = $$NIX_OUTPUT_BIN/bin/
++CMAKE_BIN_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_LIB_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_LIB_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_OUT/lib/
++CMAKE_DLL_DIR_IS_ABSOLUTE = True
+ 
+ static|staticlib:CMAKE_STATIC_TYPE = true
+ 
+@@ -258,7 +233,7 @@ contains(CONFIG, plugin) {
+ 
+     cmake_qt5_plugin_file.files = $$cmake_target_file.output
+     static|staticlib: cmake_qt5_plugin_file.files += $$cmake_qt5_plugin_import_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()
+@@ -396,7 +371,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 1099a761ce..87679b7e68 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -3,30 +3,6 @@ if (CMAKE_VERSION VERSION_LESS 3.1.0)
+     message(FATAL_ERROR \"Qt 5 $${CMAKE_MODULE_NAME} module requires at least CMake version 3.1.0\")
+ 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)")
+@@ -146,11 +122,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
+       IsDebugAndRelease)
+     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(_deps
+         ${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}
+@@ -210,11 +182,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
+ !!ENDIF
+ 
+ !!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
+@@ -230,24 +198,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}$${CMAKE_QT_STEM}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework/Headers\"
++      \"$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework\"
++      \"$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.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}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.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}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, .,0, 0)/Headers/$$VERSION/\"
++      \"$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, .,0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -263,7 +220,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
+@@ -465,25 +421,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}\" \"\" $${CMAKE_DEBUG_AND_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_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}\" $${CMAKE_DEBUG_AND_RELEASE})
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -502,25 +446,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}\" \"\" $${CMAKE_DEBUG_AND_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}\" $${CMAKE_DEBUG_AND_RELEASE})
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -542,11 +474,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+           IsDebugAndRelease)
+         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/qml_module.prf b/mkspecs/features/qml_module.prf
+index c0b50416c9..cabe39b22e 100644
+--- a/mkspecs/features/qml_module.prf
++++ b/mkspecs/features/qml_module.prf
+@@ -51,7 +51,7 @@ builtin_resources {
+ # Install rules
+ qmldir.base = $$qmldir_path
+ qmldir.files = $$qmldir_file
+-qmldir.path = $$[QT_INSTALL_QML]/$$TARGETPATH
++qmldir.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ 
+ qmlfiles.base = $$_PRO_FILE_PWD_
+ qmlfiles.files = $$fq_aux_qml_files
+diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
+index f1c5658b04..029595e721 100644
+--- a/mkspecs/features/qml_plugin.prf
++++ b/mkspecs/features/qml_plugin.prf
+@@ -50,7 +50,7 @@ load(qt_build_paths)
+ 
+ DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+ 
+-target.path = $$[QT_INSTALL_QML]/$$TARGETPATH
++target.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ INSTALLS += target
+ 
+ # Some final setup
+diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf
+index 8354f30eea..62028fef8e 100644
+--- a/mkspecs/features/qt_app.prf
++++ b/mkspecs/features/qt_app.prf
+@@ -30,7 +30,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 3bb3823a8e..655b7b7db8 100644
+--- a/mkspecs/features/qt_build_paths.prf
++++ b/mkspecs/features/qt_build_paths.prf
+@@ -24,6 +24,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_docs.prf b/mkspecs/features/qt_docs.prf
+index 095bf15dac..4cc977bea5 100644
+--- a/mkspecs/features/qt_docs.prf
++++ b/mkspecs/features/qt_docs.prf
+@@ -65,7 +65,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) {
+@@ -84,8 +84,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
+@@ -108,12 +108,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 72b47bce27..d59e949e78 100644
+--- a/mkspecs/features/qt_example_installs.prf
++++ b/mkspecs/features/qt_example_installs.prf
+@@ -90,7 +90,7 @@ sourcefiles += \
+     $$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 7777e615bd..abeb03a663 100644
+--- a/mkspecs/features/qt_functions.prf
++++ b/mkspecs/features/qt_functions.prf
+@@ -87,7 +87,7 @@ defineTest(qtHaveModule) {
+ defineTest(qtPrepareTool) {
+     cmd = $$eval(QT_TOOL.$${2}.binary)
+     isEmpty(cmd) {
+-        cmd = $$[QT_HOST_BINS]/$$2
++        cmd = $$system("command -v $$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 1ebca17366..a8f958eae8 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,35 +23,35 @@
+ #headers
+ qt_install_headers {
+     gen_headers.files = $$SYNCQT.GENERATED_HEADER_FILES
+-    gen_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    gen_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += gen_headers
+ 
+     targ_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.INJECTED_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
+     generated_privates: \
+         private_headers.CONFIG += no_check_exist
+     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 573d717eea..024c624cb6 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
+ 
+ qt_libinfix_plugins: TARGET = $$TARGET$$QT_LIBINFIX
+-- 
+2.25.1
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0004-qtbase-replace-libdir.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0004-qtbase-replace-libdir.patch
new file mode 100644
index 000000000000..86ea2e75d9be
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0004-qtbase-replace-libdir.patch
@@ -0,0 +1,68 @@
+From 1cae0c31c9849615190ee175ebf929b3aca13fe0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
+Date: Sat, 4 Apr 2020 00:27:41 +0200
+Subject: [PATCH 04/10] qtbase-replace-libdir
+
+---
+ mkspecs/features/qt_common.prf | 20 ++------------------
+ mkspecs/features/qt_module.prf |  5 +----
+ 2 files changed, 3 insertions(+), 22 deletions(-)
+
+diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
+index c24f2c6062..0d72ce7286 100644
+--- a/mkspecs/features/qt_common.prf
++++ b/mkspecs/features/qt_common.prf
+@@ -31,32 +31,16 @@ contains(TEMPLATE, .*lib) {
+         rplbase = $$dirname(_QMAKE_SUPER_CACHE_)/[^/][^/]*
+     else: \
+         rplbase = $$MODULE_BASE_OUTDIR
+-    host_build {
+-        qqt_libdir = \$\$\$\$[QT_HOST_LIBS]
+-        qt_libdir = $$[QT_HOST_LIBS]
+-    } else {
+-        qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS]
+-        qt_libdir = $$[QT_INSTALL_LIBS]
+-    }
++    qt_libdir = $$NIX_OUTPUT_OUT/lib
+     contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) {
+-        lib_replace0.match = $$rplbase/lib/
+-        lib_replace0.replace = $$qqt_libdir/
+-        lib_replace0.CONFIG = path
+-        QMAKE_PRL_INSTALL_REPLACE += lib_replace0
+         lib_replace.match = "[^ ']*$$rplbase/lib"
+         lib_replace.replace =
+     } else {
+         lib_replace.match = $$rplbase/lib
+-        lib_replace.replace = $$qqt_libdir
++        lib_replace.replace = $$qt_libdir
+     }
+     lib_replace.CONFIG = path
+     QMAKE_PRL_INSTALL_REPLACE += lib_replace
+-    !equals(qt_libdir, $$rplbase/lib) {
+-        qtlibdir_replace.match = $$qt_libdir
+-        qtlibdir_replace.replace = $$qqt_libdir
+-        qtlibdir_replace.CONFIG = path
+-        QMAKE_PRL_INSTALL_REPLACE += qtlibdir_replace
+-    }
+ }
+ 
+ # The remainder of this file must not apply to host tools/libraries,
+diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
+index 828a9621b9..b9e5d35026 100644
+--- a/mkspecs/features/qt_module.prf
++++ b/mkspecs/features/qt_module.prf
+@@ -305,10 +305,7 @@ load(qt_targets)
+ }
+ !lib_bundle:unix {
+     CONFIG += create_libtool
+-    host_build: \
+-        QMAKE_LIBTOOL_LIBDIR = $$[QT_HOST_LIBS]
+-    else: \
+-        QMAKE_LIBTOOL_LIBDIR = "=$$[QT_INSTALL_LIBS/raw]"
++    QMAKE_LIBTOOL_LIBDIR = $$NIX_OUTPUT_OUT/lib
+     !isEmpty(lib_replace0.match) {
+         ltlib_replace0.match = $$lib_replace0.match
+         ltlib_replace0.replace = $$QMAKE_LIBTOOL_LIBDIR/
+-- 
+2.25.1
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0005-qtbase-cmake.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0005-qtbase-cmake.patch
new file mode 100644
index 000000000000..85a729563417
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0005-qtbase-cmake.patch
@@ -0,0 +1,194 @@
+From 7e93d1330e1f8c8cd68334201ad100b8c05c9ab5 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:34:28 -0500
+Subject: [PATCH 05/10] qtbase-cmake
+
+---
+ mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in  |  2 +-
+ mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in |  4 ++--
+ src/corelib/Qt5CoreConfigExtras.cmake.in             | 10 +++++-----
+ src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in    |  2 +-
+ .../Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in  |  2 +-
+ src/dbus/Qt5DBusConfigExtras.cmake.in                | 12 ++----------
+ src/gui/Qt5GuiConfigExtras.cmake.in                  |  6 +++---
+ src/widgets/Qt5WidgetsConfigExtras.cmake.in          |  2 +-
+ 8 files changed, 16 insertions(+), 24 deletions(-)
+
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index 87679b7e68..57060e6470 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -474,7 +474,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+           IsDebugAndRelease)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-        set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++        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}
+diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+index 7b70cfed09..e700cfa539 100644
+--- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -53,10 +53,10 @@ set_property(TARGET Qt5::$$CMAKE_PLUGIN_NAME PROPERTY INTERFACE_SOURCES
+ !!ENDIF
+ 
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
+ !!ENDIF
+ 
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
+diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
+index 9b672327ef..319ba94d6d 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
+@@ -118,7 +118,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
+@@ -132,7 +132,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/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 84dbbfebd4..8ad0720c5c 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_OUT/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+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
+-- 
+2.25.1
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0006-qtbase-gtk3.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0006-qtbase-gtk3.patch
new file mode 100644
index 000000000000..6ce0e5d0c433
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0006-qtbase-gtk3.patch
@@ -0,0 +1,48 @@
+From 1ad04525cdd342e3c8a750323fb3a61b93fee753 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:35:33 -0500
+Subject: [PATCH 06/10] qtbase-gtk3
+
+---
+ src/plugins/platformthemes/gtk3/main.cpp | 17 ++++++++++++++++-
+ 1 file changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/src/plugins/platformthemes/gtk3/main.cpp b/src/plugins/platformthemes/gtk3/main.cpp
+index fb1c425d8e..bb8bab9795 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;
+ }
+-- 
+2.25.1
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0007-qtbase-xcursor.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0007-qtbase-xcursor.patch
new file mode 100644
index 000000000000..6a92a9528303
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0007-qtbase-xcursor.patch
@@ -0,0 +1,29 @@
+From cc953cc3f736fabef1f5c211964f30be719fb35e Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:35:58 -0500
+Subject: [PATCH 07/10] qtbase-xcursor
+
+---
+ src/plugins/platforms/xcb/qxcbcursor.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
+index fbadab4d50..c83ce0af5b 100644
+--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
++++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
+@@ -317,10 +317,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
+ #if QT_CONFIG(xcb_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) {
+-- 
+2.25.1
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0008-qtbase-tzdir.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0008-qtbase-tzdir.patch
new file mode 100644
index 000000000000..71653a0e36e0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0008-qtbase-tzdir.patch
@@ -0,0 +1,64 @@
+From 882343ea200fe28810bf217a820816affe885a39 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:36:25 -0500
+Subject: [PATCH 08/10] qtbase-tzdir
+
+---
+ src/corelib/time/qtimezoneprivate_tz.cpp | 31 +++++++++++++++---------
+ 1 file changed, 19 insertions(+), 12 deletions(-)
+
+diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp
+index 3c2695a789..e75735f88f 100644
+--- a/src/corelib/time/qtimezoneprivate_tz.cpp
++++ b/src/corelib/time/qtimezoneprivate_tz.cpp
+@@ -75,7 +75,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");
+ 
+@@ -658,20 +662,23 @@ 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));
++            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+             if (!tzif.open(QIODevice::ReadOnly)) {
+-                // ianaId may be a POSIX rule, taken from $TZ or /etc/TZ
+-                const QByteArray zoneInfo = ianaId.split(',').at(0);
+-                const char *begin = zoneInfo.constBegin();
+-                if (PosixZone::parse(begin, zoneInfo.constEnd()).hasValidOffset()
+-                    && (begin == zoneInfo.constEnd()
+-                        || PosixZone::parse(begin, zoneInfo.constEnd()).hasValidOffset())) {
+-                    m_id = m_posixRule = ianaId;
++                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++                if (!tzif.open(QIODevice::ReadOnly)) {
++                    // ianaId may be a POSIX rule, taken from $TZ or /etc/TZ
++                    const QByteArray zoneInfo = ianaId.split(',').at(0);
++                    const char *begin = zoneInfo.constBegin();
++                    if (PosixZone::parse(begin, zoneInfo.constEnd()).hasValidOffset()
++                        && (begin == zoneInfo.constEnd()
++                            || PosixZone::parse(begin, zoneInfo.constEnd()).hasValidOffset())) {
++                        m_id = m_posixRule = ianaId;
++                    }
++                    return;
+                 }
+-                return;
+             }
+         }
+     }
+-- 
+2.25.1
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0009-qtbase-qtpluginpath.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0009-qtbase-qtpluginpath.patch
new file mode 100644
index 000000000000..009fe14838e7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0009-qtbase-qtpluginpath.patch
@@ -0,0 +1,19 @@
+--- qtbase-everywhere-src-5.14.2/src/corelib/kernel/qcoreapplication.cpp	2020-03-27 10:49:31.000000000 +0100
++++ qtbase-everywhere-src-5.14.2/src/corelib/kernel/qcoreapplication.cpp.patched	2020-05-09 15:03:03.968084088 +0200
+@@ -2691,6 +2691,16 @@
+         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));
++            }
++        }
++
++
+         auto setPathsFromEnv = [&](QString libPathEnv) {
+             if (!libPathEnv.isEmpty()) {
+                 QStringList paths = libPathEnv.split(QDir::listSeparator(), QString::SkipEmptyParts);
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0010-qtbase-assert.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0010-qtbase-assert.patch
new file mode 100644
index 000000000000..e10f97607326
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0010-qtbase-assert.patch
@@ -0,0 +1,32 @@
+From c8893a4e0a1b46796e39b4a338358fdb45685cba Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:37:04 -0500
+Subject: [PATCH 09/10] qtbase-assert
+
+---
+ src/testlib/qtestassert.h | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h
+index 6498ea84ef..d821ced7fc 100644
+--- a/src/testlib/qtestassert.h
++++ b/src/testlib/qtestassert.h
+@@ -44,10 +44,13 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-
++#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
++#define QTEST_ASSERT(cond) do { } while ((false) && (cond))
++#define QTEST_ASSERT_X(cond, where, what) do { } while ((false) && (cond))
++#else
+ #define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false)
+-
+ #define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false)
++#endif
+ 
+ QT_END_NAMESPACE
+ 
+-- 
+2.25.1
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0011-fix-header_module.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0011-fix-header_module.patch
new file mode 100644
index 000000000000..4358097dddf2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtbase.patch.d/0011-fix-header_module.patch
@@ -0,0 +1,25 @@
+From 4c488fdb457e63924383fb7f8ad45bed3df49480 Mon Sep 17 00:00:00 2001
+From: Will Dietz <w@wdtz.org>
+Date: Mon, 30 Sep 2019 20:15:40 -0500
+Subject: [PATCH 10/10] fix header_module
+
+---
+ mkspecs/features/qt_module.prf | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
+index 16b39031bc..1ac3d6fe59 100644
+--- a/mkspecs/features/qt_module.prf
++++ b/mkspecs/features/qt_module.prf
+@@ -84,7 +84,7 @@ header_module {
+         CONFIG  += qt_no_install_library
+ 
+     # Allow creation of .prl, .la and .pc files.
+-    target.path = $$[QT_INSTALL_LIBS]
++    target.path = $$NIX_OUTPUT_OUT/lib
+     target.CONFIG += dummy_install
+     INSTALLS    += target
+ } else {
+-- 
+2.25.1
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtdeclarative.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtdeclarative.patch
new file mode 100644
index 000000000000..8f5b5d4790fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtdeclarative.patch
@@ -0,0 +1,33 @@
+diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
+index 005db4248..685c5b1b2 100644
+--- a/src/qml/qml/qqmlimport.cpp
++++ b/src/qml/qml/qqmlimport.cpp
+@@ -1760,6 +1760,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 QString envImportPath = qEnvironmentVariable("QML2_IMPORT_PATH");
+diff --git a/tools/qmlcachegen/qmlcache.prf b/tools/qmlcachegen/qmlcache.prf
+index 537eaf62e..e21de58f6 100644
+--- a/tools/qmlcachegen/qmlcache.prf
++++ b/tools/qmlcachegen/qmlcache.prf
+@@ -26,7 +26,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/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtscript.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtscript.patch
new file mode 100644
index 000000000000..5508dec1280e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtscript.patch
@@ -0,0 +1,13 @@
+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
++++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+@@ -81,7 +81,7 @@
+ #include <pthread.h>
+ #elif PLATFORM(GTK)
+ #include <wtf/gtk/GOwnPtr.h>
+-typedef struct _GMutex GMutex;
++typedef union _GMutex GMutex;
+ typedef struct _GCond GCond;
+ #endif
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtserialport.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtserialport.patch
new file mode 100644
index 000000000000..f25524e80bcf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtserialport.patch
@@ -0,0 +1,22 @@
+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()) {
++#ifdef NIXPKGS_LIBUDEV
++        udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
++#else
+         udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++#endif
+         if (!udevLibrary->load()) {
++#ifdef NIXPKGS_LIBUDEV
++            udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
++#else
+             udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++#endif
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qttools.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qttools.patch
new file mode 100644
index 000000000000..8ae12198ca25
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qttools.patch
@@ -0,0 +1,15 @@
+--- a/src/macdeployqt/shared/shared.cpp
++++ b/src/macdeployqt/shared/shared.cpp
+@@ -1241,6 +1241,12 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
+     if (!QFile(qmlImportScannerPath).exists())
+         qmlImportScannerPath = QCoreApplication::applicationDirPath() + "/qmlimportscanner";
+ 
++#ifdef NIXPKGS_QMLIMPORTSCANNER
++    // Fallback: Nixpkgs hardcoded path
++    if (!QFile(qmlImportScannerPath).exists())
++        qmlImportScannerPath = NIXPKGS_QMLIMPORTSCANNER;
++#endif
++
+     // Verify that we found a qmlimportscanner binary
+     if (!QFile(qmlImportScannerPath).exists()) {
+         LogError() << "qmlimportscanner not found at" << qmlImportScannerPath;
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebengine-darwin-no-platform-check.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebengine-darwin-no-platform-check.patch
new file mode 100644
index 000000000000..546e753144d0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebengine-darwin-no-platform-check.patch
@@ -0,0 +1,33 @@
+diff --git a/mkspecs/features/platform.prf b/mkspecs/features/platform.prf
+--- a/mkspecs/features/platform.prf
++++ b/mkspecs/features/platform.prf
+@@ -40,8 +40,6 @@ defineTest(isPlatformSupported) {
+   } else:osx {
+     # FIXME: Try to get it back down to 8.2 for building on OS X 10.11
+     !isMinXcodeVersion(8, 3, 3) {
+-      skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 8.3.3 is required to build Qt WebEngine.")
+-      return(false)
+     }
+     !clang|intel_icc {
+         skipBuild("Qt WebEngine on macOS requires Clang.")
+@@ -54,8 +52,6 @@ defineTest(isPlatformSupported) {
+       return(false)
+     }
+     !isMinOSXSDKVersion(10, 12): {
+-      skipBuild("Building Qt WebEngine requires a macOS SDK version of 10.12 or newer. Current version is $${WEBENGINE_OSX_SDK_PRODUCT_VERSION}.")
+-      return(false)
+     }
+   } else {
+     skipBuild("Unknown platform. Qt WebEngine only supports Linux, Windows, and macOS.")
+diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri
+--- a/src/core/config/mac_osx.pri
++++ b/src/core/config/mac_osx.pri
+@@ -5,8 +5,6 @@ load(functions)
+ # otherwise query for it.
+ QMAKE_MAC_SDK_VERSION = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.SDKVersion)
+ isEmpty(QMAKE_MAC_SDK_VERSION) {
+-     QMAKE_MAC_SDK_VERSION = $$system("/usr/bin/xcodebuild -sdk $${QMAKE_MAC_SDK} -version SDKVersion 2>/dev/null")
+-     isEmpty(QMAKE_MAC_SDK_VERSION): error("Could not resolve SDK version for \'$${QMAKE_MAC_SDK}\'")
+ }
+
+ QMAKE_CLANG_DIR = "/usr"
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit-darwin-no-qos-classes.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit-darwin-no-qos-classes.patch
new file mode 100644
index 000000000000..a7087f517623
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit-darwin-no-qos-classes.patch
@@ -0,0 +1,11 @@
+diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake
+--- a/Source/cmake/OptionsQt.cmake
++++ b/Source/cmake/OptionsQt.cmake
+@@ -683,7 +683,6 @@ if (WIN32 AND COMPILER_IS_GCC_OR_CLANG)
+ endif ()
+ 
+ if (APPLE)
+-    SET_AND_EXPOSE_TO_BUILD(HAVE_QOS_CLASSES 1)
+ endif ()
+ 
+ if (ENABLE_MATHML)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit-darwin-no-readline.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit-darwin-no-readline.patch
new file mode 100644
index 000000000000..26d189d86019
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit-darwin-no-readline.patch
@@ -0,0 +1,45 @@
+diff --git a/Source/JavaScriptCore/shell/CMakeLists.txt b/Source/JavaScriptCore/shell/CMakeLists.txt
+--- a/Source/JavaScriptCore/shell/CMakeLists.txt
++++ b/Source/JavaScriptCore/shell/CMakeLists.txt
+@@ -9,7 +9,6 @@ set(JSC_LIBRARIES
+ )
+ 
+ if (WTF_OS_MAC_OS_X)
+-    list(APPEND JSC_LIBRARIES edit)
+ endif ()
+ 
+ if ("${JavaScriptCore_LIBRARY_TYPE}" MATCHES "STATIC")
+diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
+--- a/Source/WTF/wtf/Platform.h
++++ b/Source/WTF/wtf/Platform.h
+@@ -563,7 +563,6 @@
+ #if PLATFORM(IOS)
+ 
+ #define HAVE_NETWORK_EXTENSION 1
+-#define HAVE_READLINE 1
+ #if USE(APPLE_INTERNAL_SDK)
+ #define USE_CFNETWORK 1
+ #endif
+@@ -650,7 +649,6 @@
+ #define HAVE_MADV_DONTNEED 1
+ #define HAVE_MERGESORT 1
+ #define HAVE_PTHREAD_SETNAME_NP 1
+-#define HAVE_READLINE 1
+ #define HAVE_SYS_TIMEB_H 1
+ 
+ #if !PLATFORM(GTK) && !PLATFORM(QT)
+diff --git a/Source/WTF/wtf/PlatformMac.cmake b/Source/WTF/wtf/PlatformMac.cmake
+--- a/Source/WTF/wtf/PlatformMac.cmake
++++ b/Source/WTF/wtf/PlatformMac.cmake
+@@ -2,11 +2,9 @@ set(WTF_LIBRARY_TYPE SHARED)
+ 
+ find_library(COCOA_LIBRARY Cocoa)
+ find_library(COREFOUNDATION_LIBRARY CoreFoundation)
+-find_library(READLINE_LIBRARY Readline)
+ list(APPEND WTF_LIBRARIES
+     ${COREFOUNDATION_LIBRARY}
+     ${COCOA_LIBRARY}
+-    ${READLINE_LIBRARY}
+     libicucore.dylib
+ )
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit.patch
new file mode 100644
index 000000000000..b94a4b76cbab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/qtwebkit.patch
@@ -0,0 +1,12 @@
+diff --git a/Source/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake
+--- a/Source/WebKit2/PlatformQt.cmake
++++ b/Source/WebKit2/PlatformQt.cmake
+@@ -261,6 +261,7 @@
+ list(APPEND WebKit2_SYSTEM_INCLUDE_DIRECTORIES
+     ${GLIB_INCLUDE_DIRS}
+     ${GSTREAMER_INCLUDE_DIRS}
++    ${GSTREAMER_PBUTILS_INCLUDE_DIRS}
+     ${Qt5Quick_INCLUDE_DIRS}
+     ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
+     ${SQLITE_INCLUDE_DIR}
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/srcs.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.14/srcs.nix
new file mode 100644
index 000000000000..6ac958442f49
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/srcs.nix
@@ -0,0 +1,342 @@
+# DO NOT EDIT! This file is generated automatically.
+# Command: ./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/5.14
+{ fetchurl, mirror }:
+
+{
+  qt3d = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qt3d-everywhere-src-5.14.2.tar.xz";
+      sha256 = "9da82f1cc4b7d416d31ec96224c59d221473a48f6e579eef978f7d2e3932c674";
+      name = "qt3d-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtactiveqt = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtactiveqt-everywhere-src-5.14.2.tar.xz";
+      sha256 = "b53517d5d128719773a2941ba52da10acd7aa3149948862bc08c98f5b64152a9";
+      name = "qtactiveqt-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtandroidextras = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtandroidextras-everywhere-src-5.14.2.tar.xz";
+      sha256 = "4a8fd92b5c49a663cf0bd492804eaf1574d11137e2cbdd41d6bf5fad0c3c4d76";
+      name = "qtandroidextras-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtbase = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtbase-everywhere-src-5.14.2.tar.xz";
+      sha256 = "48b9e79220941665a9dd827548c6428f7aa3052ccba8f4f7e039a94aa1d2b28a";
+      name = "qtbase-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtcharts = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtcharts-everywhere-src-5.14.2.tar.xz";
+      sha256 = "adb25203ea748d886cc3d8993c20def702115eccea311594592058134ba83bb7";
+      name = "qtcharts-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtconnectivity = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtconnectivity-everywhere-src-5.14.2.tar.xz";
+      sha256 = "abe67b3e3a775e2a2e27c62a5391f37007ffbe72bce58b96116995616cfcbc28";
+      name = "qtconnectivity-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtdatavis3d = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtdatavis3d-everywhere-src-5.14.2.tar.xz";
+      sha256 = "723c03db2d2805b1be4ca534ac7bc867a1a21894d33a7e9261a382f3fa9d0e20";
+      name = "qtdatavis3d-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtdeclarative = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtdeclarative-everywhere-src-5.14.2.tar.xz";
+      sha256 = "a3c4617adc9760347c93d2eb6c25d22f620cd22f44afa0494eb499a805831650";
+      name = "qtdeclarative-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtdoc = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtdoc-everywhere-src-5.14.2.tar.xz";
+      sha256 = "5a55cdb55af35eb222d06179567851c175f24a3732f7dee5be073df4a893172b";
+      name = "qtdoc-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtgamepad = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtgamepad-everywhere-src-5.14.2.tar.xz";
+      sha256 = "f77daadb4755cf760e11812264259fb103396fd1b06df1e06b5df162081c8d03";
+      name = "qtgamepad-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtgraphicaleffects = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtgraphicaleffects-everywhere-src-5.14.2.tar.xz";
+      sha256 = "487a7f858244a08264363733055a8cf8b00e77c658c5608cc462817d15e4b50f";
+      name = "qtgraphicaleffects-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtimageformats = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtimageformats-everywhere-src-5.14.2.tar.xz";
+      sha256 = "733eca0165c15e046b106039c989dac7f6bc2ecf215396d965ed065369264f8c";
+      name = "qtimageformats-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtlocation = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtlocation-everywhere-src-5.14.2.tar.xz";
+      sha256 = "c37708bc396f6dac397b49a6a268d5edb39e1c8296ca2337ce9e80bde04775cc";
+      name = "qtlocation-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtlottie = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtlottie-everywhere-src-5.14.2.tar.xz";
+      sha256 = "55d1392dc92cbec11263084360075dc5fc3fdc25c1969adfbdec84299b285978";
+      name = "qtlottie-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtmacextras = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtmacextras-everywhere-src-5.14.2.tar.xz";
+      sha256 = "d12587b46c84a7822194fc3ccf46f7c18ff3b31566d3dde4f5fe772f1d8776e5";
+      name = "qtmacextras-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtmultimedia = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtmultimedia-everywhere-src-5.14.2.tar.xz";
+      sha256 = "7acd8ede6835314206e407b35b668f0add67544577fb51fe67afb03137fb9fe9";
+      name = "qtmultimedia-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtnetworkauth = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtnetworkauth-everywhere-src-5.14.2.tar.xz";
+      sha256 = "4f00513dd18598487d02187b80b54c669662cf8a8f2573858c7f9282d7b9265e";
+      name = "qtnetworkauth-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtpurchasing = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtpurchasing-everywhere-src-5.14.2.tar.xz";
+      sha256 = "69b087001e8fcec5bb49ca333d5f44e6b7eb09f76421dc792fc9cd76dee9e851";
+      name = "qtpurchasing-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtquick3d = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtquick3d-everywhere-src-5.14.2.tar.xz";
+      sha256 = "0640696d501f2b0bf57f64e98f30bfa3e1cc19c11c0e05e43d4fdb0d20488b2e";
+      name = "qtquick3d-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtquickcontrols = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtquickcontrols-everywhere-src-5.14.2.tar.xz";
+      sha256 = "d55def1dd4ee1250bd6a4e76849f4e362368b6411c2216d5f669c761216d4461";
+      name = "qtquickcontrols-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtquickcontrols2 = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtquickcontrols2-everywhere-src-5.14.2.tar.xz";
+      sha256 = "faf7d349d8f4a8db36cd3c62a5724bcf689300f2fdb7dc1ea034392aab981560";
+      name = "qtquickcontrols2-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtquicktimeline = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtquicktimeline-everywhere-src-5.14.2.tar.xz";
+      sha256 = "83a45d0998cbc77f8094854a477ab1ac0838ae7fd822563d995df40149893a9e";
+      name = "qtquicktimeline-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtremoteobjects = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtremoteobjects-everywhere-src-5.14.2.tar.xz";
+      sha256 = "a6a601c4f4aab6fe41a462dae57033819f697e3317240a382cee45c08be614d6";
+      name = "qtremoteobjects-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtscript = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtscript-everywhere-src-5.14.2.tar.xz";
+      sha256 = "e9fd487ccb3cbf00e86b0b803aa79e9f6bbe7a337b8e97d069e040c3e0789bfe";
+      name = "qtscript-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtscxml = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtscxml-everywhere-src-5.14.2.tar.xz";
+      sha256 = "030cea352a56074f577200f967ef37c959b2767127de61f766f59b0d99763790";
+      name = "qtscxml-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtsensors = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtsensors-everywhere-src-5.14.2.tar.xz";
+      sha256 = "bccfca6910b0383d8f65823496ff5011abed2fa8fd446b4b27333d0fd7bb8c61";
+      name = "qtsensors-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtserialbus = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtserialbus-everywhere-src-5.14.2.tar.xz";
+      sha256 = "0b7762175a649a40c4dd619c5de61d772235dc86099343278e2c3229d0836a91";
+      name = "qtserialbus-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtserialport = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtserialport-everywhere-src-5.14.2.tar.xz";
+      sha256 = "a6d977dd723ad4d3368b5163691405b8852f809974a96ec54103494e834aea21";
+      name = "qtserialport-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtspeech = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtspeech-everywhere-src-5.14.2.tar.xz";
+      sha256 = "5e9e8ea62f0207ba894df1e136df0af9fc5443c7817d28c39f0ea2bbae9ec6da";
+      name = "qtspeech-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtsvg = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtsvg-everywhere-src-5.14.2.tar.xz";
+      sha256 = "c7d7faa01a3e7a6e4d38fafcec5529a488258218749779e6fa0e09a21173b5a1";
+      name = "qtsvg-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qttools = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qttools-everywhere-src-5.14.2.tar.xz";
+      sha256 = "5bb0cf7832b88eb6bc9d4289f98307eb14b16a453ad6cf42cca13c4fe1a053c5";
+      name = "qttools-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qttranslations = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qttranslations-everywhere-src-5.14.2.tar.xz";
+      sha256 = "2088ebee9f5dd0336c9fd11436899a95b7ce0141ce072290de1e8f315d82d1a6";
+      name = "qttranslations-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtvirtualkeyboard = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtvirtualkeyboard-everywhere-src-5.14.2.tar.xz";
+      sha256 = "364f3338563e617e7c964a37170b415b546c5f82965e781271f9dada3e3868d7";
+      name = "qtvirtualkeyboard-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtwayland = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtwayland-everywhere-src-5.14.2.tar.xz";
+      sha256 = "d31633ca718fb407cf70870613d45d0ed80aa04c058586ac3036bae1aff7832a";
+      name = "qtwayland-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtwebchannel = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtwebchannel-everywhere-src-5.14.2.tar.xz";
+      sha256 = "7d1dc8441523638c3d455c7d408ec65aebc073acab80e24063865f929231f874";
+      name = "qtwebchannel-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtwebengine = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtwebengine-everywhere-src-5.14.2.tar.xz";
+      sha256 = "e169d6a75d8c397e04f843bc1b9585950fb9a001255cd18d6293f66fa8a6c947";
+      name = "qtwebengine-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtwebglplugin = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtwebglplugin-everywhere-src-5.14.2.tar.xz";
+      sha256 = "eb4118910b65d03d8448658ac1646e860d337e59b82d6575beda21824e313417";
+      name = "qtwebglplugin-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtwebsockets = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtwebsockets-everywhere-src-5.14.2.tar.xz";
+      sha256 = "f06e62b18313fe1b40a35566e79645de4a8e7ac9f7717d1d98a06c5b49afca84";
+      name = "qtwebsockets-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtwebview = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtwebview-everywhere-src-5.14.2.tar.xz";
+      sha256 = "c61f9213ee84fd7408898c0194468208ffb51af9d257e87e6b53daf24f65ff4b";
+      name = "qtwebview-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtwinextras = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtwinextras-everywhere-src-5.14.2.tar.xz";
+      sha256 = "980f1bc31b37c8597c0bac55f69ecf00d1677218ce82f7bc3933236cb6d907f2";
+      name = "qtwinextras-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtx11extras = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtx11extras-everywhere-src-5.14.2.tar.xz";
+      sha256 = "be9a84a03a2ee81771215264e5dff7a996d04be6192b8cdaa1d41e319a81545a";
+      name = "qtx11extras-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+  qtxmlpatterns = {
+    version = "5.14.2";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.14/5.14.2/submodules/qtxmlpatterns-everywhere-src-5.14.2.tar.xz";
+      sha256 = "219a876665345e3801baff71f31f30f5495c1cb9ab23fbbd27602632c80fcfb7";
+      name = "qtxmlpatterns-everywhere-src-5.14.2.tar.xz";
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/default.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.15/default.nix
new file mode 100644
index 000000000000..1a90c610a5b5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/default.nix
@@ -0,0 +1,176 @@
+/*
+
+# Updates
+
+Before a major version update, make a copy of this directory. (We like to
+keep the old version around for a short time after major updates.) Add a
+top-level attribute to `top-level/all-packages.nix`.
+
+1. Update the URL in `pkgs/development/libraries/qt-5/$VERSION/fetch.sh`.
+2. From the top of the Nixpkgs tree, run
+   `./maintainers/scripts/fetch-kde-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
+3. Check that the new packages build correctly.
+4. Commit the changes and open a pull request.
+
+*/
+
+{
+  newScope,
+  stdenv, fetchurl, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper,
+  bison, cups ? null, harfbuzz, libGL, perl,
+  gstreamer, gst-plugins-base, gtk3, dconf,
+  llvmPackages_5,
+
+  # options
+  developerBuild ? false,
+  decryptSslTraffic ? false,
+  debug ? false,
+}:
+
+with stdenv.lib;
+
+let
+
+  qtCompatVersion = srcs.qtbase.version;
+
+  stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
+
+  mirror = "https://download.qt.io";
+  srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
+    # qtwebkit does not have an official release tarball on the qt mirror and is
+    # mostly maintained by the community.
+    qtwebkit = rec {
+      src = fetchFromGitHub {
+        owner = "qt";
+        repo = "qtwebkit";
+        rev = "v${version}";
+        sha256 = "0x8rng96h19xirn7qkz3lydal6v4vn00bcl0s3brz36dfs0z8wpg";
+      };
+      version = "5.212.0-alpha4";
+    };
+  };
+
+  patches = {
+    qtbase =
+      optionals stdenv.isDarwin [
+        ./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
+        ./qtbase.patch.d/0002-qtbase-mac.patch
+      ]
+      ++ [
+        ./qtbase.patch.d/0003-qtbase-mkspecs.patch
+        ./qtbase.patch.d/0004-qtbase-replace-libdir.patch
+        ./qtbase.patch.d/0005-qtbase-cmake.patch
+        ./qtbase.patch.d/0006-qtbase-gtk3.patch
+        ./qtbase.patch.d/0007-qtbase-xcursor.patch
+        ./qtbase.patch.d/0008-qtbase-tzdir.patch
+        ./qtbase.patch.d/0009-qtbase-qtpluginpath.patch
+        ./qtbase.patch.d/0010-qtbase-assert.patch
+        ./qtbase.patch.d/0011-fix-header_module.patch
+      ];
+    qtdeclarative = [ ./qtdeclarative.patch ];
+    qtscript = [ ./qtscript.patch ];
+    qtserialport = [ ./qtserialport.patch ];
+    qtwebengine = [ ]
+      ++ optional stdenv.isDarwin ./qtwebengine-darwin-no-platform-check.patch;
+    qtwebkit = [ ./qtwebkit.patch ]
+      ++ optionals stdenv.isDarwin [
+        ./qtwebkit-darwin-no-readline.patch
+        ./qtwebkit-darwin-no-qos-classes.patch
+      ];
+    qttools = [ ./qttools.patch ];
+  };
+
+  qtModule =
+    import ../qtModule.nix
+    {
+      inherit perl;
+      inherit (stdenv) lib;
+      # Use a variant of mkDerivation that does not include wrapQtApplications
+      # to avoid cyclic dependencies between Qt modules.
+      mkDerivation =
+        import ../mkDerivation.nix
+        { inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
+        stdenvActual.mkDerivation;
+    }
+    { inherit self srcs patches; };
+
+  addPackages = self: with self;
+    let
+      callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
+    in {
+
+      mkDerivationWith =
+        import ../mkDerivation.nix
+        { inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
+
+      mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
+
+      qtbase = callPackage ../modules/qtbase.nix {
+        inherit (srcs.qtbase) src version;
+        patches = patches.qtbase;
+        inherit bison cups harfbuzz libGL;
+        withGtk3 = true; inherit dconf gtk3;
+        inherit developerBuild decryptSslTraffic;
+      };
+
+      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;
+      };
+      qtnetworkauth = callPackage ../modules/qtnetworkauth.nix {};
+      qtquick1 = null;
+      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 {};
+      qtspeech = callPackage ../modules/qtspeech.nix {};
+      qtsvg = callPackage ../modules/qtsvg.nix {};
+      qtscxml = callPackage ../modules/qtscxml.nix {};
+      qttools = callPackage ../modules/qttools.nix {};
+      qttranslations = callPackage ../modules/qttranslations.nix {};
+      qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix {};
+      qtwayland = callPackage ../modules/qtwayland.nix {};
+      qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
+      qtwebengine = callPackage ../modules/qtwebengine.nix {};
+      qtwebglplugin = callPackage ../modules/qtwebglplugin.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
+      qtwebview = callPackage ../modules/qtwebview.nix {};
+      qtx11extras = callPackage ../modules/qtx11extras.nix {};
+      qtxmlpatterns = callPackage ../modules/qtxmlpatterns.nix {};
+
+      env = callPackage ../qt-env.nix {};
+      full = env "qt-full-${qtbase.version}" ([
+        qtcharts qtconnectivity qtdeclarative qtdoc qtgraphicaleffects
+        qtimageformats qtlocation qtmultimedia qtquickcontrols qtquickcontrols2
+        qtscript qtsensors qtserialport qtsvg qttools qttranslations
+        qtvirtualkeyboard qtwebchannel qtwebengine qtwebkit qtwebsockets
+        qtwebview qtx11extras qtxmlpatterns
+      ] ++ optional (!stdenv.isDarwin) qtwayland
+        ++ optional (stdenv.isDarwin) qtmacextras);
+
+      qmake = makeSetupHook {
+        deps = [ self.qtbase.dev ];
+        substitutions = {
+          fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh;
+        };
+      } ../hooks/qmake-hook.sh;
+
+      wrapQtAppsHook = makeSetupHook {
+        deps =
+          [ self.qtbase.dev makeWrapper ]
+          ++ optional stdenv.isLinux self.qtwayland.dev;
+      } ../hooks/wrap-qt-apps-hook.sh;
+    };
+
+   self = makeScope newScope addPackages;
+
+in self
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/fetch.sh b/nixpkgs/pkgs/development/libraries/qt-5/5.15/fetch.sh
new file mode 100644
index 000000000000..97829a133ca5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/fetch.sh
@@ -0,0 +1 @@
+WGET_ARGS=( http://download.qt.io/official_releases/qt/5.15/5.15.0/submodules/ )
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
new file mode 100644
index 000000000000..ba4c54b228c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
@@ -0,0 +1,411 @@
+From 5ec1d1009d9943f20e82ffc087deabb31d447e75 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
+Date: Fri, 3 Apr 2020 21:07:58 +0200
+Subject: [PATCH 01/11] qtbase-mkspecs-mac
+
+---
+ mkspecs/common/mac.conf               |   2 +-
+ mkspecs/features/mac/default_post.prf | 206 --------------------------
+ mkspecs/features/mac/default_pre.prf  |  58 --------
+ mkspecs/features/mac/sdk.mk           |  25 ----
+ mkspecs/features/mac/sdk.prf          |  61 --------
+ 5 files changed, 1 insertion(+), 351 deletions(-)
+ delete mode 100644 mkspecs/features/mac/sdk.mk
+ delete mode 100644 mkspecs/features/mac/sdk.prf
+
+diff --git a/mkspecs/common/mac.conf b/mkspecs/common/mac.conf
+index 61bea952b2..9909dae726 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/mac/default_post.prf b/mkspecs/features/mac/default_post.prf
+index 92a9112bca..b80ec1e801 100644
+--- a/mkspecs/features/mac/default_post.prf
++++ b/mkspecs/features/mac/default_post.prf
+@@ -68,212 +68,6 @@ 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 {
+-    uikit: QMAKE_RPATHDIR += @executable_path/Frameworks
+-    else: 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 {
+-    qmake_pkginfo_typeinfo.name = QMAKE_PKGINFO_TYPEINFO
+-    !isEmpty(QMAKE_PKGINFO_TYPEINFO): \
+-        qmake_pkginfo_typeinfo.value = $$QMAKE_PKGINFO_TYPEINFO
+-    else: \
+-        qmake_pkginfo_typeinfo.value = "????"
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_pkginfo_typeinfo
+-
+-    bundle_version = $$VERSION
+-    isEmpty(bundle_version): bundle_version = 1.0.0
+-
+-    l = $$split(bundle_version, '.') 0 0  # make sure there are at least three
+-    VER_MAJ = $$member(l, 0, 0)
+-    VER_MIN = $$member(l, 1, 1)
+-    VER_PAT = $$member(l, 2, 2)
+-    unset(l)
+-
+-    qmake_full_version.name = QMAKE_FULL_VERSION
+-    qmake_full_version.value = $${VER_MAJ}.$${VER_MIN}.$${VER_PAT}
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_full_version
+-
+-    qmake_short_version.name = QMAKE_SHORT_VERSION
+-    qmake_short_version.value = $${VER_MAJ}.$${VER_MIN}
+-    QMAKE_MAC_XCODE_SETTINGS += qmake_short_version
+-
+-    !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} \
+-                -isysroot$$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
+-            sysroot_path  = $$xcodeSDKInfo(Path, $$simulator.sdk)
+-        } else {
+-            version_identifier = $$device.deployment_identifier
+-            sysroot_path  = $$xcodeSDKInfo(Path, $$device.sdk)
+-        }
+-        version_min_flag = -m$${version_identifier}-version-min=$$deployment_target
+-        QMAKE_CFLAGS += -isysroot $$sysroot_path $$version_min_flag
+-        QMAKE_CXXFLAGS += -isysroot $$sysroot_path $$version_min_flag
+-        QMAKE_LFLAGS += -isysroot $$sysroot_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}
+-}
+-
+-!equals(sdk_version, $$QMAKE_MAC_SDK_VERSION) {
+-    # Explicit SDK version has been set, respect that
+-    QMAKE_LFLAGS += -Wl,-sdk_version -Wl,$$sdk_version
+-}
+-
+-cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
+-!isEmpty(QMAKE_XCODE_VERSION): \
+-    cache(QMAKE_XCODE_VERSION, stash)
+-
+-QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
+-
+-xcode_product_bundle_identifier_setting.name = PRODUCT_BUNDLE_IDENTIFIER
+-xcode_product_bundle_identifier_setting.value = $$QMAKE_TARGET_BUNDLE_PREFIX
+-isEmpty(xcode_product_bundle_identifier_setting.value): \
+-    xcode_product_bundle_identifier_setting.value = "com.yourcompany"
+-xcode_product_bundle_target = $$QMAKE_BUNDLE
+-isEmpty(xcode_product_bundle_target): \
+-    xcode_product_bundle_target = ${PRODUCT_NAME:rfc1034identifier}
+-xcode_product_bundle_identifier_setting.value = "$${xcode_product_bundle_identifier_setting.value}.$${xcode_product_bundle_target}"
+-QMAKE_MAC_XCODE_SETTINGS += xcode_product_bundle_identifier_setting
+-
+ !macx-xcode {
+     generate_xcode_project.commands = @$(QMAKE) -spec macx-xcode \"$(EXPORT__PRO_FILE_)\" $$QMAKE_ARGS
+     generate_xcode_project.target = xcodeproj
+diff --git a/mkspecs/features/mac/default_pre.prf b/mkspecs/features/mac/default_pre.prf
+index e3534561a5..3b01424e67 100644
+--- a/mkspecs/features/mac/default_pre.prf
++++ b/mkspecs/features/mac/default_pre.prf
+@@ -1,60 +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
+-
+-xcode_copy_phase_strip_setting.name = COPY_PHASE_STRIP
+-xcode_copy_phase_strip_setting.value = NO
+-QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
+diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk
+deleted file mode 100644
+index c40f58c987..0000000000
+--- a/mkspecs/features/mac/sdk.mk
++++ /dev/null
+@@ -1,25 +0,0 @@
+-
+-ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),)
+-    CHECK_SDK_COMMAND = /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version 2>&1
+-    CURRENT_MAC_SDK_VERSION := $(shell DEVELOPER_DIR=$(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) $(CHECK_SDK_COMMAND))
+-    ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION))
+-        # We don't want to complain about out of date SDK unless the target needs to be remade.
+-        # This covers use-cases such as running 'make check' after moving the build to a
+-        # computer without Xcode or with a different Xcode version.
+-        TARGET_UP_TO_DATE := $(shell QT_MAC_SDK_NO_VERSION_CHECK=1 $(MAKE) --question $(QMAKE_TARGET) && echo 1 || echo 0)
+-        ifeq ($(TARGET_UP_TO_DATE),0)
+-            ifneq ($(findstring missing DEVELOPER_DIR path,$(CURRENT_MAC_SDK_VERSION)),)
+-                $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) is no longer valid.)
+-            else ifneq ($(findstring SDK "$(EXPORT_QMAKE_MAC_SDK)" cannot be located,$(CURRENT_MAC_SDK_VERSION)),)
+-                $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) no longer contains the $(EXPORT_QMAKE_MAC_SDK_VERSION) platform SDK.)
+-            else ifneq ($(CURRENT_MAC_SDK_VERSION),)
+-                $(info The platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).)
+-            else
+-                $(info Unknown error resolving current platform SDK version.)
+-            endif
+-            $(info This requires a fresh build. Please wipe the build directory completely,)
+-            $(info including any .qmake.stash and .qmake.cache files generated by qmake.)
+-            $(error ^)
+-        endif
+-    endif
+-endif
+diff --git a/mkspecs/features/mac/sdk.prf b/mkspecs/features/mac/sdk.prf
+deleted file mode 100644
+index 3a9c2778bb..0000000000
+--- a/mkspecs/features/mac/sdk.prf
++++ /dev/null
+@@ -1,61 +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"): \
+-        infoarg = --show-sdk-path
+-    equals(info, "PlatformPath"): \
+-        infoarg = --show-sdk-platform-path
+-    equals(info, "SDKVersion"): \
+-        infoarg = --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 $$infoarg 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(infoarg, "--show-sdk-platform-path")): \
+-            error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg")
+-        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)
+-
+-isEmpty(QMAKE_EXPORT_INCDIR_OPENGL) {
+-    QMAKE_EXPORT_INCDIR_OPENGL = $$QMAKE_INCDIR_OPENGL
+-    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 QMAKE_LINK_C QMAKE_LINK_C_SHLIB)) {
+-    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)
+-}
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0002-qtbase-mac.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0002-qtbase-mac.patch
new file mode 100644
index 000000000000..4271b64679d7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0002-qtbase-mac.patch
@@ -0,0 +1,118 @@
+From a9ba67d3db7390d9ddc46751346e70b0a522711a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
+Date: Fri, 3 Apr 2020 21:15:27 +0200
+Subject: [PATCH 02/11] qtbase-mac
+
+---
+ src/corelib/kernel/qcore_mac_p.h | 16 ++++++++++++++--
+ src/testlib/qappletestlogger.cpp |  2 +-
+ src/testlib/qappletestlogger_p.h |  2 +-
+ src/testlib/qtestcase.cpp        |  2 +-
+ src/testlib/qtestlog.cpp         |  2 +-
+ src/testlib/qtestlog_p.h         |  4 ++--
+ 6 files changed, 20 insertions(+), 8 deletions(-)
+
+diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
+index 535d3579b2..3d70bf39c1 100644
+--- a/src/corelib/kernel/qcore_mac_p.h
++++ b/src/corelib/kernel/qcore_mac_p.h
+@@ -225,7 +225,7 @@ private:
+ 
+ // --------------------------------------------------------------------------
+ 
+-#if !defined(QT_BOOTSTRAPPED)
++#if 0
+ 
+ QT_END_NAMESPACE
+ #include <os/activity.h>
+@@ -303,7 +303,19 @@ QT_MAC_WEAK_IMPORT(_os_activity_current);
+ 
+ #define QT_APPLE_SCOPED_LOG_ACTIVITY(...) QAppleLogActivity scopedLogActivity = QT_APPLE_LOG_ACTIVITY(__VA_ARGS__).enter();
+ 
+-#endif // !defined(QT_BOOTSTRAPPED)
++#else // !defined(QT_BOOTSTRAPPED)
++
++#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT3(...)
++#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT2(...)
++#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT(...)
++
++#define QT_APPLE_LOG_ACTIVITY2(...)
++#define QT_APPLE_LOG_ACTIVITY1(...)
++#define QT_APPLE_LOG_ACTIVITY(...)
++
++#define QT_APPLE_SCOPED_LOG_ACTIVITY(...)
++
++#endif
+ 
+ // -------------------------------------------------------------------------
+ 
+diff --git a/src/testlib/qappletestlogger.cpp b/src/testlib/qappletestlogger.cpp
+index dfeadebdef..2a74330c1d 100644
+--- a/src/testlib/qappletestlogger.cpp
++++ b/src/testlib/qappletestlogger.cpp
+@@ -43,7 +43,7 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+ 
+ using namespace QTestPrivate;
+ 
+diff --git a/src/testlib/qappletestlogger_p.h b/src/testlib/qappletestlogger_p.h
+index 62c6d95c5a..f8e0a3b767 100644
+--- a/src/testlib/qappletestlogger_p.h
++++ b/src/testlib/qappletestlogger_p.h
+@@ -57,7 +57,7 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+ class QAppleTestLogger : public QAbstractTestLogger
+ {
+ public:
+diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
+index f45999c7fa..d5b525dc12 100644
+--- a/src/testlib/qtestcase.cpp
++++ b/src/testlib/qtestcase.cpp
+@@ -849,7 +849,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
+ 
+     bool addFallbackLogger = !explicitLoggerRequested;
+ 
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+     // Any explicitly requested loggers will be added by now, so we can check if they use stdout
+     const bool safeToAddAppleLogger = !AppleUnifiedLogger::willMirrorToStderr() || !QTestLog::loggerUsingStdout();
+     if (safeToAddAppleLogger && QAppleTestLogger::debugLoggingEnabled()) {
+diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
+index a388780532..63ab965101 100644
+--- a/src/testlib/qtestlog.cpp
++++ b/src/testlib/qtestlog.cpp
+@@ -465,7 +465,7 @@ void QTestLog::addLogger(LogMode mode, const char *filename)
+     case QTestLog::TAP:
+         logger = new QTapTestLogger(filename);
+         break;
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+     case QTestLog::Apple:
+         logger = new QAppleTestLogger;
+         break;
+diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
+index ddaf14ed9b..0c49c93a88 100644
+--- a/src/testlib/qtestlog_p.h
++++ b/src/testlib/qtestlog_p.h
+@@ -74,8 +74,8 @@ public:
+     Q_DISABLE_COPY_MOVE(QTestLog)
+ 
+     enum LogMode {
+-        Plain = 0, XML, LightXML, JUnitXML, CSV, TeamCity, TAP
+-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
++        Plain = 0, XML, LightXML, XunitXML, CSV, TeamCity, TAP
++#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
+         , Apple
+ #endif
+ #if defined(HAVE_XCTEST)
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0003-qtbase-mkspecs.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0003-qtbase-mkspecs.patch
new file mode 100644
index 000000000000..9f8ef67ab5d9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0003-qtbase-mkspecs.patch
@@ -0,0 +1,464 @@
+From 82771c437957b3684ce296997d795432756aa8b1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
+Date: Sat, 4 Apr 2020 00:25:52 +0200
+Subject: [PATCH 03/11] qtbase-mkspecs
+
+---
+ mkspecs/features/create_cmake.prf             | 51 +++---------
+ .../data/cmake/Qt5BasicConfig.cmake.in        | 80 +------------------
+ mkspecs/features/qml_module.prf               |  2 +-
+ mkspecs/features/qml_plugin.prf               |  2 +-
+ mkspecs/features/qt_app.prf                   |  2 +-
+ mkspecs/features/qt_build_paths.prf           |  4 +-
+ mkspecs/features/qt_docs.prf                  | 10 +--
+ mkspecs/features/qt_example_installs.prf      |  2 +-
+ mkspecs/features/qt_functions.prf             |  2 +-
+ mkspecs/features/qt_installs.prf              | 22 ++---
+ mkspecs/features/qt_plugin.prf                |  2 +-
+ 11 files changed, 38 insertions(+), 141 deletions(-)
+
+diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
+index 24ed125f12..f0666a1986 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
+@@ -77,45 +77,20 @@ 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
+ 
+-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_BIN_DIR = $$NIX_OUTPUT_BIN/bin/
++CMAKE_BIN_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_LIB_DIR = $$NIX_OUTPUT_OUT/lib/
++CMAKE_LIB_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_OUT/lib/
++CMAKE_DLL_DIR_IS_ABSOLUTE = True
+ 
+ static|staticlib:CMAKE_STATIC_TYPE = true
+ 
+@@ -258,7 +233,7 @@ contains(CONFIG, plugin) {
+ 
+     cmake_qt5_plugin_file.files = $$cmake_target_file.output
+     static|staticlib: cmake_qt5_plugin_file.files += $$cmake_qt5_plugin_import_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()
+@@ -400,7 +375,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 309798a767..b6c3ab8609 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -2,30 +2,6 @@ if (CMAKE_VERSION VERSION_LESS 3.1.0)
+     message(FATAL_ERROR \"Qt 5 $${CMAKE_MODULE_NAME} module requires at least CMake version 3.1.0\")
+ 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)")
+@@ -145,11 +121,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
+       IsDebugAndRelease)
+     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(_deps
+         ${_Qt5$${CMAKE_MODULE_NAME}_LIB_DEPENDENCIES}
+@@ -209,11 +181,7 @@ macro(_populate_$${CMAKE_MODULE_NAME}_target_properties Configuration LIB_LOCATI
+ !!ENDIF
+ 
+ !!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
+@@ -229,24 +197,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}$${CMAKE_QT_STEM}.framework\"
+-      \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework/Headers\"
++      \"$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework\"
++      \"$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.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}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, ., 0, 0)/Headers/$$VERSION/\"
+-        \"${_qt5$${CMAKE_MODULE_NAME}_install_prefix}/$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.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}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, .,0, 0)/Headers/$$VERSION/\"
++      \"$${CMAKE_LIB_DIR}$${CMAKE_QT_STEM}.framework/Versions/$$section(VERSION, .,0, 0)/Headers/$$VERSION/$${MODULE_INCNAME}\"
+     )
+ !!ELSE
+     set(Qt5$${CMAKE_MODULE_NAME}_PRIVATE_INCLUDE_DIRS \"\")
+@@ -262,7 +219,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
+@@ -499,25 +455,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}\" \"\" $${CMAKE_DEBUG_AND_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_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}\" $${CMAKE_DEBUG_AND_RELEASE})
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -536,25 +480,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}\" \"\" $${CMAKE_DEBUG_AND_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}\" $${CMAKE_DEBUG_AND_RELEASE})
+ !!ENDIF // CMAKE_STATIC_WINDOWS_BUILD
+     endif()
+@@ -581,11 +513,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+           IsDebugAndRelease)
+         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/qml_module.prf b/mkspecs/features/qml_module.prf
+index c0b50416c9..cabe39b22e 100644
+--- a/mkspecs/features/qml_module.prf
++++ b/mkspecs/features/qml_module.prf
+@@ -51,7 +51,7 @@ builtin_resources {
+ # Install rules
+ qmldir.base = $$qmldir_path
+ qmldir.files = $$qmldir_file
+-qmldir.path = $$[QT_INSTALL_QML]/$$TARGETPATH
++qmldir.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ 
+ qmlfiles.base = $$_PRO_FILE_PWD_
+ qmlfiles.files = $$fq_aux_qml_files
+diff --git a/mkspecs/features/qml_plugin.prf b/mkspecs/features/qml_plugin.prf
+index 1b67435787..24a1f78c17 100644
+--- a/mkspecs/features/qml_plugin.prf
++++ b/mkspecs/features/qml_plugin.prf
+@@ -50,7 +50,7 @@ load(qt_build_paths)
+ 
+ DESTDIR = $$MODULE_BASE_OUTDIR/qml/$$TARGETPATH
+ 
+-target.path = $$[QT_INSTALL_QML]/$$TARGETPATH
++target.path = $$NIX_OUTPUT_QML/$$TARGETPATH
+ INSTALLS += target
+ 
+ # Some final setup
+diff --git a/mkspecs/features/qt_app.prf b/mkspecs/features/qt_app.prf
+index 8354f30eea..62028fef8e 100644
+--- a/mkspecs/features/qt_app.prf
++++ b/mkspecs/features/qt_app.prf
+@@ -30,7 +30,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 3bb3823a8e..655b7b7db8 100644
+--- a/mkspecs/features/qt_build_paths.prf
++++ b/mkspecs/features/qt_build_paths.prf
+@@ -24,6 +24,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_docs.prf b/mkspecs/features/qt_docs.prf
+index 095bf15dac..4cc977bea5 100644
+--- a/mkspecs/features/qt_docs.prf
++++ b/mkspecs/features/qt_docs.prf
+@@ -65,7 +65,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) {
+@@ -84,8 +84,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
+@@ -108,12 +108,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 15b373ba40..5c373fe1d5 100644
+--- a/mkspecs/features/qt_example_installs.prf
++++ b/mkspecs/features/qt_example_installs.prf
+@@ -91,7 +91,7 @@ sourcefiles += \
+     $$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 7777e615bd..abeb03a663 100644
+--- a/mkspecs/features/qt_functions.prf
++++ b/mkspecs/features/qt_functions.prf
+@@ -87,7 +87,7 @@ defineTest(qtHaveModule) {
+ defineTest(qtPrepareTool) {
+     cmd = $$eval(QT_TOOL.$${2}.binary)
+     isEmpty(cmd) {
+-        cmd = $$[QT_HOST_BINS]/$$2
++        cmd = $$system("command -v $$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 1ebca17366..a8f958eae8 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,35 +23,35 @@
+ #headers
+ qt_install_headers {
+     gen_headers.files = $$SYNCQT.GENERATED_HEADER_FILES
+-    gen_headers.path = $$[QT_INSTALL_HEADERS]/$$MODULE_INCNAME
++    gen_headers.path = $$NIX_OUTPUT_DEV/include/$$MODULE_INCNAME
+     INSTALLS += gen_headers
+ 
+     targ_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.INJECTED_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
+     generated_privates: \
+         private_headers.CONFIG += no_check_exist
+     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 573d717eea..024c624cb6 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
+ 
+ qt_libinfix_plugins: TARGET = $$TARGET$$QT_LIBINFIX
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0004-qtbase-replace-libdir.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0004-qtbase-replace-libdir.patch
new file mode 100644
index 000000000000..bbfc93897873
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0004-qtbase-replace-libdir.patch
@@ -0,0 +1,68 @@
+From 30d3906ff5e8671e9c97c5336c6c549656c0e293 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
+Date: Sat, 4 Apr 2020 00:27:41 +0200
+Subject: [PATCH 04/11] qtbase-replace-libdir
+
+---
+ mkspecs/features/qt_common.prf | 20 ++------------------
+ mkspecs/features/qt_module.prf |  5 +----
+ 2 files changed, 3 insertions(+), 22 deletions(-)
+
+diff --git a/mkspecs/features/qt_common.prf b/mkspecs/features/qt_common.prf
+index 8df94aa4ee..414029f31c 100644
+--- a/mkspecs/features/qt_common.prf
++++ b/mkspecs/features/qt_common.prf
+@@ -31,32 +31,16 @@ contains(TEMPLATE, .*lib)|contains(TEMPLATE, aux) {
+         rplbase = $$dirname(_QMAKE_SUPER_CACHE_)/[^/][^/]*
+     else: \
+         rplbase = $$MODULE_BASE_OUTDIR
+-    host_build {
+-        qqt_libdir = \$\$\$\$[QT_HOST_LIBS]
+-        qt_libdir = $$[QT_HOST_LIBS]
+-    } else {
+-        qqt_libdir = \$\$\$\$[QT_INSTALL_LIBS]
+-        qt_libdir = $$[QT_INSTALL_LIBS]
+-    }
++    qt_libdir = $$NIX_OUTPUT_OUT/lib
+     contains(QMAKE_DEFAULT_LIBDIRS, $$qt_libdir) {
+-        lib_replace0.match = $$rplbase/lib/
+-        lib_replace0.replace = $$qqt_libdir/
+-        lib_replace0.CONFIG = path
+-        QMAKE_PRL_INSTALL_REPLACE += lib_replace0
+         lib_replace.match = "[^ ']*$$rplbase/lib"
+         lib_replace.replace =
+     } else {
+         lib_replace.match = $$rplbase/lib
+-        lib_replace.replace = $$qqt_libdir
++        lib_replace.replace = $$qt_libdir
+     }
+     lib_replace.CONFIG = path
+     QMAKE_PRL_INSTALL_REPLACE += lib_replace
+-    !equals(qt_libdir, $$rplbase/lib) {
+-        qtlibdir_replace.match = $$qt_libdir
+-        qtlibdir_replace.replace = $$qqt_libdir
+-        qtlibdir_replace.CONFIG = path
+-        QMAKE_PRL_INSTALL_REPLACE += qtlibdir_replace
+-    }
+ }
+ contains(TEMPLATE, .*lib)|darwin {
+     if(!host_build|!cross_compile):qtConfig(reduce_exports): CONFIG += hide_symbols
+diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
+index 828a9621b9..b9e5d35026 100644
+--- a/mkspecs/features/qt_module.prf
++++ b/mkspecs/features/qt_module.prf
+@@ -305,10 +305,7 @@ load(qt_targets)
+ }
+ !lib_bundle:unix {
+     CONFIG += create_libtool
+-    host_build: \
+-        QMAKE_LIBTOOL_LIBDIR = $$[QT_HOST_LIBS]
+-    else: \
+-        QMAKE_LIBTOOL_LIBDIR = "=$$[QT_INSTALL_LIBS/raw]"
++    QMAKE_LIBTOOL_LIBDIR = $$NIX_OUTPUT_OUT/lib
+     !isEmpty(lib_replace0.match) {
+         ltlib_replace0.match = $$lib_replace0.match
+         ltlib_replace0.replace = $$QMAKE_LIBTOOL_LIBDIR/
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0005-qtbase-cmake.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0005-qtbase-cmake.patch
new file mode 100644
index 000000000000..19646df1666f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0005-qtbase-cmake.patch
@@ -0,0 +1,194 @@
+From 7871fbcefc7596a458cec005edafd9d4962baea3 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:34:28 -0500
+Subject: [PATCH 05/11] qtbase-cmake
+
+---
+ mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in  |  2 +-
+ mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in |  4 ++--
+ src/corelib/Qt5CoreConfigExtras.cmake.in             | 10 +++++-----
+ src/corelib/Qt5CoreConfigExtrasMkspecDir.cmake.in    |  2 +-
+ .../Qt5CoreConfigExtrasMkspecDirForInstall.cmake.in  |  2 +-
+ src/dbus/Qt5DBusConfigExtras.cmake.in                | 12 ++----------
+ src/gui/Qt5GuiConfigExtras.cmake.in                  |  6 +++---
+ src/widgets/Qt5WidgetsConfigExtras.cmake.in          |  2 +-
+ 8 files changed, 16 insertions(+), 24 deletions(-)
+
+diff --git a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+index b6c3ab8609..edb6a89316 100644
+--- a/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5BasicConfig.cmake.in
+@@ -513,7 +513,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
+           IsDebugAndRelease)
+         set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+ 
+-        set(imported_location \"$${CMAKE_PLUGIN_DIR}${PLUGIN_LOCATION}\")
++        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}
+diff --git a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+index b550a52c60..dbd3243885 100644
+--- a/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
++++ b/mkspecs/features/data/cmake/Qt5PluginTarget.cmake.in
+@@ -53,10 +53,10 @@ set_property(TARGET Qt5::$$CMAKE_PLUGIN_NAME PROPERTY INTERFACE_SOURCES
+ !!ENDIF
+ 
+ !!IF !isEmpty(CMAKE_RELEASE_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_RELEASE}\" $${CMAKE_DEBUG_AND_RELEASE})
+ !!ENDIF
+ !!IF !isEmpty(CMAKE_DEBUG_TYPE)
+-_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_DIR}$${CMAKE_PLUGIN_LOCATION_DEBUG}\" $${CMAKE_DEBUG_AND_RELEASE})
+ !!ENDIF
+ 
+ list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
+diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in
+index 4c1c3a612b..bb8ab08143 100644
+--- a/src/corelib/Qt5CoreConfigExtras.cmake.in
++++ b/src/corelib/Qt5CoreConfigExtras.cmake.in
+@@ -6,7 +6,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
+@@ -21,7 +21,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
+@@ -38,7 +38,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
+@@ -121,7 +121,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
+@@ -135,7 +135,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/dbus/Qt5DBusConfigExtras.cmake.in b/src/dbus/Qt5DBusConfigExtras.cmake.in
+index a814678f7b..b13b964ec8 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 84dbbfebd4..8ad0720c5c 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_OUT/$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ELSE
+     set(imported_implib \"$${CMAKE_LIB_DIR}${IMPLIB_LOCATION}\")
+ !!ENDIF
+diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+index 83d8004a08..ca0b8e4bfb 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
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0006-qtbase-gtk3.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0006-qtbase-gtk3.patch
new file mode 100644
index 000000000000..48f4c9b3f99e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0006-qtbase-gtk3.patch
@@ -0,0 +1,48 @@
+From 7a9f4f875053aed8ab387161eea623bf8325cfa8 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:35:33 -0500
+Subject: [PATCH 06/11] qtbase-gtk3
+
+---
+ src/plugins/platformthemes/gtk3/main.cpp | 17 ++++++++++++++++-
+ 1 file changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/src/plugins/platformthemes/gtk3/main.cpp b/src/plugins/platformthemes/gtk3/main.cpp
+index 860fc3a26e..8cd4663d49 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 nullptr;
+ }
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0007-qtbase-xcursor.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0007-qtbase-xcursor.patch
new file mode 100644
index 000000000000..617b0684df65
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0007-qtbase-xcursor.patch
@@ -0,0 +1,29 @@
+From 707098eada20ba074e642a73248de74407bc261c Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:35:58 -0500
+Subject: [PATCH 07/11] qtbase-xcursor
+
+---
+ src/plugins/platforms/xcb/qxcbcursor.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp
+index 42c7a52bd4..ba670ddb44 100644
+--- a/src/plugins/platforms/xcb/qxcbcursor.cpp
++++ b/src/plugins/platforms/xcb/qxcbcursor.cpp
+@@ -317,10 +317,10 @@ QXcbCursor::QXcbCursor(QXcbConnection *conn, QXcbScreen *screen)
+ #if QT_CONFIG(xcb_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) {
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0008-qtbase-tzdir.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0008-qtbase-tzdir.patch
new file mode 100644
index 000000000000..319de315bfb7
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0008-qtbase-tzdir.patch
@@ -0,0 +1,64 @@
+From da003b582ee8823b29b1ff5c0aca8e06e7741b94 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:36:25 -0500
+Subject: [PATCH 08/11] qtbase-tzdir
+
+---
+ src/corelib/time/qtimezoneprivate_tz.cpp | 31 +++++++++++++++---------
+ 1 file changed, 19 insertions(+), 12 deletions(-)
+
+diff --git a/src/corelib/time/qtimezoneprivate_tz.cpp b/src/corelib/time/qtimezoneprivate_tz.cpp
+index 01f9a6cce0..910338205a 100644
+--- a/src/corelib/time/qtimezoneprivate_tz.cpp
++++ b/src/corelib/time/qtimezoneprivate_tz.cpp
+@@ -77,7 +77,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");
+ 
+@@ -672,20 +676,23 @@ QTzTimeZoneCacheEntry QTzTimeZoneCache::findEntry(const QByteArray &ianaId)
+         if (!tzif.open(QIODevice::ReadOnly))
+             return ret;
+     } 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));
++            tzif.setFileName(QLatin1String("/usr/share/zoneinfo/") + QString::fromLocal8Bit(ianaId));
+             if (!tzif.open(QIODevice::ReadOnly)) {
+-                // ianaId may be a POSIX rule, taken from $TZ or /etc/TZ
+-                const QByteArray zoneInfo = ianaId.split(',').at(0);
+-                const char *begin = zoneInfo.constBegin();
+-                if (PosixZone::parse(begin, zoneInfo.constEnd()).hasValidOffset()
+-                    && (begin == zoneInfo.constEnd()
+-                        || PosixZone::parse(begin, zoneInfo.constEnd()).hasValidOffset())) {
+-                    ret.m_posixRule = ianaId;
++                tzif.setFileName(QLatin1String("/usr/lib/zoneinfo/") + QString::fromLocal8Bit(ianaId));
++                if (!tzif.open(QIODevice::ReadOnly)) {
++                    // ianaId may be a POSIX rule, taken from $TZ or /etc/TZ
++                    const QByteArray zoneInfo = ianaId.split(',').at(0);
++                    const char *begin = zoneInfo.constBegin();
++                    if (PosixZone::parse(begin, zoneInfo.constEnd()).hasValidOffset()
++                        && (begin == zoneInfo.constEnd()
++                            || PosixZone::parse(begin, zoneInfo.constEnd()).hasValidOffset())) {
++                        ret.m_posixRule = ianaId;
++                    }
++                    return ret;
+                 }
+-                return ret;
+             }
+         }
+     }
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0009-qtbase-qtpluginpath.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0009-qtbase-qtpluginpath.patch
new file mode 100644
index 000000000000..28013ec10482
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0009-qtbase-qtpluginpath.patch
@@ -0,0 +1,33 @@
+From 9fc6efaf774a8716932c98c0b0ea6408ed2614c2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
+Date: Sun, 10 May 2020 12:47:28 +0200
+Subject: [PATCH 09/11] qtbase-qtpluginpath
+
+---
+ src/corelib/kernel/qcoreapplication.cpp | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
+index 5fdcc9b914..1a126ef359 100644
+--- a/src/corelib/kernel/qcoreapplication.cpp
++++ b/src/corelib/kernel/qcoreapplication.cpp
+@@ -2691,6 +2691,16 @@ QStringList QCoreApplication::libraryPathsLocked()
+         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));
++            }
++        }
++
++
+         auto setPathsFromEnv = [&](QString libPathEnv) {
+             if (!libPathEnv.isEmpty()) {
+                 QStringList paths = libPathEnv.split(QDir::listSeparator(), Qt::SkipEmptyParts);
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0010-qtbase-assert.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0010-qtbase-assert.patch
new file mode 100644
index 000000000000..c5b099c4ca35
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0010-qtbase-assert.patch
@@ -0,0 +1,32 @@
+From 015845b3c320d02691f28373097d1e6dbbac79f7 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 17 Sep 2019 05:37:04 -0500
+Subject: [PATCH 10/11] qtbase-assert
+
+---
+ src/testlib/qtestassert.h | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/testlib/qtestassert.h b/src/testlib/qtestassert.h
+index 6498ea84ef..d821ced7fc 100644
+--- a/src/testlib/qtestassert.h
++++ b/src/testlib/qtestassert.h
+@@ -44,10 +44,13 @@
+ 
+ QT_BEGIN_NAMESPACE
+ 
+-
++#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
++#define QTEST_ASSERT(cond) do { } while ((false) && (cond))
++#define QTEST_ASSERT_X(cond, where, what) do { } while ((false) && (cond))
++#else
+ #define QTEST_ASSERT(cond) do { if (!(cond)) qt_assert(#cond,__FILE__,__LINE__); } while (false)
+-
+ #define QTEST_ASSERT_X(cond, where, what) do { if (!(cond)) qt_assert_x(where, what,__FILE__,__LINE__); } while (false)
++#endif
+ 
+ QT_END_NAMESPACE
+ 
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0011-fix-header_module.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0011-fix-header_module.patch
new file mode 100644
index 000000000000..98738656114d
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtbase.patch.d/0011-fix-header_module.patch
@@ -0,0 +1,25 @@
+From 2bce8511877db1db532e1437e7140b1d55633f86 Mon Sep 17 00:00:00 2001
+From: Will Dietz <w@wdtz.org>
+Date: Mon, 30 Sep 2019 20:15:40 -0500
+Subject: [PATCH 11/11] fix header_module
+
+---
+ mkspecs/features/qt_module.prf | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf
+index b9e5d35026..9924271042 100644
+--- a/mkspecs/features/qt_module.prf
++++ b/mkspecs/features/qt_module.prf
+@@ -84,7 +84,7 @@ header_module {
+         CONFIG  += qt_no_install_library
+ 
+     # Allow creation of .prl, .la and .pc files.
+-    target.path = $$[QT_INSTALL_LIBS]
++    target.path = $$NIX_OUTPUT_OUT/lib
+     target.CONFIG += dummy_install
+     INSTALLS    += target
+ } else {
+-- 
+2.25.4
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtdeclarative.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtdeclarative.patch
new file mode 100644
index 000000000000..d9c721e6946c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtdeclarative.patch
@@ -0,0 +1,114 @@
+diff --git a/src/particles/particles.pro b/src/particles/particles.pro
+index aaaa83419a..58aee00036 100644
+--- a/src/particles/particles.pro
++++ b/src/particles/particles.pro
+@@ -20,6 +20,6 @@ QMLTYPES_FILENAME = plugins.qmltypes
+ QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQuick/Particles.2
+ QML_IMPORT_NAME = QtQuick.Particles
+ IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+-CONFIG += qmltypes install_qmltypes install_metatypes
++CONFIG += qmltypes install_qmltypes
+ 
+ load(qt_module)
+diff --git a/src/qml/qml.pro b/src/qml/qml.pro
+index e39a8319b6..90c0331278 100644
+--- a/src/qml/qml.pro
++++ b/src/qml/qml.pro
+@@ -72,6 +72,6 @@ QMLTYPES_FILENAME = plugins.qmltypes
+ QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQml
+ QML_IMPORT_NAME = QtQml
+ IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+-CONFIG += qmltypes install_qmltypes install_metatypes
++CONFIG += qmltypes install_qmltypes
+ 
+ load(qt_module)
+diff --git a/src/qmlmodels/qmlmodels.pro b/src/qmlmodels/qmlmodels.pro
+index 4ac093556d..112e2c2be0 100644
+--- a/src/qmlmodels/qmlmodels.pro
++++ b/src/qmlmodels/qmlmodels.pro
+@@ -68,6 +68,6 @@ QMLTYPES_FILENAME = plugins.qmltypes
+ QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQml/Models.2
+ QML_IMPORT_NAME = QtQml.Models
+ IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+-CONFIG += qmltypes install_qmltypes install_metatypes
++CONFIG += qmltypes install_qmltypes
+ 
+ load(qt_module)
+diff --git a/src/qmltest/qmltest.pro b/src/qmltest/qmltest.pro
+index c2e8068fc6..79dba368f7 100644
+--- a/src/qmltest/qmltest.pro
++++ b/src/qmltest/qmltest.pro
+@@ -34,7 +34,7 @@ QMLTYPES_FILENAME = plugins.qmltypes
+ QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/Qt/test/qtestroot
+ QML_IMPORT_NAME = Qt.test.qtestroot
+ QML_IMPORT_VERSION = 1.0
+-CONFIG += qmltypes install_qmltypes install_metatypes
++CONFIG += qmltypes install_qmltypes
+ 
+ # Install qmldir
+ qmldir.files = $$PWD/qmldir
+diff --git a/src/qmlworkerscript/qmlworkerscript.pro b/src/qmlworkerscript/qmlworkerscript.pro
+index 84466062e1..79885455cc 100644
+--- a/src/qmlworkerscript/qmlworkerscript.pro
++++ b/src/qmlworkerscript/qmlworkerscript.pro
+@@ -23,6 +23,6 @@ QMLTYPES_FILENAME = plugins.qmltypes
+ QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQml/WorkerScript.2
+ QML_IMPORT_NAME = QtQml.WorkerScript
+ IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+-CONFIG += qmltypes install_qmltypes install_metatypes
++CONFIG += qmltypes install_qmltypes
+ 
+ load(qt_module)
+diff --git a/src/quick/quick.pro b/src/quick/quick.pro
+index f2d49cf939..c401b04c4e 100644
+--- a/src/quick/quick.pro
++++ b/src/quick/quick.pro
+@@ -52,4 +52,4 @@ QMLTYPES_FILENAME = plugins.qmltypes
+ QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQuick.2
+ QML_IMPORT_NAME = QtQuick
+ IMPORT_VERSION = 2.$$QT_MINOR_VERSION
+-CONFIG += qmltypes install_qmltypes install_metatypes
++CONFIG += qmltypes install_qmltypes
+diff --git a/src/quickshapes/quickshapes.pro b/src/quickshapes/quickshapes.pro
+index 4dbd3e5e46..0c6b186fc8 100644
+--- a/src/quickshapes/quickshapes.pro
++++ b/src/quickshapes/quickshapes.pro
+@@ -36,4 +36,4 @@ QMLTYPES_FILENAME = plugins.qmltypes
+ QMLTYPES_INSTALL_DIR = $$[QT_INSTALL_QML]/QtQuick/Shapes
+ QML_IMPORT_NAME = QtQuick.Shapes
+ IMPORT_VERSION = 1.$$QT_MINOR_VERSION
+-CONFIG += qmltypes install_qmltypes install_metatypes
++CONFIG += qmltypes install_qmltypes
+diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
+index 005db4248..685c5b1b2 100644
+--- a/src/qml/qml/qqmlimport.cpp
++++ b/src/qml/qml/qqmlimport.cpp
+@@ -1760,6 +1760,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 QString envImportPath = qEnvironmentVariable("QML2_IMPORT_PATH");
+diff --git a/tools/qmlcachegen/qmlcache.prf b/tools/qmlcachegen/qmlcache.prf
+index 537eaf62ea..e21de58f64 100644
+--- a/tools/qmlcachegen/qmlcache.prf
++++ b/tools/qmlcachegen/qmlcache.prf
+@@ -26,7 +26,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/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtscript.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtscript.patch
new file mode 100644
index 000000000000..5508dec1280e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtscript.patch
@@ -0,0 +1,13 @@
+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
++++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Threading.h
+@@ -81,7 +81,7 @@
+ #include <pthread.h>
+ #elif PLATFORM(GTK)
+ #include <wtf/gtk/GOwnPtr.h>
+-typedef struct _GMutex GMutex;
++typedef union _GMutex GMutex;
+ typedef struct _GCond GCond;
+ #endif
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtserialport.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtserialport.patch
new file mode 100644
index 000000000000..f25524e80bcf
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtserialport.patch
@@ -0,0 +1,22 @@
+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()) {
++#ifdef NIXPKGS_LIBUDEV
++        udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
++#else
+         udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++#endif
+         if (!udevLibrary->load()) {
++#ifdef NIXPKGS_LIBUDEV
++            udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
++#else
+             udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++#endif
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qttools.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qttools.patch
new file mode 100644
index 000000000000..8ae12198ca25
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qttools.patch
@@ -0,0 +1,15 @@
+--- a/src/macdeployqt/shared/shared.cpp
++++ b/src/macdeployqt/shared/shared.cpp
+@@ -1241,6 +1241,12 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
+     if (!QFile(qmlImportScannerPath).exists())
+         qmlImportScannerPath = QCoreApplication::applicationDirPath() + "/qmlimportscanner";
+ 
++#ifdef NIXPKGS_QMLIMPORTSCANNER
++    // Fallback: Nixpkgs hardcoded path
++    if (!QFile(qmlImportScannerPath).exists())
++        qmlImportScannerPath = NIXPKGS_QMLIMPORTSCANNER;
++#endif
++
+     // Verify that we found a qmlimportscanner binary
+     if (!QFile(qmlImportScannerPath).exists()) {
+         LogError() << "qmlimportscanner not found at" << qmlImportScannerPath;
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebengine-darwin-no-platform-check.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebengine-darwin-no-platform-check.patch
new file mode 100644
index 000000000000..546e753144d0
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebengine-darwin-no-platform-check.patch
@@ -0,0 +1,33 @@
+diff --git a/mkspecs/features/platform.prf b/mkspecs/features/platform.prf
+--- a/mkspecs/features/platform.prf
++++ b/mkspecs/features/platform.prf
+@@ -40,8 +40,6 @@ defineTest(isPlatformSupported) {
+   } else:osx {
+     # FIXME: Try to get it back down to 8.2 for building on OS X 10.11
+     !isMinXcodeVersion(8, 3, 3) {
+-      skipBuild("Using Xcode version $$QMAKE_XCODE_VERSION, but at least version 8.3.3 is required to build Qt WebEngine.")
+-      return(false)
+     }
+     !clang|intel_icc {
+         skipBuild("Qt WebEngine on macOS requires Clang.")
+@@ -54,8 +52,6 @@ defineTest(isPlatformSupported) {
+       return(false)
+     }
+     !isMinOSXSDKVersion(10, 12): {
+-      skipBuild("Building Qt WebEngine requires a macOS SDK version of 10.12 or newer. Current version is $${WEBENGINE_OSX_SDK_PRODUCT_VERSION}.")
+-      return(false)
+     }
+   } else {
+     skipBuild("Unknown platform. Qt WebEngine only supports Linux, Windows, and macOS.")
+diff --git a/src/core/config/mac_osx.pri b/src/core/config/mac_osx.pri
+--- a/src/core/config/mac_osx.pri
++++ b/src/core/config/mac_osx.pri
+@@ -5,8 +5,6 @@ load(functions)
+ # otherwise query for it.
+ QMAKE_MAC_SDK_VERSION = $$eval(QMAKE_MAC_SDK.$${QMAKE_MAC_SDK}.SDKVersion)
+ isEmpty(QMAKE_MAC_SDK_VERSION) {
+-     QMAKE_MAC_SDK_VERSION = $$system("/usr/bin/xcodebuild -sdk $${QMAKE_MAC_SDK} -version SDKVersion 2>/dev/null")
+-     isEmpty(QMAKE_MAC_SDK_VERSION): error("Could not resolve SDK version for \'$${QMAKE_MAC_SDK}\'")
+ }
+
+ QMAKE_CLANG_DIR = "/usr"
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit-darwin-no-qos-classes.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit-darwin-no-qos-classes.patch
new file mode 100644
index 000000000000..a7087f517623
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit-darwin-no-qos-classes.patch
@@ -0,0 +1,11 @@
+diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake
+--- a/Source/cmake/OptionsQt.cmake
++++ b/Source/cmake/OptionsQt.cmake
+@@ -683,7 +683,6 @@ if (WIN32 AND COMPILER_IS_GCC_OR_CLANG)
+ endif ()
+ 
+ if (APPLE)
+-    SET_AND_EXPOSE_TO_BUILD(HAVE_QOS_CLASSES 1)
+ endif ()
+ 
+ if (ENABLE_MATHML)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit-darwin-no-readline.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit-darwin-no-readline.patch
new file mode 100644
index 000000000000..26d189d86019
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit-darwin-no-readline.patch
@@ -0,0 +1,45 @@
+diff --git a/Source/JavaScriptCore/shell/CMakeLists.txt b/Source/JavaScriptCore/shell/CMakeLists.txt
+--- a/Source/JavaScriptCore/shell/CMakeLists.txt
++++ b/Source/JavaScriptCore/shell/CMakeLists.txt
+@@ -9,7 +9,6 @@ set(JSC_LIBRARIES
+ )
+ 
+ if (WTF_OS_MAC_OS_X)
+-    list(APPEND JSC_LIBRARIES edit)
+ endif ()
+ 
+ if ("${JavaScriptCore_LIBRARY_TYPE}" MATCHES "STATIC")
+diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
+--- a/Source/WTF/wtf/Platform.h
++++ b/Source/WTF/wtf/Platform.h
+@@ -563,7 +563,6 @@
+ #if PLATFORM(IOS)
+ 
+ #define HAVE_NETWORK_EXTENSION 1
+-#define HAVE_READLINE 1
+ #if USE(APPLE_INTERNAL_SDK)
+ #define USE_CFNETWORK 1
+ #endif
+@@ -650,7 +649,6 @@
+ #define HAVE_MADV_DONTNEED 1
+ #define HAVE_MERGESORT 1
+ #define HAVE_PTHREAD_SETNAME_NP 1
+-#define HAVE_READLINE 1
+ #define HAVE_SYS_TIMEB_H 1
+ 
+ #if !PLATFORM(GTK) && !PLATFORM(QT)
+diff --git a/Source/WTF/wtf/PlatformMac.cmake b/Source/WTF/wtf/PlatformMac.cmake
+--- a/Source/WTF/wtf/PlatformMac.cmake
++++ b/Source/WTF/wtf/PlatformMac.cmake
+@@ -2,11 +2,9 @@ set(WTF_LIBRARY_TYPE SHARED)
+ 
+ find_library(COCOA_LIBRARY Cocoa)
+ find_library(COREFOUNDATION_LIBRARY CoreFoundation)
+-find_library(READLINE_LIBRARY Readline)
+ list(APPEND WTF_LIBRARIES
+     ${COREFOUNDATION_LIBRARY}
+     ${COCOA_LIBRARY}
+-    ${READLINE_LIBRARY}
+     libicucore.dylib
+ )
+ 
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit.patch b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit.patch
new file mode 100644
index 000000000000..b94a4b76cbab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/qtwebkit.patch
@@ -0,0 +1,12 @@
+diff --git a/Source/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake
+--- a/Source/WebKit2/PlatformQt.cmake
++++ b/Source/WebKit2/PlatformQt.cmake
+@@ -261,6 +261,7 @@
+ list(APPEND WebKit2_SYSTEM_INCLUDE_DIRECTORIES
+     ${GLIB_INCLUDE_DIRS}
+     ${GSTREAMER_INCLUDE_DIRS}
++    ${GSTREAMER_PBUTILS_INCLUDE_DIRS}
+     ${Qt5Quick_INCLUDE_DIRS}
+     ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
+     ${SQLITE_INCLUDE_DIR}
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/srcs.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.15/srcs.nix
new file mode 100644
index 000000000000..c88e896286ee
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/srcs.nix
@@ -0,0 +1,342 @@
+# DO NOT EDIT! This file is generated automatically.
+# Command: ./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/5.15
+{ fetchurl, mirror }:
+
+{
+  qt3d = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qt3d-everywhere-src-5.15.0.tar.xz";
+      sha256 = "61856f0c453b79e98b7a1e65ea8f59976fa78230ffa8dec959b5f4b45383dffd";
+      name = "qt3d-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtactiveqt = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtactiveqt-everywhere-src-5.15.0.tar.xz";
+      sha256 = "1b455eacfb9ef49912d7a79040ea409a6ab88dfa192d313e6b5e02a79d741b51";
+      name = "qtactiveqt-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtandroidextras = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtandroidextras-everywhere-src-5.15.0.tar.xz";
+      sha256 = "c9019185221e94e37e250c84acaebfb7b2f5342e8ad60cdcff052ac2b85ec671";
+      name = "qtandroidextras-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtbase = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtbase-everywhere-src-5.15.0.tar.xz";
+      sha256 = "9e7af10aece15fa9500369efde69cb220eee8ec3a6818afe01ce1e7d484824c5";
+      name = "qtbase-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtcharts = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtcharts-everywhere-src-5.15.0.tar.xz";
+      sha256 = "44a24fc16abcaf9ae97ecf3215f6f3b44ebdb3b73bcb4ed3549a51519e4883a7";
+      name = "qtcharts-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtconnectivity = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtconnectivity-everywhere-src-5.15.0.tar.xz";
+      sha256 = "f911fb8f8bf3a9958785d0378d25ced8989047938b7138d619854a94fa0b27dd";
+      name = "qtconnectivity-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtdatavis3d = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtdatavis3d-everywhere-src-5.15.0.tar.xz";
+      sha256 = "8f07747f371f7c515c667240a795105c89aa83c08d88ee92fa1ef7efccea10a3";
+      name = "qtdatavis3d-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtdeclarative = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtdeclarative-everywhere-src-5.15.0.tar.xz";
+      sha256 = "9c3c93fb7d340b2f7d738d12408c047318c78973cb45bfc5ff6b3a57e1fef699";
+      name = "qtdeclarative-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtdoc = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtdoc-everywhere-src-5.15.0.tar.xz";
+      sha256 = "07ca8db98c317f25cc9a041c48a6824baf63893bf5b535d6f8d266dea8c7659f";
+      name = "qtdoc-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtgamepad = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtgamepad-everywhere-src-5.15.0.tar.xz";
+      sha256 = "dda54d9f90897944bed5e6af48a904a677fd97eb6f57ab08a2b232c431caf31a";
+      name = "qtgamepad-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtgraphicaleffects = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtgraphicaleffects-everywhere-src-5.15.0.tar.xz";
+      sha256 = "0d2ea4bc73b9df13a4b739dcbc1e3c7b298c7e682f7f9252b232e3bde7b63eda";
+      name = "qtgraphicaleffects-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtimageformats = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtimageformats-everywhere-src-5.15.0.tar.xz";
+      sha256 = "83f32101b1a898fcb8ed6f11a657d1125484ac0c2223014b61849d9010efebc8";
+      name = "qtimageformats-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtlocation = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtlocation-everywhere-src-5.15.0.tar.xz";
+      sha256 = "c68b0778a521e5522641c41b1778999dd408ebfda1e0de166a83743268be5f3f";
+      name = "qtlocation-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtlottie = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtlottie-everywhere-src-5.15.0.tar.xz";
+      sha256 = "2053f474dcd7184fdcae2507f47af6527f6ca25b4424483f9265853c3626c833";
+      name = "qtlottie-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtmacextras = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtmacextras-everywhere-src-5.15.0.tar.xz";
+      sha256 = "95a8c35b30373224cdd6d1ca0bdda1a314b20e91551a4824e8ca7e50ce8ff439";
+      name = "qtmacextras-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtmultimedia = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtmultimedia-everywhere-src-5.15.0.tar.xz";
+      sha256 = "0708d867697f392dd3600c5c1c88f5c61b772a5250a4d059dca67b844af0fbd7";
+      name = "qtmultimedia-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtnetworkauth = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtnetworkauth-everywhere-src-5.15.0.tar.xz";
+      sha256 = "96c6107f6e85662a05f114c5b9bd3503a3100bd940e1494c73a99e77f9e7cf85";
+      name = "qtnetworkauth-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtpurchasing = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtpurchasing-everywhere-src-5.15.0.tar.xz";
+      sha256 = "2127f180c4889055d88e2b402b62be80a5a213a0e48d2056cc9a01d9913b3a16";
+      name = "qtpurchasing-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtquick3d = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtquick3d-everywhere-src-5.15.0.tar.xz";
+      sha256 = "6d3b91b653ba5e33fd5b37cd785ded6cf1dd83d35250c3addb77eb35f90e52cb";
+      name = "qtquick3d-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtquickcontrols = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtquickcontrols-everywhere-src-5.15.0.tar.xz";
+      sha256 = "7072cf4cd27e9f18b36b1c48dec7c79608cf87ba847d3fc3de133f220ec1acee";
+      name = "qtquickcontrols-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtquickcontrols2 = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtquickcontrols2-everywhere-src-5.15.0.tar.xz";
+      sha256 = "839abda9b58cd8656b2e5f46afbb484e63df466481ace43318c4c2022684648f";
+      name = "qtquickcontrols2-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtquicktimeline = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtquicktimeline-everywhere-src-5.15.0.tar.xz";
+      sha256 = "16ffeb733ba15815121fca5705ed5220ce0a0eb2ec0431ad0d55da9426a03c00";
+      name = "qtquicktimeline-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtremoteobjects = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtremoteobjects-everywhere-src-5.15.0.tar.xz";
+      sha256 = "86fcfdce77f13c7babdec4dc1d0c4b7b6b02e40120a4250dc59e911c53c08abf";
+      name = "qtremoteobjects-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtscript = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtscript-everywhere-src-5.15.0.tar.xz";
+      sha256 = "02dc21b309621876a89671be27cea86a58e74a96aa28da65fe1b37a3aad29373";
+      name = "qtscript-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtscxml = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtscxml-everywhere-src-5.15.0.tar.xz";
+      sha256 = "9c3a72bf5ebd07553b0049cc1943f04cff93b7e53bde8c81d652422dbf12ff72";
+      name = "qtscxml-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtsensors = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtsensors-everywhere-src-5.15.0.tar.xz";
+      sha256 = "12b17ed6cbe6c49c8ab71958bc5d8ad1c42bf20e2fa72613ede11001e98144da";
+      name = "qtsensors-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtserialbus = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtserialbus-everywhere-src-5.15.0.tar.xz";
+      sha256 = "cee067c84d025e221b83d109b58ea16c4d2dc0af0aea45cc6724acd33a1b7379";
+      name = "qtserialbus-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtserialport = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtserialport-everywhere-src-5.15.0.tar.xz";
+      sha256 = "ba19369069a707dffddca8d9c477bb2bb4aa26630dfee6792254c4bf9bd57a67";
+      name = "qtserialport-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtspeech = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtspeech-everywhere-src-5.15.0.tar.xz";
+      sha256 = "7219a878c14a24d0ca18d52df1717361b13aee96ac9790baf9ad2b383492dd61";
+      name = "qtspeech-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtsvg = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtsvg-everywhere-src-5.15.0.tar.xz";
+      sha256 = "ee4d287e2e205ca8c08921b9cbe0fc58bf46be080b5359ad4d7fbdee44aeee0d";
+      name = "qtsvg-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qttools = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qttools-everywhere-src-5.15.0.tar.xz";
+      sha256 = "ddbcb49aab3a2e3672582c6e2e7bec0058feff790f67472343c79e2895e0e437";
+      name = "qttools-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qttranslations = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qttranslations-everywhere-src-5.15.0.tar.xz";
+      sha256 = "45c43268d9df50784d4d8ca345fce9288a1055fd074ac0ef508097f7aeba22fe";
+      name = "qttranslations-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtvirtualkeyboard = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtvirtualkeyboard-everywhere-src-5.15.0.tar.xz";
+      sha256 = "f22f9204ab65578d9c8aa832a8a39108f826e00a7d391c7884ff490c587f34be";
+      name = "qtvirtualkeyboard-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtwayland = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtwayland-everywhere-src-5.15.0.tar.xz";
+      sha256 = "084133e10bfbd32a28125639660c59975f23457bba6a79b30a25802cec76a9fb";
+      name = "qtwayland-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtwebchannel = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtwebchannel-everywhere-src-5.15.0.tar.xz";
+      sha256 = "ea80510b363e6f92ce99932f06d176e43459c4a5159fe97b5ef96fcfbab5ed4f";
+      name = "qtwebchannel-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtwebengine = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtwebengine-everywhere-src-5.15.0.tar.xz";
+      sha256 = "c38e2fda7ed1b7d5a90f26abf231ec0715d78a5bc39a94673d8e39d75f04c5df";
+      name = "qtwebengine-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtwebglplugin = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtwebglplugin-everywhere-src-5.15.0.tar.xz";
+      sha256 = "f7b81f25ddf7b3a0046daa7224bc1e18c8b754b00b1a33775f30f827a5cdca15";
+      name = "qtwebglplugin-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtwebsockets = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtwebsockets-everywhere-src-5.15.0.tar.xz";
+      sha256 = "87c2f6542778f9b65b3f208740c1d0db643fd0bede21404b9abb265355da5092";
+      name = "qtwebsockets-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtwebview = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtwebview-everywhere-src-5.15.0.tar.xz";
+      sha256 = "b87ea205ce79c6b438ebe596e91fa80ba11f6aac7e89ffbf52b337d0fc8d6660";
+      name = "qtwebview-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtwinextras = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtwinextras-everywhere-src-5.15.0.tar.xz";
+      sha256 = "d77f2cb2ce83bdbfd0a970bc8d7d11c96b2df16befc257d6594f79dfd92abff0";
+      name = "qtwinextras-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtx11extras = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtx11extras-everywhere-src-5.15.0.tar.xz";
+      sha256 = "c72b6c188284facddcf82835af048240e721dc8d6d9e8a7bd71d76fd876881a1";
+      name = "qtx11extras-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+  qtxmlpatterns = {
+    version = "5.15.0";
+    src = fetchurl {
+      url = "${mirror}/official_releases/qt/5.15/5.15.0/submodules/qtxmlpatterns-everywhere-src-5.15.0.tar.xz";
+      sha256 = "2752cf2aa25ebfda89c3736457e27b3d0c7c7ed290dcfd52c209f9f905998507";
+      name = "qtxmlpatterns-everywhere-src-5.15.0.tar.xz";
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/README.md b/nixpkgs/pkgs/development/libraries/qt-5/README.md
new file mode 100644
index 000000000000..b2ef74d0aef1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/README.md
@@ -0,0 +1,81 @@
+# Qt 5 Maintainer's Notes
+
+## Minor Updates
+
+Let `$major` be the major version number, e.g. `5.9`.
+
+1. Change the version number in the `$major/fetch.sh`.
+2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$major`
+   from the top of the Nixpkgs tree.
+
+See below if it is necessary to update any patches.
+
+## Major Updates
+
+Let `$major` be the new major version number, e.g. `5.10`.
+
+1. Copy the subdirectory from the previous major version to `$major`.
+2. Change the version number in `$major/fetch.sh`.
+3. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$major`
+   from the top of the Nixpkgs tree.
+4. Add a top-level attribute in `pkgs/top-level/all-packages.nix` for the new
+   major version.
+5. Change the `qt5` top-level attribute to point to the new major version.
+6. If the previous major version is _not_ a long-term support release,
+   remove it from Nixpkgs.
+
+See below if it is necessary to update any patches.
+
+## Patches
+
+Nixpkgs maintains several patches for Qt which cannot be submitted upstream. To
+facilitate maintenance, a fork of the upstream repository is created for each patched module:
+
+- [qtbase](https://github.com/ttuegel/qtbase)
+- [qtwebkit](https://github.com/ttuegel/qtwebkit)
+- [qttools](https://github.com/ttuegel/qttools)
+- [qtscript](https://github.com/ttuegel/qtscript)
+- [qtserialport](https://github.com/ttuegel/qtserialport)
+- [qtdeclarative](https://github.com/ttuegel/qtdeclarative)
+- [qtwebengine](https://github.com/ttuegel/qtwebengine)
+
+In each repository, the patches are contained in a branch named `nixpkgs/$major`
+for each major version. Please make a pull request to add or update any patch
+which will be maintained in Nixpkgs.
+
+The forked repository for each module is used to create a single patch in
+Nixpkgs. To recreate the patch for module `$module` (e.g. `qtbase`) at version
+`$version` (e.g. `5.9.1`) in the branch `$major` (e.g. `5.9`),
+
+1. Clone the fork for `$module` from the list above.
+2. Checkout the active branch, `git checkout nixpkgs/$major`.
+3. Compare the patched branch to the release tag,
+   `git diff v$version > $module.patch`.
+4. Copy `$module.patch` into the Nixpkgs tree.
+
+### Minor Version Updates
+
+To update module `$module` to version `$version` from an older version in the
+same branch `$major`,
+
+1. Clone the fork for `$module` from the list above.
+2. Checkout the active branch, `git checkout nixpkgs/$major`.
+3. Merge the new version into the active branch,
+   `git merge --no-ff v$version`.
+4. Fix any conflicts.
+5. Open a pull request for the changes.
+6. Follow the instructions above to recreate the module patch in Nixpkgs.
+
+### Major Version Updates
+
+To update module `$module` from `$oldversion` in branch `$oldmajor` to version
+`$version` in branch `$major`,
+
+1. Clone the fork for `$module` from the list above.
+2. Checkout a new branch for the new major version,
+   `git checkout -b nixpkgs/$major nixpkgs/$oldmajor`.
+3. Rebase the patches from `$oldversion` onto the new branch,
+   `git rebase v$oldversion --onto v$version`.
+4. Fix any conflicts.
+5. Open a pull request for the changes.
+6. Follow the instructions above to recreate the module patch in Nixpkgs.
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qmake-libtool.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qmake-libtool.sh
new file mode 100644
index 000000000000..5acaeb824466
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qmake-libtool.sh
@@ -0,0 +1,14 @@
+# Fix libtool libraries generated by qmake.
+# qmake started inserting filenames of shared objects instead of the appropriate
+# linker flags. fixQmakeLibtool searches for broken libtool libraries and
+# replaces the filenames with the linker flags that should have been there.
+fixQmakeLibtool() {
+    if [ -d "$1" ]; then
+        find "$1" -name '*.la' | while read la; do
+            sed -i "$la" \
+                -e '/^dependency_libs/ s,\(/[^ ]\+\)/lib\([^/ ]\+\)\.so,-L\1 -l\2,g'
+        done
+    fi
+}
+
+fixupOutputHooks+=('fixQmakeLibtool $prefix')
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-builtin-paths.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-builtin-paths.sh
new file mode 100644
index 000000000000..4ca11a223de2
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-builtin-paths.sh
@@ -0,0 +1,64 @@
+# fixQtBuiltinPaths
+#
+# Usage: fixQtBuiltinPaths _dir_ _pattern_
+#
+# Fix Qt builtin paths in files matching _pattern_ under _dir_.
+#
+fixQtBuiltinPaths() {
+    local dir="$1"
+    local pattern="$2"
+    local bin="${!outputBin}"
+    local dev="${!outputDev}"
+    local doc="${!outputDoc}"
+    local lib="${!outputLib}"
+
+    if [ -d "$dir" ]; then
+        find "$dir" -name "$pattern" | while read pr_; do
+            if grep -q '\$\$\[QT_' "${pr_:?}"; then
+                echo "fixQtBuiltinPaths: Fixing Qt builtin paths in \`${pr_:?}'..."
+                sed -i "${pr_:?}" \
+                    -e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$dev/bin|g" \
+                    -e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$dev/mkspecs|g" \
+                    -e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$dev|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_ARCHDATA[^]]*\\]|$lib|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$bin/bin|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$bin|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_DATA[^]]*\\]|$lib|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$doc/share/doc|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$doc/examples|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$dev/include|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_LIBS[^]]*\\]|$lib/lib|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_LIBEXECS[^]]*\\]|$lib/libexec|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$bin/$qtPluginPrefix|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_PREFIX[^]]*\\]|$lib|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$dev/tests|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_TRANSLATIONS[^]]*\\]|$lib/translations|g" \
+                    -e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$bin/$qtQmlPrefix|g"
+            fi
+        done
+    elif [ -e "$dir" ]; then
+        if grep -q '\$\$\[QT_' "${dir:?}"; then
+            echo "fixQtBuiltinPaths: Fixing Qt builtin paths in \`${dir:?}'..."
+            sed -i "${dir:?}" \
+                -e "s|\\\$\\\$\\[QT_HOST_BINS[^]]*\\]|$dev/bin|g" \
+                -e "s|\\\$\\\$\\[QT_HOST_DATA[^]]*\\]/mkspecs|$dev/mkspecs|g" \
+                -e "s|\\\$\\\$\\[QT_HOST_PREFIX[^]]*\\]|$dev|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_ARCHDATA[^]]*\\]|$lib|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_BINS[^]]*\\]|$bin/bin|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_CONFIGURATION[^]]*\\]|$bin|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_DATA[^]]*\\]|$lib|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_DOCS[^]]*\\]|$doc/share/doc|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_EXAMPLES[^]]*\\]|$doc/examples|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_HEADERS[^]]*\\]|$dev/include|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_LIBS[^]]*\\]|$lib/lib|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_LIBEXECS[^]]*\\]|$lib/libexec|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_PLUGINS[^]]*\\]|$bin/$qtPluginPrefix|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_PREFIX[^]]*\\]|$lib|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_TESTS[^]]*\\]|$dev/tests|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_TRANSLATIONS[^]]*\\]|$lib/translations|g" \
+                -e "s|\\\$\\\$\\[QT_INSTALL_QML[^]]*\\]|$bin/$qtQmlPrefix|g"
+        fi
+    else
+        echo "fixQtBuiltinPaths: Warning: \`$dir' does not exist"
+    fi
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh
new file mode 100644
index 000000000000..33682f6f3c69
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/fix-qt-module-paths.sh
@@ -0,0 +1,36 @@
+# fixQtModulePaths
+#
+# Usage: fixQtModulePaths _dir_
+#
+# Find Qt module definitions in directory _dir_ and patch the module paths.
+#
+fixQtModulePaths () {
+    local dir="$1"
+    local bin="${!outputBin}"
+    local dev="${!outputDev}"
+    local lib="${!outputLib}"
+
+    if [ -d "$dir" ]; then
+        find "$dir" -name 'qt_*.pri' | while read pr; do
+            if grep -q '\$\$QT_MODULE_' "${pr:?}"; then
+                echo "fixQtModulePaths: Fixing module paths in \`${pr:?}'..."
+                sed -i "${pr:?}" \
+                    -e "s|\\\$\\\$QT_MODULE_LIB_BASE|$lib/lib|g" \
+                    -e "s|\\\$\\\$QT_MODULE_HOST_LIB_BASE|$lib/lib|g" \
+                    -e "s|\\\$\\\$QT_MODULE_INCLUDE_BASE|$dev/include|g" \
+                    -e "s|\\\$\\\$QT_MODULE_BIN_BASE|$dev/bin|g"
+            fi
+        done
+    elif [ -e "$dir" ]; then
+        echo "fixQtModulePaths: Warning: \`$dir' is not a directory"
+    else
+        echo "fixQtModulePaths: Warning: \`$dir' does not exist"
+    fi
+
+    if [ "z$bin" != "z$dev" ]; then
+        if [ -d "$bin/bin" ]; then
+            mkdir -p "$dev/bin"
+            lndir -silent "$bin/bin" "$dev/bin"
+        fi
+    fi
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh
new file mode 100644
index 000000000000..85489c85105b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/move-qt-dev-tools.sh
@@ -0,0 +1,34 @@
+updateToolPath() {
+    local tool="$1"
+    local target="$2"
+    local original="${!outputBin}/$tool"
+    local actual="${!outputDev}/$tool"
+    if grep -q "$original" "$target"; then
+        echo "updateToolPath: Updating \`$original' in \`$target\'..."
+        sed -i "$target" -e "s|$original|$actual|"
+    fi
+}
+
+moveQtDevTools() {
+    if [ -n "$devTools" ]; then
+        for tool in $devTools; do
+            moveToOutput "$tool" "${!outputDev}"
+        done
+
+        if [ -d "${!outputDev}/mkspecs" ]; then
+            find "${!outputDev}/mkspecs" -name '*.pr?' | while read pr_; do
+                for tool in $devTools; do
+                    updateToolPath "$tool" "$pr_"
+                done
+            done
+        fi
+
+        if [ -d "${!outputDev}/lib/cmake" ]; then
+            find "${!outputDev}/lib/cmake" -name '*.cmake' | while read cmake; do
+                for tool in $devTools; do
+                    updateToolPath "$tool" "$cmake"
+                done
+            done
+        fi
+    fi
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
new file mode 100644
index 000000000000..7f6ddb76ad57
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
@@ -0,0 +1,36 @@
+. @fix_qmake_libtool@
+
+qmakeFlags=( ${qmakeFlags-} )
+
+qmakePrePhase() {
+    qmakeFlags=( \
+        "PREFIX=$out" \
+        "NIX_OUTPUT_OUT=$out" \
+        "NIX_OUTPUT_DEV=${!outputDev}" \
+        "NIX_OUTPUT_BIN=${!outputBin}" \
+        "NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?}" \
+        "NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \
+        "NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}" \
+        "${qmakeFlags[@]}" \
+    )
+}
+prePhases+=" qmakePrePhase"
+
+qmakeConfigurePhase() {
+    runHook preConfigure
+
+    echo "QMAKEPATH=$QMAKEPATH"
+    echo qmake "${qmakeFlags[@]}"
+    qmake "${qmakeFlags[@]}"
+
+    if ! [[ -v enableParallelBuilding ]]; then
+        enableParallelBuilding=1
+        echo "qmake: enabled parallel building"
+    fi
+
+    runHook postConfigure
+}
+
+if [ -z "${dontUseQmakeConfigure-}" -a -z "${configurePhase-}" ]; then
+    configurePhase=qmakeConfigurePhase
+fi
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
new file mode 100644
index 000000000000..9f2a9f06f1ab
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
@@ -0,0 +1,66 @@
+qtPluginPrefix=@qtPluginPrefix@
+qtQmlPrefix=@qtQmlPrefix@
+qtDocPrefix=@qtDocPrefix@
+
+. @fix_qt_builtin_paths@
+. @fix_qt_module_paths@
+
+providesQtRuntime() {
+    [ -d "$1/$qtPluginPrefix" ] || [ -d "$1/$qtQmlPrefix" ]
+}
+
+# Build tools are often confused if QMAKE is unset.
+QMAKE=@dev@/bin/qmake
+export QMAKE
+
+QMAKEPATH=
+export QMAKEPATH
+
+QMAKEMODULES=
+export QMAKEMODULES
+
+qmakePathHook() {
+    if [ -d "$1/mkspecs" ]
+    then
+        QMAKEMODULES="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs"
+        QMAKEPATH="${QMAKEPATH}${QMAKEPATH:+:}$1"
+    fi
+}
+envBuildHostHooks+=(qmakePathHook)
+
+# Propagate any runtime dependency of the building package.
+# Each dependency is propagated to the user environment and as a build
+# input so that it will be re-propagated to the user environment by any
+# package depending on the building package. (This is necessary in case
+# the building package does not provide runtime dependencies itself and so
+# would not be propagated to the user environment.)
+qtEnvHostTargetHook() {
+    if providesQtRuntime "$1" && [ "z${!outputBin}" != "z${!outputDev}" ]
+    then
+        propagatedBuildInputs+=" $1"
+    fi
+}
+envHostTargetHooks+=(qtEnvHostTargetHook)
+
+postPatchMkspecs() {
+    # Prevent this hook from running multiple times
+    dontPatchMkspecs=1
+
+    local bin="${!outputBin}"
+    local dev="${!outputDev}"
+    local doc="${!outputDoc}"
+    local lib="${!outputLib}"
+
+    moveToOutput "mkspecs" "$dev"
+
+    if [ -d "$dev/mkspecs/modules" ]; then
+        fixQtModulePaths "$dev/mkspecs/modules"
+    fi
+
+    if [ -d "$dev/mkspecs" ]; then
+        fixQtBuiltinPaths "$dev/mkspecs" '*.pr?'
+    fi
+}
+if [ -z "${dontPatchMkspecs-}" ]; then
+    postPhases="${postPhases-}${postPhases:+ }postPatchMkspecs"
+fi
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh
new file mode 100644
index 000000000000..c320a7974471
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/qttools-setup-hook.sh
@@ -0,0 +1 @@
+qmakeFlags+=( "QMAKE_LRELEASE=@dev@/bin/lrelease" )
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh b/nixpkgs/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh
new file mode 100644
index 000000000000..7356c8ee3560
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh
@@ -0,0 +1,102 @@
+# Inherit arguments given in mkDerivation
+qtWrapperArgs=( ${qtWrapperArgs-} )
+
+qtHostPathSeen=()
+
+qtUnseenHostPath() {
+    for pkg in "${qtHostPathSeen[@]}"
+    do
+        if [ "${pkg:?}" == "$1" ]
+        then
+            return 1
+        fi
+    done
+
+    qtHostPathSeen+=("$1")
+    return 0
+}
+
+qtHostPathHook() {
+    qtUnseenHostPath "$1" || return 0
+
+    local pluginDir="$1/${qtPluginPrefix:?}"
+    if [ -d "$pluginDir" ]
+    then
+        qtWrapperArgs+=(--prefix QT_PLUGIN_PATH : "$pluginDir")
+    fi
+
+    local qmlDir="$1/${qtQmlPrefix:?}"
+    if [ -d "$qmlDir" ]
+    then
+        qtWrapperArgs+=(--prefix QML2_IMPORT_PATH : "$qmlDir")
+    fi
+}
+addEnvHooks "$hostOffset" qtHostPathHook
+
+makeQtWrapper() {
+    local original="$1"
+    local wrapper="$2"
+    shift 2
+    makeWrapper "$original" "$wrapper" "${qtWrapperArgs[@]}" "$@"
+}
+
+wrapQtApp() {
+    local program="$1"
+    shift 1
+    wrapProgram "$program" "${qtWrapperArgs[@]}" "$@"
+}
+
+qtOwnPathsHook() {
+    local xdgDataDir="${!outputBin}/share"
+    if [ -d "$xdgDataDir" ]
+    then
+        qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$xdgDataDir")
+    fi
+
+    local xdgConfigDir="${!outputBin}/etc/xdg"
+    if [ -d "$xdgConfigDir" ]
+    then
+        qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir")
+    fi
+
+    qtHostPathHook "${!outputBin}"
+}
+
+preFixupPhases+=" qtOwnPathsHook"
+
+# Note: $qtWrapperArgs still gets defined even if ${dontWrapQtApps-} is set.
+wrapQtAppsHook() {
+    # skip this hook when requested
+    [ -z "${dontWrapQtApps-}" ] || return 0
+
+    # guard against running multiple times (e.g. due to propagation)
+    [ -z "$wrapQtAppsHookHasRun" ] || return 0
+    wrapQtAppsHookHasRun=1
+
+    local targetDirs=( "$prefix/bin" "$prefix/sbin" "$prefix/libexec"  )
+    echo "wrapping Qt applications in ${targetDirs[@]}"
+
+    for targetDir in "${targetDirs[@]}"
+    do
+        [ -d "$targetDir" ] || continue
+
+        find "$targetDir" ! -type d -executable -print0 | while IFS= read -r -d '' file
+        do
+            patchelf --print-interpreter "$file" >/dev/null 2>&1 || continue
+
+            if [ -f "$file" ]
+            then
+                echo "wrapping $file"
+                wrapQtApp "$file"
+            elif [ -h "$file" ]
+            then
+                target="$(readlink -e "$file")"
+                echo "wrapping $file -> $target"
+                rm "$file"
+                makeQtWrapper "$target" "$file"
+            fi
+        done
+    done
+}
+
+fixupOutputHooks+=(wrapQtAppsHook)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/mkDerivation.nix b/nixpkgs/pkgs/development/libraries/qt-5/mkDerivation.nix
new file mode 100644
index 000000000000..2c6333cb0204
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/mkDerivation.nix
@@ -0,0 +1,32 @@
+{ lib, debug, wrapQtAppsHook }:
+
+let inherit (lib) optional; in
+
+mkDerivation:
+
+args:
+
+let
+  args_ = {
+
+    qmakeFlags = [ ("CONFIG+=" + (if debug then "debug" else "release")) ]
+              ++ (args.qmakeFlags or []);
+
+    NIX_CFLAGS_COMPILE = toString (
+      optional (!debug) "-DQT_NO_DEBUG"
+      ++ lib.toList (args.NIX_CFLAGS_COMPILE or []));
+
+    cmakeFlags =
+      (args.cmakeFlags or [])
+      ++ [
+        ("-DCMAKE_BUILD_TYPE=" + (if debug then "Debug" else "Release"))
+      ];
+
+    enableParallelBuilding = args.enableParallelBuilding or true;
+
+    nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ wrapQtAppsHook ];
+
+  };
+in
+
+mkDerivation (args // args_)
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
new file mode 100644
index 000000000000..cc6e45e3ebde
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
@@ -0,0 +1,413 @@
+{
+  stdenv, lib,
+  src, patches, version, qtCompatVersion,
+
+  coreutils, bison, flex, gdb, gperf, lndir, perl, pkgconfig, python3,
+  which,
+  # darwin support
+  darwin, libiconv,
+
+  dbus, fontconfig, freetype, glib, harfbuzz, icu, libX11, libXcomposite,
+  libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng,
+  libxcb, libxkbcommon, libxml2, libxslt, openssl, pcre16, pcre2, sqlite, udev,
+  xcbutil, xcbutilimage, xcbutilkeysyms, xcbutilrenderutil, xcbutilwm,
+  zlib,
+
+  # optional dependencies
+  cups ? null, libmysqlclient ? null, postgresql ? null,
+  withGtk3 ? false, dconf ? null, gtk3 ? null,
+
+  # options
+  libGLSupported ? !stdenv.isDarwin,
+  libGL,
+  buildExamples ? false,
+  buildTests ? false,
+  developerBuild ? false,
+  decryptSslTraffic ? false
+}:
+
+assert withGtk3 -> dconf != null;
+assert withGtk3 -> gtk3 != null;
+
+let
+  compareVersion = v: builtins.compareVersions version v;
+  qmakeCacheName =
+    if compareVersion "5.12.4" < 0 then ".qmake.cache" else ".qmake.stash";
+in
+
+stdenv.mkDerivation {
+
+  name = "qtbase-${version}";
+  inherit qtCompatVersion src version;
+
+  propagatedBuildInputs =
+    [
+      libxml2 libxslt openssl sqlite zlib
+
+      # Text rendering
+      harfbuzz icu
+
+      # Image formats
+      libjpeg libpng
+      (if compareVersion "5.9.0" < 0 then pcre16 else pcre2)
+    ]
+    ++ (
+      if stdenv.isDarwin
+      then with darwin.apple_sdk.frameworks;
+        [
+          # TODO: move to buildInputs, this should not be propagated.
+          AGL AppKit ApplicationServices Carbon Cocoa CoreAudio CoreBluetooth
+          CoreLocation CoreServices DiskArbitration Foundation OpenGL
+          darwin.libobjc libiconv MetalKit IOKit
+        ]
+      else
+        [
+          dbus glib udev
+
+          # Text rendering
+          fontconfig freetype
+
+          # X11 libs
+          libX11 libXcomposite libXext libXi libXrender libxcb libxkbcommon xcbutil
+          xcbutilimage xcbutilkeysyms xcbutilrenderutil xcbutilwm
+        ]
+        ++ lib.optional libGLSupported libGL
+    );
+
+  buildInputs =
+    [ python3 ]
+    ++ lib.optionals (!stdenv.isDarwin)
+    (
+      [ libinput ]
+      ++ lib.optional withGtk3 gtk3
+    )
+    ++ lib.optional developerBuild gdb
+    ++ lib.optional (cups != null) cups
+    ++ lib.optional (libmysqlclient != null) libmysqlclient
+    ++ lib.optional (postgresql != null) postgresql;
+
+  nativeBuildInputs =
+    [ bison flex gperf lndir perl pkgconfig which ];
+
+  propagatedNativeBuildInputs = [ lndir ];
+
+  outputs = [ "bin" "dev" "out" ];
+
+  inherit patches;
+
+  fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
+  fix_qt_module_paths = ../hooks/fix-qt-module-paths.sh;
+  preHook = ''
+    . "$fix_qt_builtin_paths"
+    . "$fix_qt_module_paths"
+    . ${../hooks/move-qt-dev-tools.sh}
+    . ${../hooks/fix-qmake-libtool.sh}
+  '';
+
+  postPatch =
+    ''
+      for prf in qml_plugin.prf qt_plugin.prf qt_docs.prf qml_module.prf create_cmake.prf; do
+          substituteInPlace "mkspecs/features/$prf" \
+              --subst-var qtPluginPrefix \
+              --subst-var qtQmlPrefix \
+              --subst-var qtDocPrefix
+      done
+
+      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
+    ''
+
+    + (
+      if stdenv.isDarwin
+      then
+        ''
+          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.
+      else
+        lib.optionalString libGLSupported
+          ''
+            sed -i mkspecs/common/linux.conf \
+                -e "/^QMAKE_INCDIR_OPENGL/ s|$|${libGL.dev or libGL}/include|" \
+                -e "/^QMAKE_LIBDIR_OPENGL/ s|$|${libGL.out}/lib|"
+          '' +
+        lib.optionalString (stdenv.hostPlatform.isx86_32 && stdenv.cc.isGNU)
+          ''
+            sed -i mkspecs/common/gcc-base-unix.conf \
+                -e "/^QMAKE_LFLAGS_SHLIB/ s/-shared/-shared -static-libgcc/"
+          ''
+    );
+
+  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:+:}$LD_LIBRARY_PATH"
+    ${lib.optionalString (compareVersion "5.9.0" < 0) ''
+    # We need to set LD to CXX or otherwise we get nasty compile errors
+    export LD=$CXX
+    ''}
+
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
+  '';
+
+  postConfigure = ''
+    qmakeCacheInjectNixOutputs() {
+        local cache="$1/${qmakeCacheName}"
+        echo "qmakeCacheInjectNixOutputs: $cache"
+        if ! [ -f "$cache" ]; then
+            echo >&2 "qmakeCacheInjectNixOutputs: WARNING: $cache does not exist"
+        fi
+        cat >>"$cache" <<EOF
+    NIX_OUTPUT_BIN = $bin
+    NIX_OUTPUT_DEV = $dev
+    NIX_OUTPUT_OUT = $out
+    NIX_OUTPUT_DOC = $dev/$qtDocPrefix
+    NIX_OUTPUT_QML = $bin/$qtQmlPrefix
+    NIX_OUTPUT_PLUGIN = $bin/$qtPluginPrefix
+    EOF
+    }
+
+    find . -name '.qmake.conf' | while read conf; do
+        qmakeCacheInjectNixOutputs "$(dirname $conf)"
+    done
+  '';
+
+  NIX_CFLAGS_COMPILE = toString ([
+    "-Wno-error=sign-compare" # freetype-2.5.4 changed signedness of some struct fields
+    ''-DNIXPKGS_QTCOMPOSE="${libX11.out}/share/X11/locale"''
+    ''-D${if compareVersion "5.11.0" >= 0 then "LIBRESOLV_SO" else "NIXPKGS_LIBRESOLV"}="${stdenv.cc.libc.out}/lib/libresolv"''
+    ''-DNIXPKGS_LIBXCURSOR="${libXcursor.out}/lib/libXcursor"''
+  ] ++ lib.optional libGLSupported ''-DNIXPKGS_MESA_GL="${libGL.out}/lib/libGL"''
+    ++ lib.optionals withGtk3 [
+         ''-DNIXPKGS_QGTK3_XDG_DATA_DIRS="${gtk3}/share/gsettings-schemas/${gtk3.name}"''
+         ''-DNIXPKGS_QGTK3_GIO_EXTRA_MODULES="${dconf.lib}/lib/gio/modules"''
+       ]
+    ++ 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";
+
+  # TODO Remove obsolete and useless flags once the build will be totally mastered
+  configureFlags =
+    [
+      "-plugindir $(out)/$(qtPluginPrefix)"
+      "-qmldir $(out)/$(qtQmlPrefix)"
+      "-docdir $(out)/$(qtDocPrefix)"
+
+      "-verbose"
+      "-confirm-license"
+      "-opensource"
+
+      "-release"
+      "-shared"
+      "-accessibility"
+      "-optimized-qmake"
+      "-strip"
+      "-system-proxies"
+      "-pkg-config"
+
+      "-gui"
+      "-widgets"
+      "-opengl desktop"
+      "-icu"
+      "-L" "${icu.out}/lib"
+      "-I" "${icu.dev}/include"
+      "-pch"
+    ]
+    ++ lib.optionals (compareVersion "5.11.0" < 0)
+    [
+      "-qml-debug"
+    ]
+    ++ lib.optionals (compareVersion "5.9.0" < 0)
+    [
+      "-c++11"
+      "-no-reduce-relocations"
+    ]
+    ++ lib.optionals developerBuild [
+      "-developer-build"
+      "-no-warnings-are-errors"
+    ]
+    ++ (
+      if (!stdenv.hostPlatform.isx86_64) then [
+        "-no-sse2"
+      ] else if (compareVersion "5.9.0" >= 0) then [
+        "-sse2"
+        "${if stdenv.hostPlatform.sse3Support   then "" else "-no"}-sse3"
+        "${if stdenv.hostPlatform.ssse3Support  then "" else "-no"}-ssse3"
+        "${if stdenv.hostPlatform.sse4_1Support then "" else "-no"}-sse4.1"
+        "${if stdenv.hostPlatform.sse4_2Support then "" else "-no"}-sse4.2"
+        "${if stdenv.hostPlatform.avxSupport    then "" else "-no"}-avx"
+        "${if stdenv.hostPlatform.avx2Support   then "" else "-no"}-avx2"
+      ] else [
+      ]
+    )
+    ++ [
+      "-no-mips_dsp"
+      "-no-mips_dspr2"
+    ]
+
+    ++ [
+      "-system-zlib"
+      "-L" "${zlib.out}/lib"
+      "-I" "${zlib.dev}/include"
+      "-system-libjpeg"
+      "-L" "${libjpeg.out}/lib"
+      "-I" "${libjpeg.dev}/include"
+      "-system-harfbuzz"
+      "-L" "${harfbuzz.out}/lib"
+      "-I" "${harfbuzz.dev}/include"
+      "-system-pcre"
+      "-openssl-linked"
+      "-L" "${openssl.out}/lib"
+      "-I" "${openssl.dev}/include"
+      "-system-sqlite"
+      ''-${if libmysqlclient != null then "plugin" else "no"}-sql-mysql''
+      ''-${if postgresql != null then "plugin" else "no"}-sql-psql''
+
+      "-make libs"
+      "-make tools"
+      ''-${lib.optionalString (!buildExamples) "no"}make examples''
+      ''-${lib.optionalString (!buildTests) "no"}make tests''
+    ]
+    ++ lib.optional (compareVersion "5.15.0" < 0) "-v"
+
+    ++ (
+      if stdenv.isDarwin
+      then
+        [
+          "-platform macx-clang"
+          "-no-fontconfig"
+          "-qt-freetype"
+          "-qt-libpng"
+          "-no-framework"
+        ]
+      else
+        [
+          "-${lib.optionalString (compareVersion "5.9.0" < 0) "no-"}rpath"
+        ]
+        ++ lib.optional (compareVersion "5.15.0" < 0) "-system-xcb"
+        ++ [
+          "-xcb"
+          "-qpa xcb"
+          "-L" "${libX11.out}/lib"
+          "-I" "${libX11.out}/include"
+          "-L" "${libXext.out}/lib"
+          "-I" "${libXext.out}/include"
+          "-L" "${libXrender.out}/lib"
+          "-I" "${libXrender.out}/include"
+
+          "-libinput"
+
+          ''-${lib.optionalString (cups == null) "no-"}cups''
+          "-dbus-linked"
+          "-glib"
+        ]
+        ++ lib.optional (compareVersion "5.15.0" < 0) "-system-libjpeg"
+        ++ [
+          "-system-libpng"
+        ]
+        ++ lib.optional withGtk3 "-gtk"
+        ++ lib.optional (compareVersion "5.9.0" >= 0) "-inotify"
+        ++ lib.optionals (compareVersion "5.10.0" >= 0) [
+          # Without these, Qt stops working on kernels < 3.17. See:
+          # https://github.com/NixOS/nixpkgs/issues/38832
+          "-no-feature-renameat2"
+          "-no-feature-getentropy"
+        ]
+        ++ lib.optionals (compareVersion "5.12.1" < 0) [
+          # use -xkbcommon and -xkbcommon-evdev for versions before 5.12.1
+          "-system-xkbcommon"
+          "-xkbcommon-evdev"
+        ]
+        ++ lib.optionals (cups != null) [
+          "-L" "${cups.lib}/lib"
+          "-I" "${cups.dev}/include"
+        ]
+        ++ lib.optionals (libmysqlclient != null) [
+          "-L" "${libmysqlclient}/lib"
+          "-I" "${libmysqlclient}/include"
+        ]
+    );
+
+  enableParallelBuilding = true;
+
+  postInstall =
+    # Move selected outputs.
+    ''
+      moveToOutput "mkspecs" "$dev"
+    '';
+
+  devTools = [
+    "bin/fixqt4headers.pl"
+    "bin/moc"
+    "bin/qdbuscpp2xml"
+    "bin/qdbusxml2cpp"
+    "bin/qlalr"
+    "bin/qmake"
+    "bin/rcc"
+    "bin/syncqt.pl"
+    "bin/uic"
+  ];
+
+  postFixup =
+    # Don't retain build-time dependencies like gdb.
+    ''
+      sed '/QMAKE_DEFAULT_.*DIRS/ d' -i $dev/mkspecs/qconfig.pri
+    ''
+
+    + ''
+      fixQtModulePaths "''${!outputDev}/mkspecs/modules"
+      fixQtBuiltinPaths "''${!outputDev}" '*.pr?'
+    ''
+
+    # Move development tools to $dev
+    + ''
+      moveQtDevTools
+      moveToOutput bin "$dev"
+    ''
+
+    # fixup .pc file (where to find 'moc' etc.)
+    + ''
+      sed -i "$dev/lib/pkgconfig/Qt5Core.pc" \
+          -e "/^host_bins=/ c host_bins=$dev/bin"
+    '';
+
+  setupHook = ../hooks/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 bkchr ];
+    platforms = platforms.unix;
+    broken = stdenv.isDarwin && (compareVersion "5.9.0" < 0);
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtcharts.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtcharts.nix
new file mode 100644
index 000000000000..84d3a17ea8ce
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtcharts.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtcharts";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtconnectivity.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtconnectivity.nix
new file mode 100644
index 000000000000..36a736d03dc5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtconnectivity.nix
@@ -0,0 +1,8 @@
+{ qtModule, stdenv, qtbase, qtdeclarative, bluez }:
+
+qtModule {
+  name = "qtconnectivity";
+  qtInputs = [ qtbase qtdeclarative ];
+  buildInputs = stdenv.lib.optional stdenv.isLinux bluez;
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix
new file mode 100644
index 000000000000..b611282294c6
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix
@@ -0,0 +1,26 @@
+{ qtModule, lib, python3, qtbase, qtsvg }:
+
+with lib;
+
+qtModule {
+  name = "qtdeclarative";
+  qtInputs = [ qtbase qtsvg ];
+  nativeBuildInputs = [ python3 ];
+  outputs = [ "out" "dev" "bin" ];
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
+  '';
+  configureFlags = lib.optionals (lib.versionAtLeast qtbase.version "5.11.0") [ "-qml-debug" ];
+  devTools = [
+    "bin/qml"
+    "bin/qmlcachegen"
+    "bin/qmleasing"
+    "bin/qmlimportscanner"
+    "bin/qmllint"
+    "bin/qmlmin"
+    "bin/qmlplugindump"
+    "bin/qmlprofiler"
+    "bin/qmlscene"
+    "bin/qmltestrunner"
+  ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdoc.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdoc.nix
new file mode 100644
index 000000000000..10623962c430
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdoc.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtdeclarative }:
+
+qtModule {
+  name = "qtdoc";
+  qtInputs = [ qtdeclarative ];
+  outputs = [ "out" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtgamepad.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtgamepad.nix
new file mode 100644
index 000000000000..281f6e0b8ecd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtgamepad.nix
@@ -0,0 +1,9 @@
+{ qtModule, qtbase, qtdeclarative, pkgconfig }:
+
+qtModule {
+  name = "qtgamepad";
+  qtInputs = [ qtbase qtdeclarative ];
+  buildInputs = [ ];
+  nativeBuildInputs = [ pkgconfig ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtgraphicaleffects.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtgraphicaleffects.nix
new file mode 100644
index 000000000000..d0be6ae77694
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtgraphicaleffects.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtdeclarative }:
+
+qtModule {
+  name = "qtgraphicaleffects";
+  qtInputs = [ qtdeclarative ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtimageformats.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtimageformats.nix
new file mode 100644
index 000000000000..9c80507b7c70
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtimageformats.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, libtiff }:
+
+qtModule {
+  name = "qtimageformats";
+  qtInputs = [ qtbase ];
+  propagatedBuildInputs = [ libtiff ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtlocation.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtlocation.nix
new file mode 100644
index 000000000000..0eee684a53fd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtlocation.nix
@@ -0,0 +1,14 @@
+{ stdenv, qtModule, qtbase, qtmultimedia }:
+
+qtModule {
+  name = "qtlocation";
+  qtInputs = [ qtbase qtmultimedia ];
+  outputs = [ "bin" "out" "dev" ];
+  qmakeFlags = stdenv.lib.optional stdenv.isDarwin [
+     # boost uses std::auto_ptr which has been disabled in clang with libcxx
+     # This flag re-enables this feature
+     # https://libcxx.llvm.org/docs/UsingLibcxx.html#c-17-specific-configuration-macros
+     "QMAKE_CXXFLAGS+=-D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR"
+  ];
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmacextras.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmacextras.nix
new file mode 100644
index 000000000000..11964caf17b1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmacextras.nix
@@ -0,0 +1,10 @@
+{ stdenv, qtModule, qtbase }:
+
+qtModule {
+  name = "qtmacextras";
+  qtInputs = [ qtbase ];
+  meta = with stdenv.lib; {
+    maintainers = with maintainers; [ periklis ];
+    platforms = platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix
new file mode 100644
index 000000000000..42ed23bb6dc9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix
@@ -0,0 +1,17 @@
+{ qtModule, stdenv, qtbase, qtdeclarative, pkgconfig
+, alsaLib, gstreamer, gst-plugins-base, libpulseaudio, wayland
+}:
+
+with stdenv.lib;
+
+qtModule {
+  name = "qtmultimedia";
+  qtInputs = [ qtbase qtdeclarative ];
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ gstreamer gst-plugins-base libpulseaudio ]
+    ++ optional (stdenv.isLinux) alsaLib
+    ++ optional (versionAtLeast qtbase.version "5.14.0" && stdenv.isLinux) wayland;
+  outputs = [ "bin" "dev" "out" ];
+  qmakeFlags = [ "GST_VERSION=1.0" ];
+  NIX_LDFLAGS = optionalString (stdenv.isDarwin) "-lobjc";
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtnetworkauth.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtnetworkauth.nix
new file mode 100644
index 000000000000..e6ef428cc3c4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtnetworkauth.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase }:
+
+qtModule {
+  name = "qtnetworkauth";
+  qtInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols.nix
new file mode 100644
index 000000000000..ba0f20bc0d83
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtdeclarative }:
+
+qtModule {
+  name = "qtquickcontrols";
+  qtInputs = [ qtdeclarative ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix
new file mode 100644
index 000000000000..a9522f4b1f0c
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtquickcontrols2.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtdeclarative }:
+
+qtModule {
+  name = "qtquickcontrols2";
+  qtInputs = [ qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtscript.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtscript.nix
new file mode 100644
index 000000000000..5a1a462a9640
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtscript.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase, qttools }:
+
+qtModule {
+  name = "qtscript";
+  qtInputs = [ qtbase qttools ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtscxml.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtscxml.nix
new file mode 100644
index 000000000000..62b428b08933
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtscxml.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtscxml";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsensors.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsensors.nix
new file mode 100644
index 000000000000..3b8732b68851
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsensors.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtsensors";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialbus.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialbus.nix
new file mode 100644
index 000000000000..48968a254c65
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialbus.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase, qtserialport }:
+
+qtModule {
+  name = "qtserialbus";
+  qtInputs = [ qtbase qtserialport ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix
new file mode 100644
index 000000000000..516d38340dc5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix
@@ -0,0 +1,11 @@
+{ qtModule, stdenv, lib, qtbase, systemd }:
+
+let inherit (lib) getLib optional; in
+
+qtModule {
+  name = "qtserialport";
+  qtInputs = [ qtbase ];
+  NIX_CFLAGS_COMPILE =
+    optional stdenv.isLinux
+    ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtspeech.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtspeech.nix
new file mode 100644
index 000000000000..ddef01a9482e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtspeech.nix
@@ -0,0 +1,7 @@
+{ qtModule }:
+
+qtModule {
+  name = "qtspeech";
+  qtInputs = [ ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsvg.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsvg.nix
new file mode 100644
index 000000000000..3ce68e56e412
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtsvg.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase }:
+
+qtModule {
+  name = "qtsvg";
+  qtInputs = [ qtbase ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix
new file mode 100644
index 000000000000..fae90972978f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix
@@ -0,0 +1,45 @@
+{ qtModule, stdenv, lib, qtbase, qtdeclarative }:
+
+with lib;
+
+qtModule {
+  name = "qttools";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+
+  # fixQtBuiltinPaths overwrites a builtin path we should keep
+  postPatch = ''
+    sed -i "src/linguist/linguist.pro" \
+        -e '/^cmake_linguist_config_version_file.input =/ s|$$\[QT_HOST_DATA.*\]|${getDev qtbase}|'
+    sed -i "src/qtattributionsscanner/qtattributionsscanner.pro" \
+        -e '/^cmake_qattributionsscanner_config_version_file.input =/ s|$$\[QT_HOST_DATA.*\]|${getDev qtbase}|'
+  '';
+
+  devTools = [
+    "bin/qcollectiongenerator"
+    "bin/linguist"
+    "bin/assistant"
+    "bin/qdoc"
+    "bin/lconvert"
+    "bin/designer"
+    "bin/qtattributionsscanner"
+    "bin/lrelease"
+    "bin/lrelease-pro"
+    "bin/pixeltool"
+    "bin/lupdate"
+    "bin/lupdate-pro"
+    "bin/qtdiag"
+    "bin/qhelpgenerator"
+    "bin/qtplugininfo"
+    "bin/qthelpconverter"
+    "bin/lprodump"
+    "bin/qdistancefieldgenerator"
+  ] ++ optionals stdenv.isDarwin [
+    "bin/macdeployqt"
+  ];
+
+  NIX_CFLAGS_COMPILE =
+    lib.optional stdenv.isDarwin ''-DNIXPKGS_QMLIMPORTSCANNER="${qtdeclarative.dev}/bin/qmlimportscanner"'';
+
+  setupHook = ../hooks/qttools-setup-hook.sh;
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qttranslations.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qttranslations.nix
new file mode 100644
index 000000000000..11a6e3fedcb1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qttranslations.nix
@@ -0,0 +1,6 @@
+{ qtModule, qttools }:
+
+qtModule {
+  name = "qttranslations";
+  qtInputs = [ qttools ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtvirtualkeyboard.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtvirtualkeyboard.nix
new file mode 100644
index 000000000000..2ba720c8eedc
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtvirtualkeyboard.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase, qtdeclarative, qtsvg, hunspell  }:
+
+qtModule {
+  name = "qtvirtualkeyboard";
+  qtInputs = [ qtbase qtdeclarative qtsvg hunspell ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwayland.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwayland.nix
new file mode 100644
index 000000000000..c7a7704f2837
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwayland.nix
@@ -0,0 +1,9 @@
+{ qtModule, qtbase, qtquickcontrols, wayland, pkgconfig }:
+
+qtModule {
+  name = "qtwayland";
+  qtInputs = [ qtbase qtquickcontrols ];
+  buildInputs = [ wayland ];
+  nativeBuildInputs = [ pkgconfig ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix
new file mode 100644
index 000000000000..84fb88385a3e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebchannel.nix
@@ -0,0 +1,8 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtwebchannel";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
+
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix
new file mode 100644
index 000000000000..049b0349a4f8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix
@@ -0,0 +1,242 @@
+{ qtModule, qtCompatVersion,
+  qtdeclarative, qtquickcontrols, qtlocation, qtwebchannel
+
+, bison, coreutils, flex, git, gperf, ninja, pkgconfig, python2, which
+
+, xorg, libXcursor, libXScrnSaver, libXrandr, libXtst
+, fontconfig, freetype, harfbuzz, icu, dbus, libdrm
+, zlib, minizip, libjpeg, libpng, libtiff, libwebp, libopus
+, jsoncpp, protobuf, libvpx, srtp, snappy, nss, libevent
+, alsaLib
+, libcap
+, pciutils
+, systemd
+, enableProprietaryCodecs ? true
+, gn
+, cups, darwin, openbsm, runCommand, xcbuild, writeScriptBin
+, ffmpeg_3 ? null
+, lib, stdenv, fetchpatch
+}:
+
+with stdenv.lib;
+
+qtModule {
+  name = "qtwebengine";
+  qtInputs = [ qtdeclarative qtquickcontrols qtlocation qtwebchannel ];
+  nativeBuildInputs = [
+    bison coreutils flex git gperf ninja pkgconfig python2 which gn
+  ] ++ optional stdenv.isDarwin xcbuild;
+  doCheck = true;
+  outputs = [ "bin" "dev" "out" ];
+
+  enableParallelBuilding = true;
+
+  # Don’t use the gn setup hook
+  dontUseGnConfigure = true;
+
+  # ninja builds some components with -Wno-format,
+  # which cannot be set at the same time as -Wformat-security
+  hardeningDisable = [ "format" ];
+
+  patches = [
+    # Fix build with bison-3.7: https://code.qt.io/cgit/qt/qtwebengine-chromium.git/commit/?id=1a53f599
+    (fetchpatch {
+      name = "qtwebengine-bison-3.7-build.patch";
+      url = "https://code.qt.io/cgit/qt/qtwebengine-chromium.git/patch/?id=1a53f599";
+      sha256 = "1nqpyn5fq37q7i9nasag6i14lnz0d7sld5ikqhlm8qwq9d7gbmjy";
+      stripLen = 1;
+      extraPrefix = "src/3rdparty/";
+    })
+  ];
+
+  postPatch =
+    # Patch Chromium build tools
+    ''
+      ( cd src/3rdparty/chromium; patchShebangs . )
+    ''
+    # Patch Chromium build files
+    + optionalString (lib.versionOlder qtCompatVersion "5.12") ''
+      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
+    ''
+    # Prevent Chromium build script from making the path to `clang` relative to
+    # the build directory.  `clang_base_path` is the value of `QMAKE_CLANG_DIR`
+    # from `src/core/config/mac_osx.pri`.
+    + optionalString stdenv.isDarwin ''
+      substituteInPlace ./src/3rdparty/chromium/build/toolchain/mac/BUILD.gn \
+        --replace 'prefix = rebase_path("$clang_base_path/bin/", root_build_dir)' 'prefix = "$clang_base_path/bin/"'
+    ''
+    # 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\)!"${lib.getLib systemd}/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
+    ''
+    + optionalString stdenv.isDarwin (''
+      substituteInPlace src/core/config/mac_osx.pri \
+        --replace 'QMAKE_CLANG_DIR = "/usr"' 'QMAKE_CLANG_DIR = "${stdenv.cc}"'
+    ''
+     # Following is required to prevent a build error:
+     # ninja: error: '/nix/store/z8z04p0ph48w22rqzx7ql67gy8cyvidi-SDKs/MacOSX10.12.sdk/usr/include/mach/exc.defs', needed by 'gen/third_party/crashpad/crashpad/util/mach/excUser.c', missing and no known rule to make it
+    + (optionalString (lib.versionAtLeast qtCompatVersion "5.11") ''
+      substituteInPlace src/3rdparty/chromium/third_party/crashpad/crashpad/util/BUILD.gn \
+        --replace '$sysroot/usr' "${darwin.xnu}"
+    '')
+    + ''
+    # Apple has some secret stuff they don't share with OpenBSM
+    substituteInPlace src/3rdparty/chromium/base/mac/mach_port_broker.mm \
+      --replace "audit_token_to_pid(msg.trailer.msgh_audit)" "msg.trailer.msgh_audit.val[5]"
+
+    substituteInPlace src/3rdparty/chromium/sandbox/mac/BUILD.gn \
+      --replace 'libs = [ "sandbox" ]' 'libs = [ "/usr/lib/libsandbox.1.dylib" ]'
+    '');
+
+  NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
+    # with gcc8, -Wclass-memaccess became part of -Wall and this exceeds the logging limit
+    "-Wno-class-memaccess"
+  ] ++ lib.optionals (stdenv.hostPlatform.platform.gcc.arch or "" == "sandybridge") [
+    # it fails when compiled with -march=sandybridge https://github.com/NixOS/nixpkgs/pull/59148#discussion_r276696940
+    # TODO: investigate and fix properly
+    "-march=westmere"
+  ] ++ lib.optionals stdenv.isDarwin [
+    "-DMAC_OS_X_VERSION_MAX_ALLOWED=MAC_OS_X_VERSION_10_12"
+    "-DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_12"
+
+    #
+    # Prevent errors like
+    # /nix/store/xxx-apple-framework-CoreData/Library/Frameworks/CoreData.framework/Headers/NSEntityDescription.h:51:7:
+    # error: pointer to non-const type 'id' with no explicit ownership
+    #     id** _kvcPropertyAccessors;
+    #
+    # TODO remove when new Apple SDK is in
+    #
+    "-fno-objc-arc"
+  ];
+
+  preConfigure = ''
+    export NINJAFLAGS=-j$NIX_BUILD_CORES
+
+    if [ -d "$PWD/tools/qmake" ]; then
+        QMAKEPATH="$PWD/tools/qmake''${QMAKEPATH:+:}$QMAKEPATH"
+    fi
+   '';
+
+  qmakeFlags = if stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64
+    then [ "--" "-system-ffmpeg" ] ++ optional enableProprietaryCodecs "-proprietary-codecs"
+    else optional enableProprietaryCodecs "-- -proprietary-codecs";
+
+  propagatedBuildInputs = [
+    # Image formats
+    libjpeg libpng libtiff libwebp
+
+    # Video formats
+    srtp libvpx
+
+    # Audio formats
+    libopus
+
+    # Text rendering
+    harfbuzz icu
+
+    libevent
+  ] ++ optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [
+    ffmpeg_3
+  ] ++ optionals (!stdenv.isDarwin) [
+    dbus zlib minizip snappy nss protobuf jsoncpp
+
+    # Audio formats
+    alsaLib
+
+    # Text rendering
+    fontconfig freetype
+
+    libcap
+    pciutils
+
+    # X11 libs
+    xorg.xrandr libXScrnSaver libXcursor libXrandr xorg.libpciaccess libXtst
+    xorg.libXcomposite xorg.libXdamage libdrm
+  ]
+
+  # FIXME These dependencies shouldn't be needed but can't find a way
+  # around it. Chromium pulls this in while bootstrapping GN.
+  ++ lib.optionals stdenv.isDarwin (with darwin; with apple_sdk.frameworks; [
+    libobjc
+    cctools
+
+    # frameworks
+    ApplicationServices
+    AVFoundation
+    Foundation
+    ForceFeedback
+    GameController
+    AppKit
+    ImageCaptureCore
+    CoreBluetooth
+    IOBluetooth
+    CoreWLAN
+    Quartz
+    Cocoa
+    LocalAuthentication
+
+    openbsm
+    libunwind
+  ]);
+
+  buildInputs = optionals stdenv.isDarwin (with darwin; [
+    cups
+
+    # `sw_vers` is used by `src/3rdparty/chromium/build/config/mac/sdk_info.py`
+    # to get some information about the host platform.
+    (writeScriptBin "sw_vers" ''
+      #!${stdenv.shell}
+
+      while [ $# -gt 0 ]; do
+        case "$1" in
+          -buildVersion) echo "17E199";;
+        *) break ;;
+
+        esac
+        shift
+      done
+    '')
+
+    # For sandbox.h include
+    (runCommand "MacOS_SDK_sandbox.h" {} ''
+      install -Dm444 "${lib.getDev darwin.apple_sdk.sdk}"/include/sandbox.h "$out"/include/sandbox.h
+    '')
+  ]);
+
+  __impureHostDeps = optional stdenv.isDarwin "/usr/lib/libsandbox.1.dylib";
+
+  dontUseNinjaBuild = true;
+  dontUseNinjaInstall = true;
+  dontUseXcbuild = true;
+
+  postInstall = lib.optionalString stdenv.isLinux ''
+    cat > $out/libexec/qt.conf <<EOF
+    [Paths]
+    Prefix = ..
+    EOF
+  '';
+
+  meta = with lib; {
+    description = "A web engine based on the Chromium web browser";
+    maintainers = with maintainers; [ matthewbauer ];
+    platforms = platforms.unix;
+  };
+
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebglplugin.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebglplugin.nix
new file mode 100644
index 000000000000..444d0c1beae8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebglplugin.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase, qtwebsockets }:
+
+qtModule {
+  name = "qtwebglplugin";
+  qtInputs = [ qtbase qtwebsockets ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix
new file mode 100644
index 000000000000..b31e57f38065
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix
@@ -0,0 +1,78 @@
+{ qtModule, stdenv, lib, fetchurl
+, qtbase, qtdeclarative, qtlocation, qtmultimedia, qtsensors, qtwebchannel
+, fontconfig, gtk2, libwebp, libxml2, libxslt
+, sqlite, systemd, glib, gst_all_1, cmake
+, bison, flex, gdb, gperf, perl, pkgconfig, python2, ruby
+, darwin
+, flashplayerFix ? false
+}:
+
+let
+  inherit (lib) optional optionals getDev getLib;
+  hyphen = stdenv.mkDerivation rec {
+    name = "hyphen-2.8.8";
+    src = fetchurl {
+      url = "http://dev-www.libreoffice.org/src/5ade6ae2a99bc1e9e57031ca88d36dad-${name}.tar.gz";
+      sha256 = "304636d4eccd81a14b6914d07b84c79ebb815288c76fe027b9ebff6ff24d5705";
+    };
+    postPatch = ''
+      patchShebangs tests
+    '';
+    buildInputs = [ perl ];
+  };
+  usingAnnulenWebkitFork = lib.versionAtLeast qtbase.version "5.11.0";
+in
+qtModule {
+  name = "qtwebkit";
+  qtInputs = [ qtbase qtdeclarative qtlocation qtsensors ]
+    ++ optional (stdenv.isDarwin && lib.versionAtLeast qtbase.version "5.9.0") qtmultimedia
+    ++ optional usingAnnulenWebkitFork qtwebchannel;
+  buildInputs = [ fontconfig libwebp libxml2 libxslt sqlite glib gst_all_1.gstreamer gst_all_1.gst-plugins-base ]
+    ++ optionals (stdenv.isDarwin) (with darwin; with apple_sdk.frameworks; [ ICU OpenGL ])
+    ++ optional usingAnnulenWebkitFork hyphen;
+  nativeBuildInputs = [
+    bison flex gdb gperf perl pkgconfig python2 ruby
+  ] ++ optional usingAnnulenWebkitFork cmake;
+
+  cmakeFlags = optionals usingAnnulenWebkitFork ([ "-DPORT=Qt" ]
+    ++ optionals stdenv.isDarwin [
+      "-DQt5Multimedia_DIR=${getDev qtmultimedia}/lib/cmake/Qt5Multimedia"
+      "-DQt5MultimediaWidgets_DIR=${getDev qtmultimedia}/lib/cmake/Qt5MultimediaWidgets"
+      "-DMACOS_FORCE_SYSTEM_XML_LIBRARIES=OFF"
+    ]);
+
+  # QtWebKit overrides qmake's default_pre and default_post features,
+  # so its custom qmake files must be found first at the front of QMAKEPATH.
+  preConfigure = stdenv.lib.optionalString (!usingAnnulenWebkitFork) ''
+    QMAKEPATH="$PWD/Tools/qmake''${QMAKEPATH:+:}$QMAKEPATH"
+    fixQtBuiltinPaths . '*.pr?'
+    # Fix hydra's "Log limit exceeded"
+    export qmakeFlags="$qmakeFlags CONFIG+=silent"
+  '';
+
+  NIX_CFLAGS_COMPILE = [
+      # with gcc7 this warning blows the log over Hydra's limit
+      "-Wno-expansion-to-defined"
+    ]
+    # with gcc8, -Wclass-memaccess became part of -Wall and this too exceeds the logging limit
+    ++ optional stdenv.cc.isGNU "-Wno-class-memaccess"
+    # with clang this warning blows the log over Hydra's limit
+    ++ optional stdenv.isDarwin "-Wno-inconsistent-missing-override"
+    ++ optionals flashplayerFix
+      [
+        ''-DNIXPKGS_LIBGTK2="${getLib gtk2}/lib/libgtk-x11-2.0"''
+        # this file used to exist in gdk_pixbuf?
+        ''-DNIXPKGS_LIBGDK2="${getLib gtk2}/lib/libgdk-x11-2.0"''
+      ]
+    ++ optional (!stdenv.isDarwin) ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
+
+  doCheck = false; # fails 13 out of 13 tests (ctest)
+
+  # Hack to avoid TMPDIR in RPATHs.
+  preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
+
+  meta = {
+    broken = lib.versionAtLeast qtbase.version "5.15";
+    maintainers = with stdenv.lib.maintainers; [ abbradar periklis ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebsockets.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebsockets.nix
new file mode 100644
index 000000000000..ad5e7625f289
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebsockets.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtwebsockets";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix
new file mode 100644
index 000000000000..906d750c5d3f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix
@@ -0,0 +1,14 @@
+{ darwin, stdenv, qtModule, qtdeclarative, qtwebengine }:
+
+with stdenv.lib;
+
+qtModule {
+  name = "qtwebview";
+  qtInputs = [ qtdeclarative qtwebengine ];
+  buildInputs = optional (stdenv.isDarwin) [
+    darwin.apple_sdk.frameworks.CoreFoundation
+    darwin.apple_sdk.frameworks.WebKit
+  ];
+  outputs = [ "out" "dev" "bin" ];
+  NIX_LDFLAGS = optionalString stdenv.isDarwin "-framework CoreFoundation -framework WebKit";
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtx11extras.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtx11extras.nix
new file mode 100644
index 000000000000..4d431fee278b
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtx11extras.nix
@@ -0,0 +1,6 @@
+{ qtModule, qtbase }:
+
+qtModule {
+  name = "qtx11extras";
+  qtInputs = [ qtbase ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtxmlpatterns.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtxmlpatterns.nix
new file mode 100644
index 000000000000..7ac922421f08
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtxmlpatterns.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  name = "qtxmlpatterns";
+  qtInputs = [ qtbase qtdeclarative ];
+  devTools = [ "bin/xmlpatterns" "bin/xmlpatternsvalidator" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/qt-env.nix b/nixpkgs/pkgs/development/libraries/qt-5/qt-env.nix
new file mode 100644
index 000000000000..da56c07779b9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/qt-env.nix
@@ -0,0 +1,21 @@
+{ buildEnv, qtbase }: name: paths:
+
+buildEnv {
+  inherit name;
+  paths = [ qtbase ] ++ paths;
+
+  pathsToLink = [ "/bin" "/mkspecs" "/include" "/lib" "/share" ];
+  extraOutputsToInstall = [ "dev" ];
+
+  postBuild = ''
+    rm "$out/bin/qmake"
+    cp "${qtbase.dev}/bin/qmake" "$out/bin"
+    cat >"$out/bin/qt.conf" <<EOF
+    [Paths]
+    Prefix = $out
+    Plugins = ${qtbase.qtPluginPrefix}
+    Qml2Imports = ${qtbase.qtQmlPrefix}
+    Documentation = ${qtbase.qtDocPrefix}
+    EOF
+  '';
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/qtModule.nix b/nixpkgs/pkgs/development/libraries/qt-5/qtModule.nix
new file mode 100644
index 000000000000..0481f000c6ce
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/qtModule.nix
@@ -0,0 +1,59 @@
+{ lib, mkDerivation, perl }:
+
+let inherit (lib) licenses maintainers platforms; in
+
+{ self, srcs, patches }:
+
+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;
+  patches = args.patches or patches.${name} or [];
+
+  nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ perl self.qmake ];
+  propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
+
+  outputs = args.outputs or [ "out" "dev" ];
+  setOutputFlags = args.setOutputFlags or false;
+
+  preHook = ''
+    . ${./hooks/move-qt-dev-tools.sh}
+    . ${./hooks/fix-qt-builtin-paths.sh}
+  '';
+
+  preConfigure = ''
+    ${args.preConfigure or ""}
+
+    fixQtBuiltinPaths . '*.pr?'
+  '';
+
+  postFixup = ''
+    if [ -d "''${!outputDev}/lib/pkgconfig" ]; then
+        find "''${!outputDev}/lib/pkgconfig" -name '*.pc' | while read pc; do
+            sed -i "$pc" \
+                -e "/^prefix=/ c prefix=''${!outputLib}" \
+                -e "/^exec_prefix=/ c exec_prefix=''${!outputBin}" \
+                -e "/^includedir=/ c includedir=''${!outputDev}/include"
+        done
+    fi
+
+    moveQtDevTools
+
+    ${args.postFixup or ""}
+  '';
+
+  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 bkchr ];
+    platforms = platforms.unix;
+  } // (args.meta or {});
+})