about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/qt-5
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-09-08 17:57:14 +0000
committerAlyssa Ross <hi@alyssa.is>2021-09-13 11:31:47 +0000
commitee7984efa14902a2ddd820c937457667a4f40c6a (patch)
treec9c1d046733cefe5e21fdd8a52104175d47b2443 /nixpkgs/pkgs/development/libraries/qt-5
parentffc9d4ba381da62fd08b361bacd1e71e2a3d934d (diff)
parentb3c692172e5b5241b028a98e1977f9fb12eeaf42 (diff)
downloadnixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.gz
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.bz2
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.lz
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.xz
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.zst
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.zip
Merge commit 'b3c692172e5b5241b028a98e1977f9fb12eeaf42'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/qt-5')
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix103
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.14/default.nix103
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/5.15/default.nix134
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qt3d.nix7
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix484
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix2
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix21
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix6
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix11
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix150
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix47
-rw-r--r--nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix12
12 files changed, 525 insertions, 555 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
index 77b8c3f525a2..0f5eb19474e4 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.12/default.nix
@@ -14,21 +14,18 @@ top-level attribute to `top-level/all-packages.nix`.
 
 */
 
-{
-  newScope,
-  lib, stdenv, fetchurl, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper,
-  bison, cups ? null, harfbuzz, libGL, perl,
-  gstreamer, gst-plugins-base, gtk3, dconf,
-  llvmPackages_5,
+{ newScope
+, lib, stdenv, fetchurl, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper
+, bison, cups ? null, harfbuzz, libGL, perl
+, gstreamer, gst-plugins-base, gtk3, dconf
+, llvmPackages_5, darwin
 
   # options
-  developerBuild ? false,
-  decryptSslTraffic ? false,
-  debug ? false,
+, developerBuild ? false
+, decryptSslTraffic ? false
+, debug ? false
 }:
 
-with lib;
-
 let
 
   qtCompatVersion = srcs.qtbase.version;
@@ -50,31 +47,30 @@ let
   };
 
   patches = {
-    qtbase =
-      [
-        ./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
-        ./qtbase.patch.d/0002-qtbase-mac.patch
-        ./qtbase.patch.d/0013-define-kiosurfacesuccess.patch
-
-        # Patch framework detection to support X.framework/X.tbd,
-        # extending the current support for X.framework/X.
-        ./qtbase.patch.d/0015-qtbase-tbd-frameworks.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
-      ];
+    qtbase = [
+      ./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
+      ./qtbase.patch.d/0002-qtbase-mac.patch
+      ./qtbase.patch.d/0013-define-kiosurfacesuccess.patch
+
+      # Patch framework detection to support X.framework/X.tbd,
+      # extending the current support for X.framework/X.
+      ./qtbase.patch.d/0015-qtbase-tbd-frameworks.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
+    ];
     qtdeclarative = [ ./qtdeclarative.patch ];
     qtlocation = [ ./qtlocation-gcc-9.patch ];
     qtscript = [ ./qtscript.patch ];
@@ -131,6 +127,8 @@ let
       callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
     in {
 
+      inherit callPackage qtCompatVersion qtModule srcs;
+
       mkDerivationWith =
         import ../mkDerivation.nix
         { inherit lib; inherit debug; inherit (self) wrapQtAppsHook; };
@@ -143,8 +141,12 @@ let
         inherit bison cups harfbuzz libGL;
         withGtk3 = true; inherit dconf gtk3;
         inherit debug developerBuild decryptSslTraffic;
+        inherit (darwin.apple_sdk.frameworks) AGL AppKit ApplicationServices Carbon Cocoa CoreAudio CoreBluetooth
+          CoreLocation CoreServices DiskArbitration Foundation OpenGL MetalKit IOKit;
+        inherit (darwin) libobjc;
       };
 
+      qt3d = callPackage ../modules/qt3d.nix {};
       qtcharts = callPackage ../modules/qtcharts.nix {};
       qtconnectivity = callPackage ../modules/qtconnectivity.nix {};
       qtdeclarative = callPackage ../modules/qtdeclarative.nix {};
@@ -173,23 +175,33 @@ let
       qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix {};
       qtwayland = callPackage ../modules/qtwayland.nix {};
       qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
-      qtwebengine = callPackage ../modules/qtwebengine.nix {};
+      qtwebengine = callPackage ../modules/qtwebengine.nix {
+        inherit (darwin) cctools libobjc libunwind xnu;
+        inherit (darwin.apple_sdk.libs) sandbox;
+        inherit (darwin.apple_sdk.frameworks) ApplicationServices AVFoundation Foundation ForceFeedback GameController AppKit
+          ImageCaptureCore CoreBluetooth IOBluetooth CoreWLAN Quartz Cocoa LocalAuthentication;
+      };
       qtwebglplugin = callPackage ../modules/qtwebglplugin.nix {};
-      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {
+        inherit (darwin) ICU;
+        inherit (darwin.apple_sdk.frameworks) OpenGL;
+      };
       qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
-      qtwebview = callPackage ../modules/qtwebview.nix {};
+      qtwebview = callPackage ../modules/qtwebview.nix {
+        inherit (darwin.apple_sdk.frameworks) CoreFoundation WebKit;
+      };
       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
+        qt3d 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);
+      ] ++ lib.optional (!stdenv.isDarwin) qtwayland
+        ++ lib.optional (stdenv.isDarwin) qtmacextras);
 
       qmake = makeSetupHook {
         deps = [ self.qtbase.dev ];
@@ -200,12 +212,11 @@ let
       } ../hooks/qmake-hook.sh;
 
       wrapQtAppsHook = makeSetupHook {
-        deps =
-          [ self.qtbase.dev makeWrapper ]
-          ++ optional stdenv.isLinux self.qtwayland.dev;
+        deps = [ self.qtbase.dev makeWrapper ]
+          ++ lib.optional stdenv.isLinux self.qtwayland.dev;
       } ../hooks/wrap-qt-apps-hook.sh;
     };
 
-   self = makeScope newScope addPackages;
+   self = lib.makeScope newScope addPackages;
 
 in self
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.14/default.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.14/default.nix
index 02b170e0eb17..c12a20dd4daf 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/5.14/default.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.14/default.nix
@@ -14,21 +14,18 @@ top-level attribute to `top-level/all-packages.nix`.
 
 */
 
-{
-  newScope,
-  lib, stdenv, fetchurl, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper,
-  bison, cups ? null, harfbuzz, libGL, perl,
-  gstreamer, gst-plugins-base, gtk3, dconf,
-  llvmPackages_5,
+{ newScope
+, lib, stdenv, fetchurl, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper
+, bison, cups ? null, harfbuzz, libGL, perl
+, gstreamer, gst-plugins-base, gtk3, dconf
+, llvmPackages_5, darwin
 
   # options
-  developerBuild ? false,
-  decryptSslTraffic ? false,
-  debug ? false,
+, developerBuild ? false
+, decryptSslTraffic ? false
+, debug ? false
 }:
 
-with lib;
-
 let
 
   qtCompatVersion = srcs.qtbase.version;
@@ -51,29 +48,27 @@ let
   };
 
   patches = {
-    qtbase =
-      optionals stdenv.isDarwin [
-        ./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
-
-        # Downgrade minimal required SDK to 10.12
-        ./qtbase.patch.d/0013-define-kiosurfacesuccess.patch
-        ./qtbase.patch.d/qtbase-sdk-10.12-mac.patch
-
-        # Patch framework detection to support X.framework/X.tbd,
-        # extending the current support for X.framework/X.
-        ./qtbase.patch.d/0012-qtbase-tbd-frameworks.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
-      ];
+    qtbase = lib.optionals stdenv.isDarwin [
+      ./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
+
+      # Downgrade minimal required SDK to 10.12
+      ./qtbase.patch.d/0013-define-kiosurfacesuccess.patch
+      ./qtbase.patch.d/qtbase-sdk-10.12-mac.patch
+
+      # Patch framework detection to support X.framework/X.tbd,
+      # extending the current support for X.framework/X.
+      ./qtbase.patch.d/0012-qtbase-tbd-frameworks.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 ];
     qtlocation = [ ./qtlocation-gcc-9.patch ];
     qtscript = [ ./qtscript.patch ];
@@ -103,8 +98,7 @@ let
         stripLen = 1;
         extraPrefix = "src/3rdparty/";
       })
-    ]
-      ++ optional stdenv.isDarwin ./qtwebengine-darwin-no-platform-check.patch;
+    ] ++ lib.optional stdenv.isDarwin ./qtwebengine-darwin-no-platform-check.patch;
     qtwebkit = [
       (fetchpatch {
         name = "qtwebkit-bison-3.7-build.patch";
@@ -118,7 +112,7 @@ let
       })
       ./qtwebkit.patch
       ./qtwebkit-icu68.patch
-    ] ++ optionals stdenv.isDarwin [
+    ] ++ lib.optionals stdenv.isDarwin [
       ./qtwebkit-darwin-no-readline.patch
       ./qtwebkit-darwin-no-qos-classes.patch
     ];
@@ -145,6 +139,8 @@ let
       callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
     in {
 
+      inherit callPackage qtCompatVersion qtModule srcs;
+
       mkDerivationWith =
         import ../mkDerivation.nix
         { inherit lib; inherit debug; inherit (self) wrapQtAppsHook; };
@@ -157,8 +153,12 @@ let
         inherit bison cups harfbuzz libGL;
         withGtk3 = true; inherit dconf gtk3;
         inherit debug developerBuild decryptSslTraffic;
+        inherit (darwin.apple_sdk.frameworks) AGL AppKit ApplicationServices Carbon Cocoa CoreAudio CoreBluetooth
+          CoreLocation CoreServices DiskArbitration Foundation OpenGL MetalKit IOKit;
+        inherit (darwin) libobjc;
       };
 
+      qt3d = callPackage ../modules/qt3d.nix {};
       qtcharts = callPackage ../modules/qtcharts.nix {};
       qtconnectivity = callPackage ../modules/qtconnectivity.nix {};
       qtdeclarative = callPackage ../modules/qtdeclarative.nix {};
@@ -185,23 +185,33 @@ let
       qtvirtualkeyboard = callPackage ../modules/qtvirtualkeyboard.nix {};
       qtwayland = callPackage ../modules/qtwayland.nix {};
       qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
-      qtwebengine = callPackage ../modules/qtwebengine.nix {};
+      qtwebengine = callPackage ../modules/qtwebengine.nix {
+        inherit (darwin) cctools libobjc libunwind xnu;
+        inherit (darwin.apple_sdk.libs) sandbox;
+        inherit (darwin.apple_sdk.frameworks) ApplicationServices AVFoundation Foundation ForceFeedback GameController AppKit
+          ImageCaptureCore CoreBluetooth IOBluetooth CoreWLAN Quartz Cocoa LocalAuthentication;
+      };
       qtwebglplugin = callPackage ../modules/qtwebglplugin.nix {};
-      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {
+        inherit (darwin) ICU;
+        inherit (darwin.apple_sdk.frameworks) OpenGL;
+      };
       qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
-      qtwebview = callPackage ../modules/qtwebview.nix {};
+      qtwebview = callPackage ../modules/qtwebview.nix {
+        inherit (darwin.apple_sdk.frameworks) CoreFoundation WebKit;
+      };
       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
+        qt3d 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);
+      ] ++ lib.optional (!stdenv.isDarwin) qtwayland
+        ++ lib.optional (stdenv.isDarwin) qtmacextras);
 
       qmake = makeSetupHook {
         deps = [ self.qtbase.dev ];
@@ -212,12 +222,11 @@ let
       } ../hooks/qmake-hook.sh;
 
       wrapQtAppsHook = makeSetupHook {
-        deps =
-          [ self.qtbase.dev makeWrapper ]
-          ++ optional stdenv.isLinux self.qtwayland.dev;
+        deps = [ self.qtbase.dev makeWrapper ]
+          ++ lib.optional stdenv.isLinux self.qtwayland.dev;
       } ../hooks/wrap-qt-apps-hook.sh;
     };
 
-   self = makeScope newScope addPackages;
+   self = lib.makeScope newScope addPackages;
 
 in self
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/5.15/default.nix b/nixpkgs/pkgs/development/libraries/qt-5/5.15/default.nix
index 5d8688cfdc75..3b8540ca68fe 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/5.15/default.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/5.15/default.nix
@@ -14,21 +14,18 @@ top-level attribute to `top-level/all-packages.nix`.
 
 */
 
-{
-  newScope,
-  lib, stdenv, fetchurl, fetchpatch, fetchgit, fetchFromGitHub, makeSetupHook, makeWrapper,
-  bison, cups ? null, harfbuzz, libGL, perl,
-  gstreamer, gst-plugins-base, gtk3, dconf,
-  llvmPackages_5,
+{ newScope
+, lib, stdenv, fetchurl, fetchgit, fetchpatch, fetchFromGitHub, makeSetupHook, makeWrapper
+, bison, cups ? null, harfbuzz, libGL, perl
+, gstreamer, gst-plugins-base, gtk3, dconf
+, llvmPackages_5, darwin
 
   # options
-  developerBuild ? false,
-  decryptSslTraffic ? false,
-  debug ? false,
+, developerBuild ? false
+, decryptSslTraffic ? false
+, debug ? false
 }:
 
-with lib;
-
 let
 
   qtCompatVersion = srcs.qtbase.version;
@@ -49,25 +46,21 @@ let
       version = "5.212.0-alpha4";
     };
 
-    # Even if developed in the public, QtWebEngine does not have official
-    # releases or new tags since the Qt company made 5.15.3 proprietary.
-    # Apparently they care more about licensing than the security of their users.
-    # See https://lists.qt-project.org/pipermail/interest/2021-March/036387.html
     qtwebengine =
       let
-        branchName = "5.15.3";
-        rev = "a059e7404a6db799f4da0ad696e65ae9c854b4b0";
+        branchName = "5.15.5";
+        rev = "v${branchName}-lts";
       in
       {
         version = "${branchName}-${lib.substring 0 7 rev}";
 
         src = fetchgit {
           url = "https://github.com/qt/qtwebengine.git";
-          sha256 = "1vdgxfbmx4z4qrm2g61dl64gqn3fv5f83jwpp7h1gyfx5z2qvfmv";
+          sha256 = "12wf30d34sgn82mbz91xybxyn3j1mhvxda452cfkxm232n1f2kjb";
           inherit rev branchName;
           fetchSubmodules = true;
           leaveDotGit = true;
-          name = "qtwebengine-${substring 0 7 rev}.tar.gz";
+          name = "qtwebengine-${lib.substring 0 7 rev}.tar.gz";
           postFetch = ''
             # remove submodule .git directory
             rm -rf $out/src/3rdparty/.git
@@ -87,51 +80,49 @@ let
   };
 
   patches = {
-    qtbase =
-      optionals stdenv.isDarwin [
-        ./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
-
-        # Downgrade minimal required SDK to 10.12
-        ./qtbase.patch.d/0013-define-kiosurfacesuccess.patch
-        ./qtbase.patch.d/macos-sdk-10.12/0001-Revert-QCocoaDrag-set-image-only-on-the-first-drag-i.patch
-        ./qtbase.patch.d/macos-sdk-10.12/0002-Revert-QCocoaDrag-drag-make-sure-clipboard-is-ours-a.patch
-        ./qtbase.patch.d/macos-sdk-10.12/0003-Revert-QCocoaDrag-maybeDragMultipleItems-fix-erroneo.patch
-        ./qtbase.patch.d/macos-sdk-10.12/0004-Revert-QCocoaDrag-avoid-using-the-deprecated-API-if-.patch
-        ./qtbase.patch.d/macos-sdk-10.12/0005-Revert-macOS-Fix-use-of-deprecated-NSOffState.patch
-        ./qtbase.patch.d/macos-sdk-10.12/0006-git-checkout-v5.15.0-src-plugins-platforms-cocoa-qco.patch
-        ./qtbase.patch.d/qtbase-sdk-10.12-mac.patch
-
-        # Patch framework detection to support X.framework/X.tbd,
-        # extending the current support for X.framework/X.
-        ./qtbase.patch.d/0012-qtbase-tbd-frameworks.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
-      ];
+    qtbase = lib.optionals stdenv.isDarwin [
+      ./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
+
+      # Downgrade minimal required SDK to 10.12
+      ./qtbase.patch.d/0013-define-kiosurfacesuccess.patch
+      ./qtbase.patch.d/macos-sdk-10.12/0001-Revert-QCocoaDrag-set-image-only-on-the-first-drag-i.patch
+      ./qtbase.patch.d/macos-sdk-10.12/0002-Revert-QCocoaDrag-drag-make-sure-clipboard-is-ours-a.patch
+      ./qtbase.patch.d/macos-sdk-10.12/0003-Revert-QCocoaDrag-maybeDragMultipleItems-fix-erroneo.patch
+      ./qtbase.patch.d/macos-sdk-10.12/0004-Revert-QCocoaDrag-avoid-using-the-deprecated-API-if-.patch
+      ./qtbase.patch.d/macos-sdk-10.12/0005-Revert-macOS-Fix-use-of-deprecated-NSOffState.patch
+      ./qtbase.patch.d/macos-sdk-10.12/0006-git-checkout-v5.15.0-src-plugins-platforms-cocoa-qco.patch
+      ./qtbase.patch.d/qtbase-sdk-10.12-mac.patch
+
+      # Patch framework detection to support X.framework/X.tbd,
+      # extending the current support for X.framework/X.
+      ./qtbase.patch.d/0012-qtbase-tbd-frameworks.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
+      (fetchpatch { # This can be removed when https://codereview.qt-project.org/c/qt/qtbase/+/339323 is included in an release.
+        name = "0014-gcc11-compat.patch";
+        url = "https://codereview.qt-project.org/gitweb?p=qt/qtbase.git;a=patch;h=049e14870c13235cd066758f29c42dc96c1ccdf8";
+        sha256 = "1cb2hwi859hds0fa2cbap014qaa7mah9p0rcxcm2cvj2ybl33qfc";
+      })
+    ];
     qtdeclarative = [ ./qtdeclarative.patch ];
     qtscript = [ ./qtscript.patch ];
     qtserialport = [ ./qtserialport.patch ];
     qtwebengine = [
-      # Fix crashes with non en_US.UTF-8 locales
-      (fetchpatch {
-        url = "https://github.com/qt/qtwebengine/commit/199ea00a9eea13315a652c62778738629185b059.patch";
-        sha256 = "1b5k2g1v8913cvsgvp6ja4mcprjlk5vcwqzi0p1qq7b1wyi4f0g2";
-      })
       # Fix invisible fonts with glibc 2.33: https://github.com/NixOS/nixpkgs/issues/131074
       (fetchpatch {
         url = "https://src.fedoraproject.org/rpms/qt5-qtwebengine/raw/d122c011631137b79455850c363676c655cf9e09/f/qtwebengine-everywhere-src-5.15.5-%231904652.patch";
         name = "qtwebengine-everywhere-src-5.15.5-_1904652.patch";
         sha256 = "01q7hagq0ysii1jnrh5adm97vdm9cis592xr6im7accyw6hgcn7b";
       })
-    ] ++ optionals stdenv.isDarwin [
+    ] ++ lib.optionals stdenv.isDarwin [
       ./qtwebengine-darwin-no-platform-check.patch
       ./qtwebengine-mac-dont-set-dsymutil-path.patch
     ];
@@ -148,7 +139,7 @@ let
       })
       ./qtwebkit.patch
       ./qtwebkit-icu68.patch
-    ] ++ optionals stdenv.isDarwin [
+    ] ++ lib.optionals stdenv.isDarwin [
       ./qtwebkit-darwin-no-readline.patch
       ./qtwebkit-darwin-no-qos-classes.patch
     ];
@@ -174,6 +165,8 @@ let
       callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
     in {
 
+      inherit callPackage qtCompatVersion qtModule srcs;
+
       mkDerivationWith =
         import ../mkDerivation.nix
         { inherit lib; inherit debug; inherit (self) wrapQtAppsHook; };
@@ -186,8 +179,12 @@ let
         inherit bison cups harfbuzz libGL;
         withGtk3 = true; inherit dconf gtk3;
         inherit developerBuild decryptSslTraffic;
+        inherit (darwin.apple_sdk.frameworks) AGL AppKit ApplicationServices Carbon Cocoa CoreAudio CoreBluetooth
+          CoreLocation CoreServices DiskArbitration Foundation OpenGL MetalKit IOKit;
+        inherit (darwin) libobjc;
       };
 
+      qt3d = callPackage ../modules/qt3d.nix {};
       qtcharts = callPackage ../modules/qtcharts.nix {};
       qtconnectivity = callPackage ../modules/qtconnectivity.nix {};
       qtdeclarative = callPackage ../modules/qtdeclarative.nix {};
@@ -206,6 +203,7 @@ let
       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 {};
@@ -217,23 +215,32 @@ let
       qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
       qtwebengine = callPackage ../modules/qtwebengine.nix {
         inherit (srcs.qtwebengine) version;
+        inherit (darwin) cctools libobjc libunwind xnu;
+        inherit (darwin.apple_sdk.libs) sandbox;
+        inherit (darwin.apple_sdk.frameworks) ApplicationServices AVFoundation Foundation ForceFeedback GameController AppKit
+          ImageCaptureCore CoreBluetooth IOBluetooth CoreWLAN Quartz Cocoa LocalAuthentication;
       };
       qtwebglplugin = callPackage ../modules/qtwebglplugin.nix {};
-      qtwebkit = callPackage ../modules/qtwebkit.nix {};
+      qtwebkit = callPackage ../modules/qtwebkit.nix {
+        inherit (darwin) ICU;
+        inherit (darwin.apple_sdk.frameworks) OpenGL;
+      };
       qtwebsockets = callPackage ../modules/qtwebsockets.nix {};
-      qtwebview = callPackage ../modules/qtwebview.nix {};
+      qtwebview = callPackage ../modules/qtwebview.nix {
+        inherit (darwin.apple_sdk.frameworks) CoreFoundation WebKit;
+      };
       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
+        qt3d 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);
+      ] ++ lib.optional (!stdenv.isDarwin) qtwayland
+        ++ lib.optional (stdenv.isDarwin) qtmacextras);
 
       qmake = makeSetupHook {
         deps = [ self.qtbase.dev ];
@@ -244,12 +251,11 @@ let
       } ../hooks/qmake-hook.sh;
 
       wrapQtAppsHook = makeSetupHook {
-        deps =
-          [ self.qtbase.dev makeWrapper ]
-          ++ optional stdenv.isLinux self.qtwayland.dev;
+        deps = [ self.qtbase.dev makeWrapper ]
+          ++ lib.optional stdenv.isLinux self.qtwayland.dev;
       } ../hooks/wrap-qt-apps-hook.sh;
     };
 
-   self = makeScope newScope addPackages;
+   self = lib.makeScope newScope addPackages;
 
 in self
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qt3d.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qt3d.nix
new file mode 100644
index 000000000000..63a516476f27
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qt3d.nix
@@ -0,0 +1,7 @@
+{ qtModule, qtbase, qtdeclarative }:
+
+qtModule {
+  pname = "qt3d";
+  qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+}
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
index 0d0bef342b02..04a89558c3d0 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtbase.nix
@@ -1,30 +1,30 @@
-{
-  stdenv, lib,
-  src, patches, version, qtCompatVersion,
+{ stdenv, lib
+, src, patches, version, qtCompatVersion
 
-  coreutils, bison, flex, gdb, gperf, lndir, perl, pkg-config, python3,
-  which,
+, coreutils, bison, flex, gdb, gperf, lndir, perl, pkg-config, python3
+, which
   # darwin support
-  darwin, libiconv,
+, libiconv, libobjc, xcbuild, AGL, AppKit, ApplicationServices, Carbon, Cocoa, CoreAudio, CoreBluetooth
+, CoreLocation, CoreServices, DiskArbitration, Foundation, OpenGL, MetalKit, IOKit
 
-  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,
+, 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,
+, cups ? null, libmysqlclient ? null, postgresql ? null
+, withGtk3 ? false, dconf ? null, gtk3 ? null
 
   # options
-  libGLSupported ? !stdenv.isDarwin,
-  libGL,
-  buildExamples ? false,
-  buildTests ? false,
-  debug ? false,
-  developerBuild ? false,
-  decryptSslTraffic ? false
+, libGLSupported ? !stdenv.isDarwin
+, libGL
+, buildExamples ? false
+, buildTests ? false
+, debug ? false
+, developerBuild ? false
+, decryptSslTraffic ? false
 }:
 
 assert withGtk3 -> dconf != null;
@@ -32,53 +32,43 @@ assert withGtk3 -> gtk3 != null;
 
 let
   compareVersion = v: builtins.compareVersions version v;
-  qmakeCacheName =
-    if compareVersion "5.12.4" < 0 then ".qmake.cache" else ".qmake.stash";
+  qmakeCacheName = if compareVersion "5.12.4" < 0 then ".qmake.cache" else ".qmake.stash";
   debugSymbols = debug || developerBuild;
 in
 
 stdenv.mkDerivation {
-
-  name = "qtbase-${version}";
+  pname = "qtbase";
   inherit qtCompatVersion src version;
   debug = debugSymbols;
 
-  propagatedBuildInputs =
-    [
-      libxml2 libxslt openssl sqlite zlib
+  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 [
+      # TODO: move to buildInputs, this should not be propagated.
+      AGL AppKit ApplicationServices Carbon Cocoa CoreAudio CoreBluetooth
+      CoreLocation CoreServices DiskArbitration Foundation OpenGL
+      libobjc libiconv MetalKit IOKit
+    ] else [
+      dbus glib udev
 
       # Text rendering
-      harfbuzz icu
+      fontconfig freetype
 
-      # 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 ]
+      # 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 ]
@@ -89,8 +79,8 @@ stdenv.mkDerivation {
     ++ lib.optional (libmysqlclient != null) libmysqlclient
     ++ lib.optional (postgresql != null) postgresql;
 
-  nativeBuildInputs =
-    [ bison flex gperf lndir perl pkg-config which ];
+  nativeBuildInputs = [ bison flex gperf lndir perl pkg-config which ]
+    ++ lib.optionals stdenv.isDarwin [ xcbuild ];
 
   propagatedNativeBuildInputs = [ lndir ];
 
@@ -107,59 +97,42 @@ stdenv.mkDerivation {
     . ${../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
-    ''
+  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
 
-    + (
-      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/"
-          ''
-    );
+    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|xcode-select|' \
+            -e 's|/usr/bin/xcrun|xcrun|' \
+            -e 's|/usr/bin/xcodebuild|xcodebuild|' \
+            -e 's|QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`|QMAKE_CXX="clang++"\nQMAKE_CONF_COMPILER="clang++"|' \
+            ./configure
+            substituteInPlace ./mkspecs/common/mac.conf \
+                --replace "/System/Library/Frameworks/OpenGL.framework/" "${OpenGL}/Library/Frameworks/OpenGL.framework/" \
+                --replace "/System/Library/Frameworks/AGL.framework/" "${AGL}/Library/Frameworks/AGL.framework/"
+    '' 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";
@@ -218,153 +191,128 @@ stdenv.mkDerivation {
   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.optional debugSymbols "-debug"
-    ++ 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"
+  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.optional debugSymbols "-debug"
+    ++ 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 lib.optionals (compareVersion "5.9.0" >= 0) [
+    "-sse2"
+    "${lib.optionalString (!stdenv.hostPlatform.sse3Support)   "-no"}-sse3"
+    "${lib.optionalString (!stdenv.hostPlatform.ssse3Support)  "-no"}-ssse3"
+    "${lib.optionalString (!stdenv.hostPlatform.sse4_1Support) "-no"}-sse4.1"
+    "${lib.optionalString (!stdenv.hostPlatform.sse4_2Support) "-no"}-sse4.2"
+    "${lib.optionalString (!stdenv.hostPlatform.avxSupport)    "-no"}-avx"
+    "${lib.optionalString (!stdenv.hostPlatform.avx2Support)   "-no"}-avx2"
     ]
+  ) ++ [
+    "-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.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''
+      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"
     ]
-    ++ 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"
-        ]
-    );
-
-  postInstall =
-    # Move selected outputs.
-    ''
-      moveToOutput "mkspecs" "$dev"
-    '';
+  # Move selected outputs.
+  postInstall = ''
+    moveToOutput "mkspecs" "$dev"
+  '';
 
   devTools = [
     "bin/fixqt4headers.pl"
@@ -378,35 +326,27 @@ stdenv.mkDerivation {
     "bin/uic"
   ];
 
-  postFixup =
+  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?'
-    ''
+    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"
-    ''
+    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"
-    '';
+    sed -i "$dev/lib/pkgconfig/Qt5Core.pc" \
+      -e "/^host_bins=/ c host_bins=$dev/bin"
+  '';
 
   dontStrip = debugSymbols;
 
   setupHook = ../hooks/qtbase-setup-hook.sh;
 
   meta = with lib; {
-    homepage = "http://www.qt.io";
+    homepage = "https://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 ];
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix
index 97248ca18076..89f2672c26dd 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtdeclarative.nix
@@ -1,7 +1,5 @@
 { qtModule, lib, python3, qtbase, qtsvg }:
 
-with lib;
-
 qtModule {
   pname = "qtdeclarative";
   qtInputs = [ qtbase qtsvg ];
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix
index 0d2d565fe7ae..baf5c30e73c4 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtmultimedia.nix
@@ -1,17 +1,24 @@
-{ qtModule, lib, stdenv, qtbase, qtdeclarative, pkg-config
-, alsa-lib, gstreamer, gst-plugins-base, libpulseaudio, wayland
+{ qtModule
+, lib
+, stdenv
+, qtbase
+, qtdeclarative
+, pkg-config
+, alsa-lib
+, gstreamer
+, gst-plugins-base
+, libpulseaudio
+, wayland
 }:
 
-with lib;
-
 qtModule {
   pname = "qtmultimedia";
   qtInputs = [ qtbase qtdeclarative ];
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ gstreamer gst-plugins-base libpulseaudio ]
-    ++ optional (stdenv.isLinux) alsa-lib
-    ++ optional (versionAtLeast qtbase.version "5.14.0" && stdenv.isLinux) wayland;
+    ++ lib.optional (stdenv.isLinux) alsa-lib
+    ++ lib.optional (lib.versionAtLeast qtbase.version "5.14.0" && stdenv.isLinux) wayland;
   outputs = [ "bin" "dev" "out" ];
   qmakeFlags = [ "GST_VERSION=1.0" ];
-  NIX_LDFLAGS = optionalString (stdenv.isDarwin) "-lobjc";
+  NIX_LDFLAGS = lib.optionalString (stdenv.isDarwin) "-lobjc";
 }
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix
index caeaedbcf3d5..89d96eb29124 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtserialport.nix
@@ -1,11 +1,7 @@
 { qtModule, stdenv, lib, qtbase, systemd }:
 
-let inherit (lib) getLib optional; in
-
 qtModule {
   pname = "qtserialport";
   qtInputs = [ qtbase ];
-  NIX_CFLAGS_COMPILE =
-    optional stdenv.isLinux
-    ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isLinux "-DNIXPKGS_LIBUDEV=\"${lib.getLib systemd}/lib/libudev\"";
 }
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix
index 437ec6cef743..27008f6714ed 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qttools.nix
@@ -1,7 +1,5 @@
 { qtModule, stdenv, lib, qtbase, qtdeclarative }:
 
-with lib;
-
 qtModule {
   pname = "qttools";
   qtInputs = [ qtbase qtdeclarative ];
@@ -10,9 +8,9 @@ qtModule {
   # 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}|'
+        -e '/^cmake_linguist_config_version_file.input =/ s|$$\[QT_HOST_DATA.*\]|${lib.getDev qtbase}|'
     sed -i "src/qtattributionsscanner/qtattributionsscanner.pro" \
-        -e '/^cmake_qattributionsscanner_config_version_file.input =/ s|$$\[QT_HOST_DATA.*\]|${getDev qtbase}|'
+        -e '/^cmake_qattributionsscanner_config_version_file.input =/ s|$$\[QT_HOST_DATA.*\]|${lib.getDev qtbase}|'
   '';
 
   devTools = [
@@ -34,12 +32,11 @@ qtModule {
     "bin/qthelpconverter"
     "bin/lprodump"
     "bin/qdistancefieldgenerator"
-  ] ++ optionals stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     "bin/macdeployqt"
   ];
 
-  NIX_CFLAGS_COMPILE =
-    lib.optional stdenv.isDarwin ''-DNIXPKGS_QMLIMPORTSCANNER="${qtdeclarative.dev}/bin/qmlimportscanner"'';
+  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/qtwebengine.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix
index 729c5f388f99..03247487749a 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebengine.nix
@@ -15,21 +15,22 @@
 , pipewire_0_2
 , enableProprietaryCodecs ? true
 , gn
-, cups, darwin, openbsm, runCommand, xcbuild, writeScriptBin
+, cctools, libobjc, libunwind, sandbox, xnu
+, ApplicationServices, AVFoundation, Foundation, ForceFeedback, GameController, AppKit
+, ImageCaptureCore, CoreBluetooth, IOBluetooth, CoreWLAN, Quartz, Cocoa, LocalAuthentication
+, cups, openbsm, runCommand, xcbuild, writeScriptBin
 , ffmpeg ? null
 , lib, stdenv, fetchpatch
 , version ? null
 , qtCompatVersion
 }:
 
-with lib;
-
 qtModule {
   pname = "qtwebengine";
   qtInputs = [ qtdeclarative qtquickcontrols qtlocation qtwebchannel ];
   nativeBuildInputs = [
     bison coreutils flex git gperf ninja pkg-config python2 which gn nodejs
-  ] ++ optional stdenv.isDarwin xcbuild;
+  ] ++ lib.optional stdenv.isDarwin xcbuild;
   doCheck = true;
   outputs = [ "bin" "dev" "out" ];
 
@@ -42,66 +43,65 @@ qtModule {
   # which cannot be set at the same time as -Wformat-security
   hardeningDisable = [ "format" ];
 
-  postPatch =
-    ''
-      # Patch Chromium build tools
-      (
-        cd src/3rdparty/chromium;
-
-        # Manually fix unsupported shebangs
-        substituteInPlace third_party/harfbuzz-ng/src/src/update-unicode-tables.make \
-          --replace "/usr/bin/env -S make -f" "/usr/bin/make -f" || true
-
-        patchShebangs .
-      )
-    ''
-    # 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 (
-    (if (lib.versionAtLeast qtCompatVersion "5.14") then ''
-      substituteInPlace src/buildtools/config/mac_osx.pri \
-        --replace 'QMAKE_CLANG_DIR = "/usr"' 'QMAKE_CLANG_DIR = "${stdenv.cc}"'
-    '' else ''
-      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
-    + ''
-      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
-    + (if (lib.versionAtLeast qtCompatVersion "5.14") then ''
-    substituteInPlace src/3rdparty/chromium/base/mac/mach_port_rendezvous.cc \
-      --replace "audit_token_to_pid(request.trailer.msgh_audit)" "request.trailer.msgh_audit.val[5]"
-    substituteInPlace src/3rdparty/chromium/third_party/crashpad/crashpad/util/mach/mach_message.cc \
-      --replace "audit_token_to_pid(audit_trailer->msgh_audit)" "audit_trailer->msgh_audit.val[5]"
-    '' else ''
-    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]"
-    ''));
+  postPatch = ''
+    # Patch Chromium build tools
+    (
+      cd src/3rdparty/chromium;
+
+      # Manually fix unsupported shebangs
+      substituteInPlace third_party/harfbuzz-ng/src/src/update-unicode-tables.make \
+        --replace "/usr/bin/env -S make -f" "/usr/bin/make -f" || true
+
+      # TODO: be more precise
+      patchShebangs .
+    )
+  ''
+  # 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`.
+  + lib.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
+  + lib.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
+  '' + lib.optionalString stdenv.isDarwin (
+  (if (lib.versionAtLeast qtCompatVersion "5.14") then ''
+    substituteInPlace src/buildtools/config/mac_osx.pri \
+      --replace 'QMAKE_CLANG_DIR = "/usr"' 'QMAKE_CLANG_DIR = "${stdenv.cc}"'
+  '' else ''
+    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
+  + ''
+    substituteInPlace src/3rdparty/chromium/third_party/crashpad/crashpad/util/BUILD.gn \
+      --replace '$sysroot/usr' "${xnu}"
+  ''
+  # Apple has some secret stuff they don't share with OpenBSM
+  + (if (lib.versionAtLeast qtCompatVersion "5.14") then ''
+  substituteInPlace src/3rdparty/chromium/base/mac/mach_port_rendezvous.cc \
+    --replace "audit_token_to_pid(request.trailer.msgh_audit)" "request.trailer.msgh_audit.val[5]"
+  substituteInPlace src/3rdparty/chromium/third_party/crashpad/crashpad/util/mach/mach_message.cc \
+    --replace "audit_token_to_pid(audit_trailer->msgh_audit)" "audit_trailer->msgh_audit.val[5]"
+  '' else ''
+  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]"
+  ''));
 
   NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isGNU [
     # with gcc8, -Wclass-memaccess became part of -Wall and this exceeds the logging limit
@@ -134,8 +134,8 @@ qtModule {
   '';
 
   qmakeFlags = [ "--" "-system-ffmpeg" ]
-    ++ optional (stdenv.isLinux && (lib.versionAtLeast qtCompatVersion "5.15")) "-webengine-webrtc-pipewire"
-    ++ optional enableProprietaryCodecs "-proprietary-codecs";
+    ++ lib.optional (stdenv.isLinux && (lib.versionAtLeast qtCompatVersion "5.15")) "-webengine-webrtc-pipewire"
+    ++ lib.optional enableProprietaryCodecs "-proprietary-codecs";
 
   propagatedBuildInputs = [
     # Image formats
@@ -152,7 +152,7 @@ qtModule {
 
     libevent
     ffmpeg
-  ] ++ optionals (!stdenv.isDarwin) [
+  ] ++ lib.optionals (!stdenv.isDarwin) [
     dbus zlib minizip snappy nss protobuf jsoncpp
 
     # Audio formats
@@ -166,16 +166,16 @@ qtModule {
 
     # X11 libs
     xorg.xrandr libXScrnSaver libXcursor libXrandr xorg.libpciaccess libXtst
-    xorg.libXcomposite xorg.libXdamage libdrm
+    xorg.libXcomposite xorg.libXdamage libdrm xorg.libxkbfile
 
-  ] ++ optionals (stdenv.isLinux && (lib.versionAtLeast qtCompatVersion "5.15")) [
+  ] ++ lib.optionals (stdenv.isLinux && (lib.versionAtLeast qtCompatVersion "5.15")) [
     # Pipewire
     pipewire_0_2
   ]
 
   # 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; [
+  ++ lib.optionals stdenv.isDarwin [
     libobjc
     cctools
 
@@ -196,11 +196,11 @@ qtModule {
 
     openbsm
     libunwind
-  ]);
+  ];
 
-  buildInputs = optionals stdenv.isDarwin (with darwin; [
+  buildInputs = lib.optionals stdenv.isDarwin [
     cups
-    apple_sdk.libs.sandbox
+    sandbox
 
     # `sw_vers` is used by `src/3rdparty/chromium/build/config/mac/sdk_info.py`
     # to get some information about the host platform.
@@ -216,11 +216,10 @@ qtModule {
         shift
       done
     '')
-  ]);
+  ];
 
   dontUseNinjaBuild = true;
   dontUseNinjaInstall = true;
-  dontUseXcbuild = true;
 
   postInstall = lib.optionalString stdenv.isLinux ''
     cat > $out/libexec/qt.conf <<EOF
@@ -241,5 +240,4 @@ qtModule {
     # This build takes a long time; particularly on slow architectures
     timeout = 24 * 3600;
   };
-
 }
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix
index e2dd0d4b19c7..dc9f5ccb9eb2 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebkit.nix
@@ -3,15 +3,15 @@
 , fontconfig, libwebp, libxml2, libxslt
 , sqlite, systemd, glib, gst_all_1, cmake
 , bison, flex, gdb, gperf, perl, pkg-config, python2, ruby
-, darwin
+, ICU, OpenGL
 }:
 
 let
-  inherit (lib) optional optionals getDev getLib;
   hyphen = stdenv.mkDerivation rec {
-    name = "hyphen-2.8.8";
+    pname = "hyphen";
+    version = "2.8.8";
     src = fetchurl {
-      url = "http://dev-www.libreoffice.org/src/5ade6ae2a99bc1e9e57031ca88d36dad-${name}.tar.gz";
+      url = "http://dev-www.libreoffice.org/src/5ade6ae2a99bc1e9e57031ca88d36dad-hyphen-${version}.tar.gz";
       sha256 = "304636d4eccd81a14b6914d07b84c79ebb815288c76fe027b9ebff6ff24d5705";
     };
     postPatch = ''
@@ -24,19 +24,19 @@ in
 qtModule {
   pname = "qtwebkit";
   qtInputs = [ qtbase qtdeclarative qtlocation qtsensors ]
-    ++ optional (stdenv.isDarwin && lib.versionAtLeast qtbase.version "5.9.0") qtmultimedia
-    ++ optional usingAnnulenWebkitFork qtwebchannel;
+    ++ lib.optional (stdenv.isDarwin && lib.versionAtLeast qtbase.version "5.9.0") qtmultimedia
+    ++ lib.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;
+    ++ lib.optionals stdenv.isDarwin [ ICU OpenGL ]
+    ++ lib.optional usingAnnulenWebkitFork hyphen;
   nativeBuildInputs = [
     bison flex gdb gperf perl pkg-config python2 ruby
-  ] ++ optional usingAnnulenWebkitFork cmake;
+  ] ++ lib.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"
+  cmakeFlags = lib.optionals usingAnnulenWebkitFork ([ "-DPORT=Qt" ]
+    ++ lib.optionals stdenv.isDarwin [
+      "-DQt5Multimedia_DIR=${lib.getDev qtmultimedia}/lib/cmake/Qt5Multimedia"
+      "-DQt5MultimediaWidgets_DIR=${lib.getDev qtmultimedia}/lib/cmake/Qt5MultimediaWidgets"
       "-DMACOS_FORCE_SYSTEM_XML_LIBRARIES=OFF"
     ]);
 
@@ -50,19 +50,22 @@ qtModule {
   '';
 
   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"
-    ++ optional (!stdenv.isDarwin) ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
+    # 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
+  ++ lib.optional stdenv.cc.isGNU "-Wno-class-memaccess"
+  # with clang this warning blows the log over Hydra's limit
+  ++ lib.optional stdenv.isDarwin "-Wno-inconsistent-missing-override"
+  ++ lib.optional (!stdenv.isDarwin) ''-DNIXPKGS_LIBUDEV="${lib.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)" '';
+  preFixup = ''
+    rm -rf "$(pwd)"
+    mkdir "$(pwd)"
+  '';
 
   meta = {
     maintainers = with lib.maintainers; [ abbradar periklis ];
diff --git a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix
index 1df8ef866389..14f7937a2e24 100644
--- a/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix
+++ b/nixpkgs/pkgs/development/libraries/qt-5/modules/qtwebview.nix
@@ -1,14 +1,12 @@
-{ darwin, lib, stdenv, qtModule, qtdeclarative, qtwebengine }:
-
-with lib;
+{ lib, stdenv, qtModule, qtdeclarative, qtwebengine, CoreFoundation, WebKit }:
 
 qtModule {
   pname = "qtwebview";
   qtInputs = [ qtdeclarative qtwebengine ];
-  buildInputs = optional (stdenv.isDarwin) [
-    darwin.apple_sdk.frameworks.CoreFoundation
-    darwin.apple_sdk.frameworks.WebKit
+  buildInputs = lib.optional stdenv.isDarwin [
+    CoreFoundation
+    WebKit
   ];
   outputs = [ "out" "dev" "bin" ];
-  NIX_LDFLAGS = optionalString stdenv.isDarwin "-framework CoreFoundation -framework WebKit";
+  NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-framework CoreFoundation -framework WebKit";
 }