summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/languages-frameworks/qt.section.md114
-rw-r--r--pkgs/applications/audio/csound/csound-qt/default.nix2
-rw-r--r--pkgs/applications/audio/keyfinder/default.nix2
-rw-r--r--pkgs/applications/audio/kmetronome/default.nix2
-rw-r--r--pkgs/applications/audio/nootka/default.nix2
-rw-r--r--pkgs/applications/audio/nootka/unstable.nix2
-rw-r--r--pkgs/applications/audio/ocenaudio/default.nix1
-rw-r--r--pkgs/applications/audio/playbar2/default.nix2
-rw-r--r--pkgs/applications/audio/seq66/default.nix2
-rw-r--r--pkgs/applications/audio/spectmorph/default.nix2
-rw-r--r--pkgs/applications/blockchains/bitcoin-classic.nix2
-rw-r--r--pkgs/applications/display-managers/lightdm/default.nix2
-rw-r--r--pkgs/applications/editors/code-browser/default.nix3
-rw-r--r--pkgs/applications/editors/kdevelop5/kdev-php.nix2
-rw-r--r--pkgs/applications/editors/kdevelop5/kdev-python.nix2
-rw-r--r--pkgs/applications/editors/kdevelop5/kdevelop-pg-qt.nix2
-rw-r--r--pkgs/applications/editors/qxmledit/default.nix2
-rw-r--r--pkgs/applications/misc/gpsbabel/default.nix2
-rw-r--r--pkgs/applications/misc/gpsbabel/gui.nix2
-rw-r--r--pkgs/applications/misc/plasma-applet-volumewin7mixer/default.nix2
-rw-r--r--pkgs/applications/misc/redis-desktop-manager/default.nix1
-rw-r--r--pkgs/applications/misc/redshift-plasma-applet/default.nix2
-rw-r--r--pkgs/applications/misc/subsurface/default.nix2
-rw-r--r--pkgs/applications/networking/irc/communi/default.nix2
-rw-r--r--pkgs/applications/office/cb2bib/default.nix2
-rw-r--r--pkgs/applications/radio/gnuradio/default.nix2
-rw-r--r--pkgs/applications/radio/gnuradio/shared.nix1
-rw-r--r--pkgs/applications/radio/unixcw/default.nix2
-rw-r--r--pkgs/applications/science/logic/mcrl2/default.nix2
-rw-r--r--pkgs/applications/version-management/bcompare/default.nix1
-rw-r--r--pkgs/applications/version-management/git-and-tools/svn-all-fast-export/default.nix2
-rw-r--r--pkgs/applications/video/obs-studio/obs-ndi.nix2
-rw-r--r--pkgs/applications/video/obs-studio/v4l2sink.nix2
-rw-r--r--pkgs/applications/video/openshot-qt/libopenshot.nix2
-rw-r--r--pkgs/data/icons/maia-icon-theme/default.nix2
-rw-r--r--pkgs/development/interpreters/supercollider/default.nix2
-rw-r--r--pkgs/development/libraries/aqbanking/gwenhywfar.nix2
-rw-r--r--pkgs/development/libraries/audio/suil/default.nix2
-rw-r--r--pkgs/development/libraries/dxflib/default.nix1
-rw-r--r--pkgs/development/libraries/g2o/default.nix2
-rw-r--r--pkgs/development/libraries/gecode/default.nix1
-rw-r--r--pkgs/development/libraries/gpgme/default.nix2
-rw-r--r--pkgs/development/libraries/kpmcore/default.nix2
-rw-r--r--pkgs/development/libraries/libcommuni/default.nix2
-rw-r--r--pkgs/development/libraries/libdbusmenu-qt/default.nix2
-rw-r--r--pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix2
-rw-r--r--pkgs/development/libraries/libkeyfinder/default.nix2
-rw-r--r--pkgs/development/libraries/libktorrent/default.nix2
-rw-r--r--pkgs/development/libraries/liblastfm/default.nix2
-rw-r--r--pkgs/development/libraries/libqglviewer/default.nix2
-rw-r--r--pkgs/development/libraries/opencsg/default.nix2
-rw-r--r--pkgs/development/libraries/phonon/backends/gstreamer.nix2
-rw-r--r--pkgs/development/libraries/phonon/backends/vlc.nix2
-rw-r--r--pkgs/development/libraries/phonon/default.nix2
-rw-r--r--pkgs/development/libraries/polkit-qt-1/qt-5.nix2
-rw-r--r--pkgs/development/libraries/poppler/0.61.nix2
-rw-r--r--pkgs/development/libraries/poppler/default.nix2
-rw-r--r--pkgs/development/libraries/pyotherside/default.nix2
-rw-r--r--pkgs/development/libraries/python-qt/default.nix2
-rw-r--r--pkgs/development/libraries/qca-qt5/default.nix2
-rw-r--r--pkgs/development/libraries/qmlbox2d/default.nix1
-rw-r--r--pkgs/development/libraries/qmltermwidget/default.nix2
-rw-r--r--pkgs/development/libraries/qoauth/default.nix2
-rw-r--r--pkgs/development/libraries/qscintilla/default.nix1
-rw-r--r--pkgs/development/libraries/qt-5/5.12/default.nix3
-rw-r--r--pkgs/development/libraries/qt-5/5.14/default.nix3
-rw-r--r--pkgs/development/libraries/qt-5/5.15/default.nix1
-rw-r--r--pkgs/development/libraries/qt-5/hooks/qmake-hook.sh12
-rw-r--r--pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh46
-rw-r--r--pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh5
-rw-r--r--pkgs/development/libraries/qt-5/mkDerivation.nix15
-rw-r--r--pkgs/development/libraries/qt-5/modules/qtbase.nix6
-rw-r--r--pkgs/development/libraries/qt-5/qtModule.nix2
-rw-r--r--pkgs/development/libraries/qtinstaller/default.nix1
-rw-r--r--pkgs/development/libraries/qtkeychain/default.nix2
-rw-r--r--pkgs/development/libraries/qtpbfimageplugin/default.nix2
-rw-r--r--pkgs/development/libraries/qtutilities/default.nix2
-rw-r--r--pkgs/development/libraries/qtwebkit-plugins/default.nix2
-rw-r--r--pkgs/development/libraries/quazip/default.nix2
-rw-r--r--pkgs/development/libraries/qwt/6.nix2
-rw-r--r--pkgs/development/libraries/soqt/default.nix2
-rw-r--r--pkgs/development/libraries/telepathy/qt/default.nix2
-rw-r--r--pkgs/development/libraries/vtk/generic.nix2
-rw-r--r--pkgs/development/python-modules/ovito/default.nix2
-rw-r--r--pkgs/development/python-modules/pivy/default.nix3
-rw-r--r--pkgs/development/python-modules/poppler-qt5/default.nix2
-rw-r--r--pkgs/development/python-modules/pyqt/5.x.nix2
-rw-r--r--pkgs/development/python-modules/pyqtwebengine/default.nix2
-rw-r--r--pkgs/development/python-modules/pyside/default.nix2
-rw-r--r--pkgs/development/python-modules/pyside2-tools/default.nix2
-rw-r--r--pkgs/development/python-modules/pyside2/default.nix2
-rw-r--r--pkgs/development/python-modules/qscintilla-qt5/default.nix2
-rw-r--r--pkgs/development/python-modules/roboschool/default.nix2
-rw-r--r--pkgs/development/python-modules/shiboken2/default.nix2
-rw-r--r--pkgs/development/tools/analysis/panopticon/default.nix2
-rw-r--r--pkgs/development/tools/analysis/qcachegrind/default.nix2
-rw-r--r--pkgs/development/tools/build-managers/cmake/default.nix5
-rw-r--r--pkgs/development/tools/build-managers/qbs/default.nix2
-rw-r--r--pkgs/development/tools/minizinc/ide.nix1
-rw-r--r--pkgs/development/tools/misc/kdbg/default.nix2
-rw-r--r--pkgs/development/tools/phantomjs2/default.nix2
-rw-r--r--pkgs/development/tools/rgp/default.nix2
-rw-r--r--pkgs/games/dwarf-fortress/dwarf-therapist/default.nix2
-rw-r--r--pkgs/games/freeciv/default.nix2
-rw-r--r--pkgs/games/leela-zero/default.nix2
-rw-r--r--pkgs/games/openmw/default.nix2
-rw-r--r--pkgs/games/openmw/tes3mp.nix2
-rw-r--r--pkgs/misc/emulators/citra/default.nix2
-rw-r--r--pkgs/os-specific/linux/akvcam/default.nix1
-rw-r--r--pkgs/servers/web-apps/virtlyst/default.nix2
-rw-r--r--pkgs/tools/inputmethods/fcitx-engines/fcitx-libpinyin/default.nix2
-rw-r--r--pkgs/tools/inputmethods/hime/default.nix2
-rw-r--r--pkgs/tools/misc/ttfautohint/default.nix2
-rw-r--r--pkgs/tools/networking/spoofer/default.nix2
-rw-r--r--pkgs/tools/package-management/packagekit/qt.nix2
-rw-r--r--pkgs/tools/security/proxmark3/default.nix2
116 files changed, 343 insertions, 70 deletions
diff --git a/doc/languages-frameworks/qt.section.md b/doc/languages-frameworks/qt.section.md
index 5dd415852c1..b8b438e8858 100644
--- a/doc/languages-frameworks/qt.section.md
+++ b/doc/languages-frameworks/qt.section.md
@@ -1,77 +1,88 @@
 # Qt {#sec-language-qt}
 
-This section describes the differences between Nix expressions for Qt libraries and applications and Nix expressions for other C++ software. Some knowledge of the latter is assumed.
+Writing Nix expressions for Qt libraries and applications is largely similar as for other C++ software.
+This section assumes some knowledge of the latter.
+There are two problems that the Nixpkgs Qt infrastructure addresses,
+which are not shared by other C++ software:
 
-There are primarily two problems which the Qt infrastructure is designed to address: ensuring consistent versioning of all dependencies and finding dependencies at runtime.
+1.  There are usually multiple supported versions of Qt in Nixpkgs.
+    All of a package's dependencies must be built with the same version of Qt.
+    This is similar to the version constraints imposed on interpreted languages like Python.
+2.  Qt makes extensive use of runtime dependency detection.
+    Runtime dependencies are made into build dependencies through wrappers.
 
 ## Nix expression for a Qt package (default.nix) {#qt-default-nix}
 
 ```{=docbook}
 <programlisting>
-{ mkDerivation, qtbase }: <co xml:id='qt-default-nix-co-1' />
+{ stdenv, lib, qtbase, wrapQtAppsHook }: <co xml:id='qt-default-nix-co-1' />
 
-mkDerivation { <co xml:id='qt-default-nix-co-2' />
+stdenv.mkDerivation {
   pname = "myapp";
   version = "1.0";
 
-  buildInputs = [ qtbase ]; <co xml:id='qt-default-nix-co-3' />
+  buildInputs = [ qtbase ];
+  nativeBuildInputs = [ wrapQtAppsHook ]; <co xml:id'qt-default-nix-co-2' />
 }
 </programlisting>
 
  <calloutlist>
   <callout arearefs='qt-default-nix-co-1'>
    <para>
-    Import <literal>mkDerivation</literal> and Qt (such as <literal>qtbase</literal> modules directly. <emphasis>Do not</emphasis> import Qt package sets; the Qt versions of dependencies may not be coherent, causing build and runtime failures.
+    Import Qt modules directly, that is: <literal>qtbase</literal>, <literal>qtdeclarative</literal>, etc.
+    <emphasis>Do not</emphasis> import Qt package sets such as <literal>qt5</literal>
+    because the Qt versions of dependencies may not be coherent, causing build and runtime failures.
    </para>
   </callout>
-  <callout arearefs='qt-default-nix-co-2'>
-   <para>
-    Use <literal>mkDerivation</literal> instead of <literal>stdenv.mkDerivation</literal>. <literal>mkDerivation</literal> is a wrapper around <literal>stdenv.mkDerivation</literal> which applies some Qt-specific settings. This deriver accepts the same arguments as <literal>stdenv.mkDerivation</literal>; refer to <xref linkend='chap-stdenv' /> for details.
-   </para>
-   <para>
-    To use another deriver instead of <literal>stdenv.mkDerivation</literal>, use <literal>mkDerivationWith</literal>:
-<programlisting>
-mkDerivationWith myDeriver {
-  # ...
-}
-</programlisting>
-    If you cannot use <literal>mkDerivationWith</literal>, please refer to <xref linkend='qt-runtime-dependencies' />.
-   </para>
-  </callout>
-  <callout arearefs='qt-default-nix-co-3'>
-   <para>
-    <literal>mkDerivation</literal> accepts the same arguments as <literal>stdenv.mkDerivation</literal>, such as <literal>buildInputs</literal>.
-   </para>
+  <callout arearefs="qt-default-nix-co-2'>
+    <para>
+      All Qt packages must include <literal>wrapQtAppsHook</literal> in
+      <literal>nativeBuildInputs</literal>, or you must explicitly set
+      <literal>dontWrapQtApps</literal>.
+    </para>
   </callout>
  </calloutlist>
 ```
 
 ## Locating runtime dependencies {#qt-runtime-dependencies}
-Qt applications need to be wrapped to find runtime dependencies. If you cannot use `mkDerivation` or `mkDerivationWith` above, include `wrapQtAppsHook` in `nativeBuildInputs`:
+
+Qt applications must be wrapped to find runtime dependencies.
+Include `wrapQtAppsHook` in `nativeBuildInputs`:
 
 ```nix
+{ stdenv, wrapQtAppsHook }:
+
 stdenv.mkDerivation {
   # ...
-
   nativeBuildInputs = [ wrapQtAppsHook ];
 }
 ```
-Entries added to `qtWrapperArgs` are used to modify the wrappers created by `wrapQtAppsHook`. The entries are passed as arguments to [wrapProgram executable makeWrapperArgs](#fun-wrapProgram).
+
+Add entries to `qtWrapperArgs` are to modify the wrappers created by
+`wrapQtAppsHook`:
 
 ```nix
-mkDerivation {
-  # ...
+{ stdenv, wrapQtAppsHook }:
 
+stdenv.mkDerivation {
+  # ...
+  nativeBuildInputs = [ wrapQtAppsHook ];
   qtWrapperArgs = [ ''--prefix PATH : /path/to/bin'' ];
 }
 ```
 
-Set `dontWrapQtApps` to stop applications from being wrapped automatically. It is required to wrap applications manually with `wrapQtApp`, using the syntax of [wrapProgram executable makeWrapperArgs](#fun-wrapProgram):
+The entries are passed as arguments to [wrapProgram](#fun-wrapProgram).
+
+Set `dontWrapQtApps` to stop applications from being wrapped automatically.
+Wrap programs manually with `wrapQtApp`, using the syntax of
+[wrapProgram](#fun-wrapProgram):
 
 ```nix
-mkDerivation {
-  # ...
+{ stdenv, lib, wrapQtAppsHook }:
 
+stdenv.mkDerivation {
+  # ...
+  nativeBuildInputs = [ wrapQtAppsHook ];
   dontWrapQtApps = true;
   preFixup = ''
       wrapQtApp "$out/bin/myapp" --prefix PATH : /path/to/bin
@@ -79,21 +90,16 @@ mkDerivation {
 }
 ```
 
-> Note: `wrapQtAppsHook` ignores files that are non-ELF executables. This means that scripts won't be automatically wrapped so you'll need to manually wrap them as previously mentioned. An example of when you'd always need to do this is with Python applications that use PyQT.
+::: note
+`wrapQtAppsHook` ignores files that are non-ELF executables.
+This means that scripts won't be automatically wrapped so you'll need to manually wrap them as previously mentioned.
+An example of when you'd always need to do this is with Python applications that use PyQt.
+:::
 
-Libraries are built with every available version of Qt. Use the `meta.broken` attribute to disable the package for unsupported Qt versions:
-
-```nix
-mkDerivation {
-  # ...
-
-  # Disable this library with Qt &lt; 5.9.0
-  meta.broken = builtins.compareVersions qtbase.version "5.9.0" &lt; 0;
-}
-```
 ## Adding a library to Nixpkgs
-Qt libraries are added to `qt5-packages.nix` and are made available for every Qt
-version supported.
+Add Qt libraries to `qt5-packages.nix` to make them available for every
+supported Qt version.
+
 ### Example adding a Qt library {#qt-library-all-packages-nix}
 
 The following represents the contents of `qt5-packages.nix`.
@@ -106,9 +112,23 @@ The following represents the contents of `qt5-packages.nix`.
   # ...
 }
 ```
+
+Libraries are built with every available version of Qt.
+Use the `meta.broken` attribute to disable the package for unsupported Qt versions:
+
+```nix
+{ stdenv, lib, qtbase }:
+
+stdenv.mkDerivation {
+  # ...
+  # Disable this library with Qt &lt; 5.9.0
+  meta.broken = lib.versionOlder qtbase.version "5.9.0";
+}
+```
+
 ## Adding an application to Nixpkgs
-Applications that use Qt are also added to `qt5-packages.nix`. An alias is added
-in the top-level `all-packages.nix` pointing to the package with the desired Qt5 version.
+Add Qt applications to `qt5-packages.nix`. Add an alias to `all-packages.nix`
+to select the Qt 5 version used for the application.
 
 ### Example adding a Qt application {#qt-application-all-packages-nix}
 
diff --git a/pkgs/applications/audio/csound/csound-qt/default.nix b/pkgs/applications/audio/csound/csound-qt/default.nix
index ba9df9039f6..953a919d0c7 100644
--- a/pkgs/applications/audio/csound/csound-qt/default.nix
+++ b/pkgs/applications/audio/csound/csound-qt/default.nix
@@ -40,6 +40,8 @@ stdenv.mkDerivation rec {
                  "SHARE_DIR=${placeholder "out"}/share"
                  ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "CsoundQt is a frontend for Csound with editor, integrated help, widgets and other features";
     homepage = "https://csoundqt.github.io/";
diff --git a/pkgs/applications/audio/keyfinder/default.nix b/pkgs/applications/audio/keyfinder/default.nix
index 187d3a58b17..261a33e8c6e 100644
--- a/pkgs/applications/audio/keyfinder/default.nix
+++ b/pkgs/applications/audio/keyfinder/default.nix
@@ -21,6 +21,8 @@ stdenv.mkDerivation rec {
        --replace "\$\$[QT_INSTALL_PREFIX]" "$out"
   '';
 
+  dontWrapQtApps = true;
+
   enableParallelBuilding = true;
 
   meta = with lib; {
diff --git a/pkgs/applications/audio/kmetronome/default.nix b/pkgs/applications/audio/kmetronome/default.nix
index ca8df45e459..02353fcf4f5 100644
--- a/pkgs/applications/audio/kmetronome/default.nix
+++ b/pkgs/applications/audio/kmetronome/default.nix
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ alsaLib drumstick qtbase qtsvg ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://kmetronome.sourceforge.io/";
     description = "ALSA MIDI metronome with Qt interface";
diff --git a/pkgs/applications/audio/nootka/default.nix b/pkgs/applications/audio/nootka/default.nix
index b1b60540b8c..11424c0be18 100644
--- a/pkgs/applications/audio/nootka/default.nix
+++ b/pkgs/applications/audio/nootka/default.nix
@@ -21,6 +21,8 @@ stdenv.mkDerivation rec {
     "-DENABLE_PULSEAUDIO=ON"
   ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Application for practicing playing musical scores and ear training";
     homepage = "https://nootka.sourceforge.io/";
diff --git a/pkgs/applications/audio/nootka/unstable.nix b/pkgs/applications/audio/nootka/unstable.nix
index 1fb70c195dc..aa49daaa1e7 100644
--- a/pkgs/applications/audio/nootka/unstable.nix
+++ b/pkgs/applications/audio/nootka/unstable.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
     qtbase qtdeclarative qtquickcontrols2
   ];
 
+  dontWrapQtApps = true;
+
   cmakeFlags = [
     "-DCMAKE_INCLUDE_PATH=${libjack2}/include/jack;${libpulseaudio.dev}/include/pulse"
     "-DENABLE_JACK=ON"
diff --git a/pkgs/applications/audio/ocenaudio/default.nix b/pkgs/applications/audio/ocenaudio/default.nix
index c3ab0ffcebd..2fd1aeccd7a 100644
--- a/pkgs/applications/audio/ocenaudio/default.nix
+++ b/pkgs/applications/audio/ocenaudio/default.nix
@@ -33,6 +33,7 @@ stdenv.mkDerivation rec {
   dontUnpack = true;
   dontBuild = true;
   dontStrip = true;
+  dontWrapQtApps = true;
 
   installPhase = ''
     mkdir -p $out
diff --git a/pkgs/applications/audio/playbar2/default.nix b/pkgs/applications/audio/playbar2/default.nix
index 7545c17131f..dfbfb43e625 100644
--- a/pkgs/applications/audio/playbar2/default.nix
+++ b/pkgs/applications/audio/playbar2/default.nix
@@ -27,6 +27,8 @@ stdenv.mkDerivation rec {
     kwindowsystem
   ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Mpris2 Client for Plasma5";
     homepage = "https://github.com/audoban/PlayBar2";
diff --git a/pkgs/applications/audio/seq66/default.nix b/pkgs/applications/audio/seq66/default.nix
index 93f9e9503b9..71d70c2dd58 100644
--- a/pkgs/applications/audio/seq66/default.nix
+++ b/pkgs/applications/audio/seq66/default.nix
@@ -25,6 +25,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://github.com/ahlstromcj/seq66";
     description = "Loop based midi sequencer with Qt GUI derived from seq24 and sequencer64";
diff --git a/pkgs/applications/audio/spectmorph/default.nix b/pkgs/applications/audio/spectmorph/default.nix
index a368d62ce7d..6292d771a51 100644
--- a/pkgs/applications/audio/spectmorph/default.nix
+++ b/pkgs/applications/audio/spectmorph/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkg-config ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Allows to analyze samples of musical instruments, and to combine them (morphing) to construct hybrid sounds";
     homepage = "http://spectmorph.org";
diff --git a/pkgs/applications/blockchains/bitcoin-classic.nix b/pkgs/applications/blockchains/bitcoin-classic.nix
index 796c48a7c58..a09be816e3c 100644
--- a/pkgs/applications/blockchains/bitcoin-classic.nix
+++ b/pkgs/applications/blockchains/bitcoin-classic.nix
@@ -28,6 +28,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  dontWrapQtApps = true;
+
   meta = {
     description = "Peer-to-peer electronic cash system (Classic client)";
     longDescription= ''
diff --git a/pkgs/applications/display-managers/lightdm/default.nix b/pkgs/applications/display-managers/lightdm/default.nix
index 6a96f560ddc..be9ba0f7561 100644
--- a/pkgs/applications/display-managers/lightdm/default.nix
+++ b/pkgs/applications/display-managers/lightdm/default.nix
@@ -101,6 +101,8 @@ stdenv.mkDerivation rec {
     })
   ];
 
+  dontWrapQtApps = true;
+
   preConfigure = "NOCONFIGURE=1 ./autogen.sh";
 
   configureFlags = [
diff --git a/pkgs/applications/editors/code-browser/default.nix b/pkgs/applications/editors/code-browser/default.nix
index a4ae4a811bf..ea4398cc4a5 100644
--- a/pkgs/applications/editors/code-browser/default.nix
+++ b/pkgs/applications/editors/code-browser/default.nix
@@ -39,6 +39,9 @@ stdenv.mkDerivation rec {
   ]
   ++ lib.optionals withQt [ "UI=qt" ]
   ++ lib.optionals withGtk [ "UI=gtk" ];
+
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Folding text editor, designed to hierarchically structure any kind of text file and especially source code";
     homepage = "https://tibleiz.net/code-browser/";
diff --git a/pkgs/applications/editors/kdevelop5/kdev-php.nix b/pkgs/applications/editors/kdevelop5/kdev-php.nix
index 23c8f0698cf..44b4fd7bc19 100644
--- a/pkgs/applications/editors/kdevelop5/kdev-php.nix
+++ b/pkgs/applications/editors/kdevelop5/kdev-php.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake extra-cmake-modules ];
   buildInputs = [ kdevelop-pg-qt threadweaver ktexteditor kdevelop-unwrapped ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     maintainers = [ maintainers.aanderse ];
     platforms = platforms.linux;
diff --git a/pkgs/applications/editors/kdevelop5/kdev-python.nix b/pkgs/applications/editors/kdevelop5/kdev-python.nix
index 041c25f1728..0567ee39d7d 100644
--- a/pkgs/applications/editors/kdevelop5/kdev-python.nix
+++ b/pkgs/applications/editors/kdevelop5/kdev-python.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake extra-cmake-modules ];
   buildInputs = [ threadweaver ktexteditor kdevelop-unwrapped ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     maintainers = [ maintainers.aanderse ];
     platforms = platforms.linux;
diff --git a/pkgs/applications/editors/kdevelop5/kdevelop-pg-qt.nix b/pkgs/applications/editors/kdevelop5/kdevelop-pg-qt.nix
index cb1265735f9..e1478ef6a03 100644
--- a/pkgs/applications/editors/kdevelop5/kdevelop-pg-qt.nix
+++ b/pkgs/applications/editors/kdevelop5/kdevelop-pg-qt.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ qtbase ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     maintainers = [ maintainers.ambrop72 ];
     platforms = platforms.linux;
diff --git a/pkgs/applications/editors/qxmledit/default.nix b/pkgs/applications/editors/qxmledit/default.nix
index fa4e73a3768..d2aea1344da 100644
--- a/pkgs/applications/editors/qxmledit/default.nix
+++ b/pkgs/applications/editors/qxmledit/default.nix
@@ -19,6 +19,8 @@ stdenv.mkDerivation rec {
     export QXMLEDIT_INST_DOC_DIR="$doc"
   '';
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Simple XML editor based on qt libraries" ;
     homepage = "https://sourceforge.net/projects/qxmledit";
diff --git a/pkgs/applications/misc/gpsbabel/default.nix b/pkgs/applications/misc/gpsbabel/default.nix
index f043aa66947..85c7fbae789 100644
--- a/pkgs/applications/misc/gpsbabel/default.nix
+++ b/pkgs/applications/misc/gpsbabel/default.nix
@@ -38,6 +38,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  dontWrapQtApps = true;
+
   doCheck = true;
   preCheck = ''
     patchShebangs testo
diff --git a/pkgs/applications/misc/gpsbabel/gui.nix b/pkgs/applications/misc/gpsbabel/gui.nix
index 4025b313128..8501b7c0875 100644
--- a/pkgs/applications/misc/gpsbabel/gui.nix
+++ b/pkgs/applications/misc/gpsbabel/gui.nix
@@ -10,6 +10,8 @@ mkDerivation {
   nativeBuildInputs = [ qmake qttools ];
   buildInputs = [ qtwebkit ];
 
+  dontWrapQtApps = true;
+
   postPatch = ''
     substituteInPlace mainwindow.cc \
       --replace "QApplication::applicationDirPath() + \"/" "\"" \
diff --git a/pkgs/applications/misc/plasma-applet-volumewin7mixer/default.nix b/pkgs/applications/misc/plasma-applet-volumewin7mixer/default.nix
index 57ec820a090..bb365ecfefd 100644
--- a/pkgs/applications/misc/plasma-applet-volumewin7mixer/default.nix
+++ b/pkgs/applications/misc/plasma-applet-volumewin7mixer/default.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake extra-cmake-modules ];
   buildInputs = [ plasma-framework kwindowsystem plasma-pa ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "A fork of the default volume plasmoid with a Windows 7 theme (vertical sliders)";
     homepage = "https://github.com/Zren/plasma-applet-volumewin7mixer";
diff --git a/pkgs/applications/misc/redis-desktop-manager/default.nix b/pkgs/applications/misc/redis-desktop-manager/default.nix
index 844fd19e22c..c185dc13729 100644
--- a/pkgs/applications/misc/redis-desktop-manager/default.nix
+++ b/pkgs/applications/misc/redis-desktop-manager/default.nix
@@ -32,6 +32,7 @@ stdenv.mkDerivation rec {
   ];
 
   dontUseQmakeConfigure = true;
+  dontWrapQtApps = true;
 
   NIX_CFLAGS_COMPILE = [ "-Wno-error=deprecated" ];
 
diff --git a/pkgs/applications/misc/redshift-plasma-applet/default.nix b/pkgs/applications/misc/redshift-plasma-applet/default.nix
index fa5ee0c753a..b8d25f0db1d 100644
--- a/pkgs/applications/misc/redshift-plasma-applet/default.nix
+++ b/pkgs/applications/misc/redshift-plasma-applet/default.nix
@@ -35,6 +35,8 @@ stdenv.mkDerivation {
     kwindowsystem
   ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "KDE Plasma 5 widget for controlling Redshift";
     homepage = "https://github.com/kotelnik/plasma-applet-redshift-control";
diff --git a/pkgs/applications/misc/subsurface/default.nix b/pkgs/applications/misc/subsurface/default.nix
index 51d015c6e41..98392ae27f2 100644
--- a/pkgs/applications/misc/subsurface/default.nix
+++ b/pkgs/applications/misc/subsurface/default.nix
@@ -52,6 +52,8 @@ let
 
     buildInputs = [ qtbase qtlocation libXcomposite ];
 
+    dontWrapQtApps = true;
+
     pluginsSubdir = "lib/qt-${qtbase.qtCompatVersion}/plugins";
 
     installPhase = ''
diff --git a/pkgs/applications/networking/irc/communi/default.nix b/pkgs/applications/networking/irc/communi/default.nix
index 030737848a9..0d0144fbf91 100644
--- a/pkgs/applications/networking/irc/communi/default.nix
+++ b/pkgs/applications/networking/irc/communi/default.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  dontWrapQtApps = true;
+
   preConfigure = ''
     export QMAKEFEATURES=${libcommuni}/features
   '';
diff --git a/pkgs/applications/office/cb2bib/default.nix b/pkgs/applications/office/cb2bib/default.nix
index e57d490f05c..b0a0fded80a 100644
--- a/pkgs/applications/office/cb2bib/default.nix
+++ b/pkgs/applications/office/cb2bib/default.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
     runHook postConfigure
   '';
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Rapidly extract unformatted, or unstandardized bibliographic references from email alerts, journal Web pages and PDF files";
     homepage = "http://www.molspaces.com/d_cb2bib-overview.php";
diff --git a/pkgs/applications/radio/gnuradio/default.nix b/pkgs/applications/radio/gnuradio/default.nix
index 9223f160db3..9bc1511968b 100644
--- a/pkgs/applications/radio/gnuradio/default.nix
+++ b/pkgs/applications/radio/gnuradio/default.nix
@@ -218,6 +218,7 @@ let
     passthru
     doCheck
     dontWrapPythonPrograms
+    dontWrapQtApps
     meta
   ;
   cmakeFlags = shared.cmakeFlags
@@ -283,6 +284,7 @@ stdenv.mkDerivation rec {
     passthru
     doCheck
     dontWrapPythonPrograms
+    dontWrapQtApps
     meta
   ;
 }
diff --git a/pkgs/applications/radio/gnuradio/shared.nix b/pkgs/applications/radio/gnuradio/shared.nix
index 1d5d84f4649..9b354d5b960 100644
--- a/pkgs/applications/radio/gnuradio/shared.nix
+++ b/pkgs/applications/radio/gnuradio/shared.nix
@@ -109,6 +109,7 @@ rec {
   };
   # Wrapping is done with an external wrapper
   dontWrapPythonPrograms = true;
+  dontWrapQtApps = true;
   # Tests should succeed, but it's hard to get LD_LIBRARY_PATH right in order
   # for it to happen.
   doCheck = false;
diff --git a/pkgs/applications/radio/unixcw/default.nix b/pkgs/applications/radio/unixcw/default.nix
index 5e299cc5984..cdb84670c61 100644
--- a/pkgs/applications/radio/unixcw/default.nix
+++ b/pkgs/applications/radio/unixcw/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
   buildInputs = [libpulseaudio alsaLib pkg-config qt5.qtbase];
   CFLAGS   ="-lasound -lpulse-simple";
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "sound characters as Morse code on the soundcard or console speaker";
     longDescription = ''
diff --git a/pkgs/applications/science/logic/mcrl2/default.nix b/pkgs/applications/science/logic/mcrl2/default.nix
index 56898f163b9..da9231efb81 100644
--- a/pkgs/applications/science/logic/mcrl2/default.nix
+++ b/pkgs/applications/science/logic/mcrl2/default.nix
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ libGLU libGL qt5.qtbase boost ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "A toolset for model-checking concurrent systems and protocols";
     longDescription = ''
diff --git a/pkgs/applications/version-management/bcompare/default.nix b/pkgs/applications/version-management/bcompare/default.nix
index 61ea5a9ddd4..d90de1a526f 100644
--- a/pkgs/applications/version-management/bcompare/default.nix
+++ b/pkgs/applications/version-management/bcompare/default.nix
@@ -48,6 +48,7 @@ stdenv.mkDerivation rec {
 
   dontBuild = true;
   dontConfigure = true;
+  dontWrapQtApps = true;
 
   meta = with lib; {
     description = "GUI application that allows to quickly and easily compare files and folders";
diff --git a/pkgs/applications/version-management/git-and-tools/svn-all-fast-export/default.nix b/pkgs/applications/version-management/git-and-tools/svn-all-fast-export/default.nix
index 8c73c00f00c..a40e959a50a 100644
--- a/pkgs/applications/version-management/git-and-tools/svn-all-fast-export/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/svn-all-fast-export/default.nix
@@ -25,6 +25,8 @@ stdenv.mkDerivation {
 
   NIX_LDFLAGS = "-lsvn_fs-1";
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://github.com/svn-all-fast-export/svn2git";
     description = "A fast-import based converter for an svn repo to git repos";
diff --git a/pkgs/applications/video/obs-studio/obs-ndi.nix b/pkgs/applications/video/obs-studio/obs-ndi.nix
index d9867b1bb2d..b35398d65b5 100644
--- a/pkgs/applications/video/obs-studio/obs-ndi.nix
+++ b/pkgs/applications/video/obs-studio/obs-ndi.nix
@@ -31,6 +31,8 @@ stdenv.mkDerivation rec {
     "-DCMAKE_CXX_FLAGS=-I${obs-studio.src}/UI/obs-frontend-api"
   ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Network A/V plugin for OBS Studio";
     homepage = "https://github.com/Palakis/obs-ndi";
diff --git a/pkgs/applications/video/obs-studio/v4l2sink.nix b/pkgs/applications/video/obs-studio/v4l2sink.nix
index eb8e4186882..2716120682e 100644
--- a/pkgs/applications/video/obs-studio/v4l2sink.nix
+++ b/pkgs/applications/video/obs-studio/v4l2sink.nix
@@ -21,6 +21,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ qtbase obs-studio ];
 
+  dontWrapQtApps = true;
+
   patches = [
     # Fixes the segfault when stopping the plugin
     (fetchpatch {
diff --git a/pkgs/applications/video/openshot-qt/libopenshot.nix b/pkgs/applications/video/openshot-qt/libopenshot.nix
index 2070d05d980..169bd33b709 100644
--- a/pkgs/applications/video/openshot-qt/libopenshot.nix
+++ b/pkgs/applications/video/openshot-qt/libopenshot.nix
@@ -41,6 +41,8 @@ stdenv.mkDerivation rec {
     ++ optional stdenv.isDarwin llvmPackages.openmp
   ;
 
+  dontWrapQtApps = true;
+
   LIBOPENSHOT_AUDIO_DIR = libopenshot-audio;
   "UNITTEST++_INCLUDE_DIR" = "${unittest-cpp}/include/UnitTest++";
 
diff --git a/pkgs/data/icons/maia-icon-theme/default.nix b/pkgs/data/icons/maia-icon-theme/default.nix
index 75c7cd58007..32365b70184 100644
--- a/pkgs/data/icons/maia-icon-theme/default.nix
+++ b/pkgs/data/icons/maia-icon-theme/default.nix
@@ -35,6 +35,8 @@ stdenv.mkDerivation {
 
   dontDropIconThemeCache = true;
 
+  dontWrapQtApps = true;
+
   postInstall = ''
     for theme in $out/share/icons/*; do
       gtk-update-icon-cache $theme
diff --git a/pkgs/development/interpreters/supercollider/default.nix b/pkgs/development/interpreters/supercollider/default.nix
index f80e18c7bb9..a1612680b25 100644
--- a/pkgs/development/interpreters/supercollider/default.nix
+++ b/pkgs/development/interpreters/supercollider/default.nix
@@ -31,6 +31,8 @@ stdenv.mkDerivation rec {
       ++ optional (!stdenv.isDarwin) alsaLib
       ++ optional useSCEL emacs;
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Programming language for real time audio synthesis";
     homepage = "https://supercollider.github.io";
diff --git a/pkgs/development/libraries/aqbanking/gwenhywfar.nix b/pkgs/development/libraries/aqbanking/gwenhywfar.nix
index d240e7e3a9d..073ad3254a0 100644
--- a/pkgs/development/libraries/aqbanking/gwenhywfar.nix
+++ b/pkgs/development/libraries/aqbanking/gwenhywfar.nix
@@ -57,6 +57,8 @@ in stdenv.mkDerivation rec {
 
   buildInputs = [ gtk2 gtk3 qt5.qtbase gnutls openssl libgcrypt libgpgerror ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "OS abstraction functions used by aqbanking and related tools";
     homepage = "http://www2.aquamaniac.de/sites/download/packages.php?package=01&showall=1";
diff --git a/pkgs/development/libraries/audio/suil/default.nix b/pkgs/development/libraries/audio/suil/default.nix
index 0f4dd0f62c4..56008ae8dd6 100644
--- a/pkgs/development/libraries/audio/suil/default.nix
+++ b/pkgs/development/libraries/audio/suil/default.nix
@@ -22,6 +22,8 @@ stdenv.mkDerivation rec {
     ++ (lib.optionals withQt4 [ qt4 ])
     ++ (lib.optionals withQt5 (with qt5; [ qtbase qttools ]));
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "http://drobilla.net/software/suil";
     description = "A lightweight C library for loading and wrapping LV2 plugin UIs";
diff --git a/pkgs/development/libraries/dxflib/default.nix b/pkgs/development/libraries/dxflib/default.nix
index b2cd97398c6..09f2ad3ccad 100644
--- a/pkgs/development/libraries/dxflib/default.nix
+++ b/pkgs/development/libraries/dxflib/default.nix
@@ -13,6 +13,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     qmake
   ];
+  dontWrapQtApps = true;
   preConfigure = ''
     sed -i 's/CONFIG += staticlib/CONFIG += shared/' dxflib.pro
   '';
diff --git a/pkgs/development/libraries/g2o/default.nix b/pkgs/development/libraries/g2o/default.nix
index 675d994cf0e..6e32db59de4 100644
--- a/pkgs/development/libraries/g2o/default.nix
+++ b/pkgs/development/libraries/g2o/default.nix
@@ -23,6 +23,8 @@ mkDerivation rec {
   # Silence noisy warning
   CXXFLAGS = "-Wno-deprecated-copy";
 
+  dontWrapQtApps = true;
+
   cmakeFlags = [
     # Detection script is broken
     "-DQGLVIEWER_INCLUDE_DIR=${libqglviewer}/include/QGLViewer"
diff --git a/pkgs/development/libraries/gecode/default.nix b/pkgs/development/libraries/gecode/default.nix
index 46b13e6e37f..fc9835d85db 100644
--- a/pkgs/development/libraries/gecode/default.nix
+++ b/pkgs/development/libraries/gecode/default.nix
@@ -12,6 +12,7 @@ stdenv.mkDerivation rec {
   };
 
   enableParallelBuilding = true;
+  dontWrapQtApps = true;
   nativeBuildInputs = [ bison flex ];
   buildInputs = [ perl gmp mpfr ]
     ++ lib.optional enableGist qtbase;
diff --git a/pkgs/development/libraries/gpgme/default.nix b/pkgs/development/libraries/gpgme/default.nix
index 5b24955af43..8a448759c7f 100644
--- a/pkgs/development/libraries/gpgme/default.nix
+++ b/pkgs/development/libraries/gpgme/default.nix
@@ -50,6 +50,8 @@ stdenv.mkDerivation rec {
 
   depsBuildBuild = [ buildPackages.stdenv.cc ];
 
+  dontWrapQtApps = true;
+
   configureFlags = [
     "--enable-fixed-path=${gnupg}/bin"
     "--with-libgpg-error-prefix=${libgpgerror.dev}"
diff --git a/pkgs/development/libraries/kpmcore/default.nix b/pkgs/development/libraries/kpmcore/default.nix
index 837333407b2..315a38197a1 100644
--- a/pkgs/development/libraries/kpmcore/default.nix
+++ b/pkgs/development/libraries/kpmcore/default.nix
@@ -24,6 +24,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ extra-cmake-modules ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     maintainers = with lib.maintainers; [ peterhoeg ];
     # The build requires at least Qt 5.14:
diff --git a/pkgs/development/libraries/libcommuni/default.nix b/pkgs/development/libraries/libcommuni/default.nix
index 47360e11bc5..cdc716731fa 100644
--- a/pkgs/development/libraries/libcommuni/default.nix
+++ b/pkgs/development/libraries/libcommuni/default.nix
@@ -21,6 +21,8 @@ stdenv.mkDerivation rec {
   dontUseQmakeConfigure = true;
   configureFlags = [ "-config" "release" ];
 
+  dontWrapQtApps = true;
+
   preConfigure = ''
     sed -i -e 's|/bin/pwd|pwd|g' configure
   '';
diff --git a/pkgs/development/libraries/libdbusmenu-qt/default.nix b/pkgs/development/libraries/libdbusmenu-qt/default.nix
index e44f3e37d20..75d4f76b31f 100644
--- a/pkgs/development/libraries/libdbusmenu-qt/default.nix
+++ b/pkgs/development/libraries/libdbusmenu-qt/default.nix
@@ -20,6 +20,8 @@ stdenv.mkDerivation {
 
   cmakeFlags = [ "-DWITH_DOC=OFF" ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Provides a Qt implementation of the DBusMenu spec";
     inherit homepage;
diff --git a/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix b/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix
index 5ce811e9fea..7219bcbdeb5 100644
--- a/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix
+++ b/pkgs/development/libraries/libdbusmenu-qt/qt-5.5.nix
@@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DWITH_DOC=OFF" ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://launchpad.net/libdbusmenu-qt";
     description = "Provides a Qt implementation of the DBusMenu spec";
diff --git a/pkgs/development/libraries/libkeyfinder/default.nix b/pkgs/development/libraries/libkeyfinder/default.nix
index d2aecccdedf..a38fa0dc6f6 100644
--- a/pkgs/development/libraries/libkeyfinder/default.nix
+++ b/pkgs/development/libraries/libkeyfinder/default.nix
@@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ qmake ];
   buildInputs = [ fftw qtbase ];
 
+  dontWrapQtApps = true;
+
   postPatch = ''
     substituteInPlace LibKeyFinder.pro \
       --replace "/usr/local" "$out" \
diff --git a/pkgs/development/libraries/libktorrent/default.nix b/pkgs/development/libraries/libktorrent/default.nix
index 610efa7ed4f..825fe87fe2f 100644
--- a/pkgs/development/libraries/libktorrent/default.nix
+++ b/pkgs/development/libraries/libktorrent/default.nix
@@ -27,6 +27,8 @@ in stdenv.mkDerivation rec {
     inherit mainVersion;
   };
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "A BitTorrent library used by KTorrent";
     homepage    = "https://www.kde.org/applications/internet/ktorrent/";
diff --git a/pkgs/development/libraries/liblastfm/default.nix b/pkgs/development/libraries/liblastfm/default.nix
index 10cdb301479..5183c47bc06 100644
--- a/pkgs/development/libraries/liblastfm/default.nix
+++ b/pkgs/development/libraries/liblastfm/default.nix
@@ -23,6 +23,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ fftwSinglePrec libsamplerate qtbase ]
     ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.SystemConfiguration;
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://github.com/lastfm/liblastfm";
     repositories.git = "git://github.com/lastfm/liblastfm.git";
diff --git a/pkgs/development/libraries/libqglviewer/default.nix b/pkgs/development/libraries/libqglviewer/default.nix
index 4fc50f20730..65d7a83a838 100644
--- a/pkgs/development/libraries/libqglviewer/default.nix
+++ b/pkgs/development/libraries/libqglviewer/default.nix
@@ -13,6 +13,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ qtbase libGLU ]
     ++ lib.optional stdenv.isDarwin AGL;
 
+  dontWrapQtApps = true;
+
   postPatch = ''
     cd QGLViewer
   '';
diff --git a/pkgs/development/libraries/opencsg/default.nix b/pkgs/development/libraries/opencsg/default.nix
index 53adbdf414f..7625db9a595 100644
--- a/pkgs/development/libraries/opencsg/default.nix
+++ b/pkgs/development/libraries/opencsg/default.nix
@@ -33,6 +33,8 @@ stdenv.mkDerivation rec {
     rmdir $out/bin || true
   '';
 
+  dontWrapQtApps = true;
+
   postFixup = lib.optionalString stdenv.isDarwin ''
     app=$out/Applications/opencsgexample.app/Contents/MacOS/opencsgexample
     install_name_tool -change \
diff --git a/pkgs/development/libraries/phonon/backends/gstreamer.nix b/pkgs/development/libraries/phonon/backends/gstreamer.nix
index 249ce4e3629..3e21415b4c7 100644
--- a/pkgs/development/libraries/phonon/backends/gstreamer.nix
+++ b/pkgs/development/libraries/phonon/backends/gstreamer.nix
@@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
   # on system paths being set.
   patches = [ ./gst-plugin-paths.patch ];
 
+  dontWrapQtApps = true;
+
   NIX_CFLAGS_COMPILE =
     let gstPluginPaths =
           lib.makeSearchPathOutput "lib" "/lib/gstreamer-1.0"
diff --git a/pkgs/development/libraries/phonon/backends/vlc.nix b/pkgs/development/libraries/phonon/backends/vlc.nix
index 07e6ccf1f34..b874c2e1d01 100644
--- a/pkgs/development/libraries/phonon/backends/vlc.nix
+++ b/pkgs/development/libraries/phonon/backends/vlc.nix
@@ -35,6 +35,8 @@ stdenv.mkDerivation rec {
     extra-cmake-modules
   ];
 
+  dontWrapQtApps = true;
+
   cmakeFlags = [
     "-DCMAKE_BUILD_TYPE=${if debug then "Debug" else "Release"}"
   ];
diff --git a/pkgs/development/libraries/phonon/default.nix b/pkgs/development/libraries/phonon/default.nix
index 88a6af658dd..877bf973194 100644
--- a/pkgs/development/libraries/phonon/default.nix
+++ b/pkgs/development/libraries/phonon/default.nix
@@ -58,6 +58,8 @@ stdenv.mkDerivation rec {
     "-DCMAKE_BUILD_TYPE=${if debug then "Debug" else "Release"}"
   ];
 
+  dontWrapQtApps = true;
+
   preConfigure = ''
     cmakeFlags+=" -DPHONON_QT_MKSPECS_INSTALL_DIR=''${!outputDev}/mkspecs"
     cmakeFlags+=" -DPHONON_QT_IMPORTS_INSTALL_DIR=''${!outputBin}/$qtQmlPrefix"
diff --git a/pkgs/development/libraries/polkit-qt-1/qt-5.nix b/pkgs/development/libraries/polkit-qt-1/qt-5.nix
index be425b39401..c4918d9d8e9 100644
--- a/pkgs/development/libraries/polkit-qt-1/qt-5.nix
+++ b/pkgs/development/libraries/polkit-qt-1/qt-5.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation {
 
   propagatedBuildInputs = [ polkit glib qtbase ];
 
+  dontWrapQtApps = true;
+
   postFixup = ''
     # Fix library location in CMake module
     sed -i "$dev/lib/cmake/PolkitQt5-1/PolkitQt5-1Config.cmake" \
diff --git a/pkgs/development/libraries/poppler/0.61.nix b/pkgs/development/libraries/poppler/0.61.nix
index a49bfad7ab3..9b89283972d 100644
--- a/pkgs/development/libraries/poppler/0.61.nix
+++ b/pkgs/development/libraries/poppler/0.61.nix
@@ -53,6 +53,8 @@ stdenv.mkDerivation rec {
     (mkFlag qt5Support "QT5")
   ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://poppler.freedesktop.org/";
     description = "A PDF rendering library";
diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix
index f75c8c1474f..f3fae283e87 100644
--- a/pkgs/development/libraries/poppler/default.nix
+++ b/pkgs/development/libraries/poppler/default.nix
@@ -38,6 +38,8 @@ stdenv.mkDerivation rec {
     sed -i -e '1i cmake_policy(SET CMP0025 NEW)' CMakeLists.txt
   '';
 
+  dontWrapQtApps = true;
+
   cmakeFlags = [
     (mkFlag true "UNSTABLE_API_ABI_HEADERS") # previously "XPDF_HEADERS"
     (mkFlag (!minimal) "GLIB")
diff --git a/pkgs/development/libraries/pyotherside/default.nix b/pkgs/development/libraries/pyotherside/default.nix
index 58d38651a76..da327ae13fa 100644
--- a/pkgs/development/libraries/pyotherside/default.nix
+++ b/pkgs/development/libraries/pyotherside/default.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
     python3 qtbase qtquickcontrols qtsvg ncurses
   ];
 
+  dontWrapQtApps = true;
+
   patches = [ ./qml-path.patch ];
   installTargets = [ "sub-src-install_subtargets" ];
 
diff --git a/pkgs/development/libraries/python-qt/default.nix b/pkgs/development/libraries/python-qt/default.nix
index bd778f1a945..0fe0806b1eb 100644
--- a/pkgs/development/libraries/python-qt/default.nix
+++ b/pkgs/development/libraries/python-qt/default.nix
@@ -22,6 +22,8 @@ stdenv.mkDerivation rec {
                  "PYTHON_PATH=${python}/bin"
                  "PYTHON_LIB=${python}/lib"];
 
+  dontWrapQtApps = true;
+
   unpackCmd = "unzip $src";
 
   installPhase = ''
diff --git a/pkgs/development/libraries/qca-qt5/default.nix b/pkgs/development/libraries/qca-qt5/default.nix
index d1b545884b5..e53404557fb 100644
--- a/pkgs/development/libraries/qca-qt5/default.nix
+++ b/pkgs/development/libraries/qca-qt5/default.nix
@@ -12,6 +12,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ openssl qtbase ];
   nativeBuildInputs = [ cmake pkg-config ];
 
+  dontWrapQtApps = true;
+
   # Without this patch cmake fails with a "No known features for CXX compiler"
   # error on darwin
   patches = lib.optional stdenv.isDarwin ./move-project.patch ;
diff --git a/pkgs/development/libraries/qmlbox2d/default.nix b/pkgs/development/libraries/qmlbox2d/default.nix
index 88c94543045..f5257ad0e8e 100644
--- a/pkgs/development/libraries/qmlbox2d/default.nix
+++ b/pkgs/development/libraries/qmlbox2d/default.nix
@@ -9,6 +9,7 @@ stdenv.mkDerivation {
   };
 
   enableParallelBuilding = true;
+  dontWrapQtApps = true;
   nativeBuildInputs = [ qmake ];
 
   buildInputs = [ qtdeclarative ];
diff --git a/pkgs/development/libraries/qmltermwidget/default.nix b/pkgs/development/libraries/qmltermwidget/default.nix
index 75f95a53800..7914af08df6 100644
--- a/pkgs/development/libraries/qmltermwidget/default.nix
+++ b/pkgs/development/libraries/qmltermwidget/default.nix
@@ -32,6 +32,8 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
+  dontWrapQtApps = true;
+
   meta = {
     description = "A QML port of qtermwidget";
     homepage = "https://github.com/Swordfish90/qmltermwidget";
diff --git a/pkgs/development/libraries/qoauth/default.nix b/pkgs/development/libraries/qoauth/default.nix
index 8afa19c229f..2b0be6f0b3d 100644
--- a/pkgs/development/libraries/qoauth/default.nix
+++ b/pkgs/development/libraries/qoauth/default.nix
@@ -21,6 +21,8 @@ stdenv.mkDerivation {
   NIX_CFLAGS_COMPILE = "-I${qca-qt5}/include/Qca-qt5/QtCrypto";
   NIX_LDFLAGS = "-lqca-qt5";
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Qt library for OAuth authentication";
     inherit (qtbase.meta) platforms;
diff --git a/pkgs/development/libraries/qscintilla/default.nix b/pkgs/development/libraries/qscintilla/default.nix
index 26a3c2e36d3..314bdabdb55 100644
--- a/pkgs/development/libraries/qscintilla/default.nix
+++ b/pkgs/development/libraries/qscintilla/default.nix
@@ -35,6 +35,7 @@ in stdenv.mkDerivation rec {
   '';
 
   enableParallelBuilding = true;
+  dontWrapQtApps = true;
 
   postPatch = ''
     substituteInPlace qscintilla.pro \
diff --git a/pkgs/development/libraries/qt-5/5.12/default.nix b/pkgs/development/libraries/qt-5/5.12/default.nix
index cf5a0de11ad..e55b66d626a 100644
--- a/pkgs/development/libraries/qt-5/5.12/default.nix
+++ b/pkgs/development/libraries/qt-5/5.12/default.nix
@@ -145,7 +145,7 @@ let
         patches = patches.qtbase;
         inherit bison cups harfbuzz libGL;
         withGtk3 = true; inherit dconf gtk3;
-        inherit developerBuild decryptSslTraffic;
+        inherit debug developerBuild decryptSslTraffic;
       };
 
       qtcharts = callPackage ../modules/qtcharts.nix {};
@@ -197,6 +197,7 @@ let
       qmake = makeSetupHook {
         deps = [ self.qtbase.dev ];
         substitutions = {
+          inherit debug;
           fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh;
         };
       } ../hooks/qmake-hook.sh;
diff --git a/pkgs/development/libraries/qt-5/5.14/default.nix b/pkgs/development/libraries/qt-5/5.14/default.nix
index 7139a3b7354..7be50799275 100644
--- a/pkgs/development/libraries/qt-5/5.14/default.nix
+++ b/pkgs/development/libraries/qt-5/5.14/default.nix
@@ -149,7 +149,7 @@ let
         patches = patches.qtbase;
         inherit bison cups harfbuzz libGL;
         withGtk3 = true; inherit dconf gtk3;
-        inherit developerBuild decryptSslTraffic;
+        inherit debug developerBuild decryptSslTraffic;
       };
 
       qtcharts = callPackage ../modules/qtcharts.nix {};
@@ -199,6 +199,7 @@ let
       qmake = makeSetupHook {
         deps = [ self.qtbase.dev ];
         substitutions = {
+          inherit debug;
           fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh;
         };
       } ../hooks/qmake-hook.sh;
diff --git a/pkgs/development/libraries/qt-5/5.15/default.nix b/pkgs/development/libraries/qt-5/5.15/default.nix
index a3a0496f160..c3f6ab159c4 100644
--- a/pkgs/development/libraries/qt-5/5.15/default.nix
+++ b/pkgs/development/libraries/qt-5/5.15/default.nix
@@ -179,6 +179,7 @@ let
       qmake = makeSetupHook {
         deps = [ self.qtbase.dev ];
         substitutions = {
+          inherit debug;
           fix_qmake_libtool = ../hooks/fix-qmake-libtool.sh;
         };
       } ../hooks/qmake-hook.sh;
diff --git a/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh b/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
index 7f6ddb76ad5..741225a5aa8 100644
--- a/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
+++ b/pkgs/development/libraries/qt-5/hooks/qmake-hook.sh
@@ -3,6 +3,9 @@
 qmakeFlags=( ${qmakeFlags-} )
 
 qmakePrePhase() {
+    qmakeFlags_orig=( "${qmakeFlags[@]}" )
+
+    # These flags must be added _before_ the flags specified in the derivation.
     qmakeFlags=( \
         "PREFIX=$out" \
         "NIX_OUTPUT_OUT=$out" \
@@ -11,8 +14,15 @@ qmakePrePhase() {
         "NIX_OUTPUT_DOC=${!outputDev}/${qtDocPrefix:?}" \
         "NIX_OUTPUT_QML=${!outputBin}/${qtQmlPrefix:?}" \
         "NIX_OUTPUT_PLUGIN=${!outputBin}/${qtPluginPrefix:?}" \
-        "${qmakeFlags[@]}" \
     )
+
+    if [ -n "@debug@" ]; then
+        qmakeFlags+=( "CONFIG+=debug" )
+    else
+        qmakeFlags+=( "CONFIG+=release" )
+    fi
+
+    qmakeFlags+=( "${qmakeFlags_orig[@]}" )
 }
 prePhases+=" qmakePrePhase"
 
diff --git a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
index 9f2a9f06f1a..1b57d676e1f 100644
--- a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
+++ b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
@@ -1,3 +1,14 @@
+if [[ -n "${__nix_qtbase-}" ]]; then
+    # Throw an error if a different version of Qt was already set up.
+    if [[ "$__nix_qtbase" != "@dev@" ]]; then
+        echo >&2 "Error: detected mismatched Qt dependencies:"
+        echo >&2 "    @dev@"
+        echo >&2 "    $__nix_qtbase"
+        exit 1
+    fi
+else # Only set up Qt once.
+__nix_qtbase="@dev@"
+
 qtPluginPrefix=@qtPluginPrefix@
 qtQmlPrefix=@qtQmlPrefix@
 qtDocPrefix=@qtDocPrefix@
@@ -5,6 +16,20 @@ qtDocPrefix=@qtDocPrefix@
 . @fix_qt_builtin_paths@
 . @fix_qt_module_paths@
 
+# Disable debug symbols if qtbase was built without debugging.
+# This stops -dev paths from leaking into other outputs.
+if [ -z "@debug@" ]; then
+    NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE-}${NIX_CFLAGS_COMPILE:+ }-DQT_NO_DEBUG"
+fi
+
+# Integration with CMake:
+# Set the CMake build type corresponding to how qtbase was built.
+if [ -n "@debug@" ]; then
+    cmakeBuildType="Debug"
+else
+    cmakeBuildType="Release"
+fi
+
 providesQtRuntime() {
     [ -d "$1/$qtPluginPrefix" ] || [ -d "$1/$qtQmlPrefix" ]
 }
@@ -19,7 +44,12 @@ export QMAKEPATH
 QMAKEMODULES=
 export QMAKEMODULES
 
+declare -Ag qmakePathSeen=()
 qmakePathHook() {
+    # Skip this path if we have seen it before.
+    # MUST use 'if' because 'qmakePathSeen[$]' may be unset.
+    if [ -n "${qmakePathSeen[$1]-}" ]; then return; fi
+    qmakePathSeen[$1]=1
     if [ -d "$1/mkspecs" ]
     then
         QMAKEMODULES="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs"
@@ -34,7 +64,12 @@ envBuildHostHooks+=(qmakePathHook)
 # 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.)
+declare -Ag qtEnvHostTargetSeen=()
 qtEnvHostTargetHook() {
+    # Skip this path if we have seen it before.
+    # MUST use 'if' because 'qmakePathSeen[$]' may be unset.
+    if [ -n "${qtEnvHostTargetSeen[$1]-}" ]; then return; fi
+    qtEnvHostTargetSeen[$1]=1
     if providesQtRuntime "$1" && [ "z${!outputBin}" != "z${!outputDev}" ]
     then
         propagatedBuildInputs+=" $1"
@@ -64,3 +99,14 @@ postPatchMkspecs() {
 if [ -z "${dontPatchMkspecs-}" ]; then
     postPhases="${postPhases-}${postPhases:+ }postPatchMkspecs"
 fi
+
+qtPreHook() {
+    # Check that wrapQtAppsHook is used, or it is explicitly disabled.
+    if [[ -z "$__nix_wrapQtAppsHook" && -z "$dontWrapQtApps" ]]; then
+        echo >&2 "Error: wrapQtAppsHook is not used, and dontWrapQtApps is not set."
+        exit 1
+    fi
+}
+prePhases+=" qtPreHook"
+
+fi
diff --git a/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh b/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh
index 7356c8ee356..ce4d78fbb50 100644
--- a/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh
+++ b/pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh
@@ -1,3 +1,6 @@
+if [[ -z "${__nix_wrapQtAppsHook-}" ]]; then
+__nix_wrapQtAppsHook=1  # Don't run this hook more than once.
+
 # Inherit arguments given in mkDerivation
 qtWrapperArgs=( ${qtWrapperArgs-} )
 
@@ -100,3 +103,5 @@ wrapQtAppsHook() {
 }
 
 fixupOutputHooks+=(wrapQtAppsHook)
+
+fi
diff --git a/pkgs/development/libraries/qt-5/mkDerivation.nix b/pkgs/development/libraries/qt-5/mkDerivation.nix
index 2c6333cb020..98f9a05fac7 100644
--- a/pkgs/development/libraries/qt-5/mkDerivation.nix
+++ b/pkgs/development/libraries/qt-5/mkDerivation.nix
@@ -9,21 +9,6 @@ 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 ];
 
   };
diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix
index 24f1d6f81a2..0d0bef342b0 100644
--- a/pkgs/development/libraries/qt-5/modules/qtbase.nix
+++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix
@@ -22,6 +22,7 @@
   libGL,
   buildExamples ? false,
   buildTests ? false,
+  debug ? false,
   developerBuild ? false,
   decryptSslTraffic ? false
 }:
@@ -33,12 +34,14 @@ let
   compareVersion = v: builtins.compareVersions version v;
   qmakeCacheName =
     if compareVersion "5.12.4" < 0 then ".qmake.cache" else ".qmake.stash";
+  debugSymbols = debug || developerBuild;
 in
 
 stdenv.mkDerivation {
 
   name = "qtbase-${version}";
   inherit qtCompatVersion src version;
+  debug = debugSymbols;
 
   propagatedBuildInputs =
     [
@@ -241,6 +244,7 @@ stdenv.mkDerivation {
       "-I" "${icu.dev}/include"
       "-pch"
     ]
+    ++ lib.optional debugSymbols "-debug"
     ++ lib.optionals (compareVersion "5.11.0" < 0)
     [
       "-qml-debug"
@@ -397,6 +401,8 @@ stdenv.mkDerivation {
           -e "/^host_bins=/ c host_bins=$dev/bin"
     '';
 
+  dontStrip = debugSymbols;
+
   setupHook = ../hooks/qtbase-setup-hook.sh;
 
   meta = with lib; {
diff --git a/pkgs/development/libraries/qt-5/qtModule.nix b/pkgs/development/libraries/qt-5/qtModule.nix
index 0481f000c6c..930ed9d67ba 100644
--- a/pkgs/development/libraries/qt-5/qtModule.nix
+++ b/pkgs/development/libraries/qt-5/qtModule.nix
@@ -34,6 +34,8 @@ mkDerivation (args // {
     fixQtBuiltinPaths . '*.pr?'
   '';
 
+  dontWrapQtApps = args.dontWrapQtApps or true;
+
   postFixup = ''
     if [ -d "''${!outputDev}/lib/pkgconfig" ]; then
         find "''${!outputDev}/lib/pkgconfig" -name '*.pc' | while read pc; do
diff --git a/pkgs/development/libraries/qtinstaller/default.nix b/pkgs/development/libraries/qtinstaller/default.nix
index 91f85371106..ce69c855ac2 100644
--- a/pkgs/development/libraries/qtinstaller/default.nix
+++ b/pkgs/development/libraries/qtinstaller/default.nix
@@ -18,6 +18,7 @@ stdenv.mkDerivation rec {
   setOutputFlags = false;
   enableParallelBuilding = true;
   NIX_QT_SUBMODULE = true;
+  dontWrapQtApps = true;
 
   installPhase = ''
     mkdir -p $out/{bin,lib,share/qt-installer-framework}
diff --git a/pkgs/development/libraries/qtkeychain/default.nix b/pkgs/development/libraries/qtkeychain/default.nix
index 6da4abb756e..3da0587210d 100644
--- a/pkgs/development/libraries/qtkeychain/default.nix
+++ b/pkgs/development/libraries/qtkeychain/default.nix
@@ -19,6 +19,8 @@ stdenv.mkDerivation rec {
     sha256 = "0h4wgngn2yl35hapbjs24amkjfbzsvnna4ixfhn87snjnq5lmjbc"; # v0.9.1
   };
 
+  dontWrapQtApps = true;
+
   patches = (if withQt5 then [] else [ ./0001-Fixes-build-with-Qt4.patch ]) ++ (if stdenv.isDarwin then [ ./0002-Fix-install-name-Darwin.patch ] else []);
 
   cmakeFlags = [ "-DQT_TRANSLATIONS_DIR=share/qt/translations" ];
diff --git a/pkgs/development/libraries/qtpbfimageplugin/default.nix b/pkgs/development/libraries/qtpbfimageplugin/default.nix
index 3558201015c..9dbc2491ad9 100644
--- a/pkgs/development/libraries/qtpbfimageplugin/default.nix
+++ b/pkgs/development/libraries/qtpbfimageplugin/default.nix
@@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ qmake ];
   buildInputs = [ qtbase protobuf ];
 
+  dontWrapQtApps = true;
+
   postPatch = ''
     # Fix plugin dir
     substituteInPlace pbfplugin.pro \
diff --git a/pkgs/development/libraries/qtutilities/default.nix b/pkgs/development/libraries/qtutilities/default.nix
index 831c51fa234..f5398d92dfc 100644
--- a/pkgs/development/libraries/qtutilities/default.nix
+++ b/pkgs/development/libraries/qtutilities/default.nix
@@ -22,6 +22,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ qtbase cpp-utilities ];
   nativeBuildInputs = [ cmake qttools ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://github.com/Martchus/qtutilities";
     description = "Common C++ classes and routines used by @Martchus' applications featuring argument parser, IO and conversion utilities";
diff --git a/pkgs/development/libraries/qtwebkit-plugins/default.nix b/pkgs/development/libraries/qtwebkit-plugins/default.nix
index 652c49aa6ca..5bc30db059e 100644
--- a/pkgs/development/libraries/qtwebkit-plugins/default.nix
+++ b/pkgs/development/libraries/qtwebkit-plugins/default.nix
@@ -14,6 +14,8 @@ stdenv.mkDerivation {
 
   buildInputs = [ qtwebkit hunspell ];
 
+  dontWrapQtApps = true;
+
   postPatch = ''
     sed -i "s,-lhunspell,-lhunspell-${lib.versions.majorMinor hunspell.version}," src/spellcheck/spellcheck.pri
     sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/$qtPluginPrefix," src/src.pro
diff --git a/pkgs/development/libraries/quazip/default.nix b/pkgs/development/libraries/quazip/default.nix
index 3f186314d01..a12d6cafe4a 100644
--- a/pkgs/development/libraries/quazip/default.nix
+++ b/pkgs/development/libraries/quazip/default.nix
@@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ]
     ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Provides access to ZIP archives from Qt programs";
     license = licenses.lgpl21Plus;
diff --git a/pkgs/development/libraries/qwt/6.nix b/pkgs/development/libraries/qwt/6.nix
index edfd3b4e24a..e5fad490f6e 100644
--- a/pkgs/development/libraries/qwt/6.nix
+++ b/pkgs/development/libraries/qwt/6.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
 
   qmakeFlags = [ "-after doc.path=$out/share/doc/${name}" ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Qt widgets for technical applications";
     homepage = "http://qwt.sourceforge.net/";
diff --git a/pkgs/development/libraries/soqt/default.nix b/pkgs/development/libraries/soqt/default.nix
index 2be6c662145..fe7901bddd5 100644
--- a/pkgs/development/libraries/soqt/default.nix
+++ b/pkgs/development/libraries/soqt/default.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://github.com/coin3d/soqt";
     license = licenses.bsd3;
diff --git a/pkgs/development/libraries/telepathy/qt/default.nix b/pkgs/development/libraries/telepathy/qt/default.nix
index b606c56445e..f61811428ce 100644
--- a/pkgs/development/libraries/telepathy/qt/default.nix
+++ b/pkgs/development/libraries/telepathy/qt/default.nix
@@ -20,6 +20,8 @@ in stdenv.mkDerivation rec {
   # On 0.9.7, they do not even build with QT4
   cmakeFlags = lib.optional (!doCheck) "-DENABLE_TESTS=OFF";
 
+  dontWrapQtApps = true;
+
   doCheck = false; # giving up for now
 
   meta = with lib; {
diff --git a/pkgs/development/libraries/vtk/generic.nix b/pkgs/development/libraries/vtk/generic.nix
index 273bff8852e..85eaa1ae80e 100644
--- a/pkgs/development/libraries/vtk/generic.nix
+++ b/pkgs/development/libraries/vtk/generic.nix
@@ -57,6 +57,8 @@ in stdenv.mkDerivation rec {
     export LD_LIBRARY_PATH="$(pwd)/lib";
   '';
 
+  dontWrapQtApps = true;
+
   # Shared libraries don't work, because of rpath troubles with the current
   # nixpkgs cmake approach. It wants to call a binary at build time, just
   # built and requiring one of the shared objects.
diff --git a/pkgs/development/python-modules/ovito/default.nix b/pkgs/development/python-modules/ovito/default.nix
index a33e5d19b44..d0923287183 100644
--- a/pkgs/development/python-modules/ovito/default.nix
+++ b/pkgs/development/python-modules/ovito/default.nix
@@ -30,6 +30,8 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = with python.pkgs; [ sphinx numpy sip pyqt5 matplotlib ase ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Scientific visualization and analysis software for atomistic simulation data";
     homepage = "https://www.ovito.org";
diff --git a/pkgs/development/python-modules/pivy/default.nix b/pkgs/development/python-modules/pivy/default.nix
index 312c87ae544..c51f8cb54e0 100644
--- a/pkgs/development/python-modules/pivy/default.nix
+++ b/pkgs/development/python-modules/pivy/default.nix
@@ -29,8 +29,7 @@ buildPythonPackage rec {
   ];
 
   dontUseQmakeConfigure = true;
-  dontUseCmakeConfigure = true;
-
+  dontWrapQtApps =true;
   doCheck = false;
 
   postPatch = ''
diff --git a/pkgs/development/python-modules/poppler-qt5/default.nix b/pkgs/development/python-modules/poppler-qt5/default.nix
index e94a234dc1a..345f092a80f 100644
--- a/pkgs/development/python-modules/poppler-qt5/default.nix
+++ b/pkgs/development/python-modules/poppler-qt5/default.nix
@@ -34,6 +34,8 @@ buildPythonPackage rec {
   # no tests, just bindings for `poppler_qt5`
   doCheck = false;
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://github.com/wbsoft/python-poppler-qt5";
     license = licenses.gpl2;
diff --git a/pkgs/development/python-modules/pyqt/5.x.nix b/pkgs/development/python-modules/pyqt/5.x.nix
index 26bf5dc1c4b..6e4b4d37f28 100644
--- a/pkgs/development/python-modules/pyqt/5.x.nix
+++ b/pkgs/development/python-modules/pyqt/5.x.nix
@@ -57,6 +57,8 @@ in buildPythonPackage rec {
 
   outputs = [ "out" "dev" ];
 
+  dontWrapQtApps = true;
+
   nativeBuildInputs = [
     pkg-config
     qmake
diff --git a/pkgs/development/python-modules/pyqtwebengine/default.nix b/pkgs/development/python-modules/pyqtwebengine/default.nix
index 262c5a17504..dc631b2118e 100644
--- a/pkgs/development/python-modules/pyqtwebengine/default.nix
+++ b/pkgs/development/python-modules/pyqtwebengine/default.nix
@@ -45,6 +45,8 @@ in buildPythonPackage rec {
   propagatedBuildInputs = [ pyqt5 ]
     ++ lib.optional (!isPy3k) enum34;
 
+  dontWrapQtApps = true;
+
   configurePhase = ''
     runHook preConfigure
 
diff --git a/pkgs/development/python-modules/pyside/default.nix b/pkgs/development/python-modules/pyside/default.nix
index 08fd8cbfa86..f880791eeec 100644
--- a/pkgs/development/python-modules/pyside/default.nix
+++ b/pkgs/development/python-modules/pyside/default.nix
@@ -23,6 +23,8 @@ buildPythonPackage rec {
 
   makeFlags = [ "QT_PLUGIN_PATH=${pysideShiboken}/lib/generatorrunner" ];
 
+  dontWrapQtApps = true;
+
   meta = {
     description = "LGPL-licensed Python bindings for the Qt cross-platform application and UI framework";
     license = lib.licenses.lgpl21;
diff --git a/pkgs/development/python-modules/pyside2-tools/default.nix b/pkgs/development/python-modules/pyside2-tools/default.nix
index 095a10c1047..20f1a572f1b 100644
--- a/pkgs/development/python-modules/pyside2-tools/default.nix
+++ b/pkgs/development/python-modules/pyside2-tools/default.nix
@@ -25,6 +25,8 @@ stdenv.mkDerivation {
     "-DBUILD_TESTS=OFF"
   ];
 
+  dontWrapQtApps = true;
+
   # The upstream build system consists of a `setup.py` whichs builds three
   # different python libraries and calls cmake as a subprocess.  We call cmake
   # directly because that's easier to get working.  However, the `setup.py`
diff --git a/pkgs/development/python-modules/pyside2/default.nix b/pkgs/development/python-modules/pyside2/default.nix
index 6986c8e5384..c2786b647d6 100644
--- a/pkgs/development/python-modules/pyside2/default.nix
+++ b/pkgs/development/python-modules/pyside2/default.nix
@@ -30,6 +30,8 @@ stdenv.mkDerivation rec {
   ];
   propagatedBuildInputs = [ shiboken2 ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "LGPL-licensed Python bindings for Qt";
     license = licenses.lgpl21;
diff --git a/pkgs/development/python-modules/qscintilla-qt5/default.nix b/pkgs/development/python-modules/qscintilla-qt5/default.nix
index 2ee9c82f08d..dcbe213966f 100644
--- a/pkgs/development/python-modules/qscintilla-qt5/default.nix
+++ b/pkgs/development/python-modules/qscintilla-qt5/default.nix
@@ -14,6 +14,8 @@ buildPythonPackage {
   buildInputs = [ qscintilla ];
   propagatedBuildInputs = [ pyqt5 ];
 
+  dontWrapQtApps = true;
+
   postPatch = ''
     substituteInPlace Python/configure.py \
       --replace \
diff --git a/pkgs/development/python-modules/roboschool/default.nix b/pkgs/development/python-modules/roboschool/default.nix
index 3e15f18a3dd..97eee2155a5 100644
--- a/pkgs/development/python-modules/roboschool/default.nix
+++ b/pkgs/development/python-modules/roboschool/default.nix
@@ -44,6 +44,8 @@ buildPythonPackage rec {
     boost
   ];
 
+  dontWrapQtApps = true;
+
   NIX_CFLAGS_COMPILE="-I ${python}/include/${python.libPrefix}";
 
   patches = [
diff --git a/pkgs/development/python-modules/shiboken2/default.nix b/pkgs/development/python-modules/shiboken2/default.nix
index b7508a8f644..23836addd0c 100644
--- a/pkgs/development/python-modules/shiboken2/default.nix
+++ b/pkgs/development/python-modules/shiboken2/default.nix
@@ -23,6 +23,8 @@ stdenv.mkDerivation {
     "-DBUILD_TESTS=OFF"
   ];
 
+  dontWrapQtApps = true;
+
   postInstall = ''
     rm $out/bin/shiboken_tool.py
   '';
diff --git a/pkgs/development/tools/analysis/panopticon/default.nix b/pkgs/development/tools/analysis/panopticon/default.nix
index 0ef33270e92..91f3f24d6f1 100644
--- a/pkgs/development/tools/analysis/panopticon/default.nix
+++ b/pkgs/development/tools/analysis/panopticon/default.nix
@@ -23,6 +23,8 @@ rustPlatform.buildRustPackage rec {
      git
   ];
 
+  dontWrapQtApps = true;
+
   cargoSha256 = "1hdsn011y9invfy7can8c02zwa7birj9y1rxhrj7wyv4gh3659i0";
   doCheck = false;
 
diff --git a/pkgs/development/tools/analysis/qcachegrind/default.nix b/pkgs/development/tools/analysis/qcachegrind/default.nix
index 0145e51ee26..5e321db01aa 100644
--- a/pkgs/development/tools/analysis/qcachegrind/default.nix
+++ b/pkgs/development/tools/analysis/qcachegrind/default.nix
@@ -12,6 +12,8 @@ in stdenv.mkDerivation {
 
   nativeBuildInputs = [ qmake ];
 
+  dontWrapQtApps = true;
+
   postInstall = ''
      mkdir -p $out/bin
      cp -p converters/dprof2calltree $out/bin/dprof2calltree
diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix
index 5e5875cc36c..5de894bd1b4 100644
--- a/pkgs/development/tools/build-managers/cmake/default.nix
+++ b/pkgs/development/tools/build-managers/cmake/default.nix
@@ -14,7 +14,7 @@
 assert withQt5 -> useQt4 == false;
 assert useQt4 -> withQt5 == false;
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (rec {
   pname = "cmake"
           + lib.optionalString isBootstrap "-boot"
           + lib.optionalString useNcurses "-cursesUI"
@@ -130,4 +130,5 @@ stdenv.mkDerivation rec {
     maintainers = with maintainers; [ ttuegel lnl7 ];
     license = licenses.bsd3;
   };
-}
+} // (if withQt5 then { dontWrapQtApps = true; } else {})
+)
diff --git a/pkgs/development/tools/build-managers/qbs/default.nix b/pkgs/development/tools/build-managers/qbs/default.nix
index 3bf7623ed04..73c23b88752 100644
--- a/pkgs/development/tools/build-managers/qbs/default.nix
+++ b/pkgs/development/tools/build-managers/qbs/default.nix
@@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ qmake ];
 
+  dontWrapQtApps = true;
+
   qmakeFlags = [ "QBS_INSTALL_PREFIX=$(out)" "qbs.pro" ];
 
   buildInputs = [ qtbase qtscript ];
diff --git a/pkgs/development/tools/minizinc/ide.nix b/pkgs/development/tools/minizinc/ide.nix
index 7709423e676..fd366cc39a5 100644
--- a/pkgs/development/tools/minizinc/ide.nix
+++ b/pkgs/development/tools/minizinc/ide.nix
@@ -19,6 +19,7 @@ stdenv.mkDerivation {
   sourceRoot = "source/MiniZincIDE";
 
   enableParallelBuilding = true;
+  dontWrapQtApps = true;
 
   postInstall = ''
     wrapProgram $out/bin/MiniZincIDE --prefix PATH ":" ${lib.makeBinPath [ minizinc ]}
diff --git a/pkgs/development/tools/misc/kdbg/default.nix b/pkgs/development/tools/misc/kdbg/default.nix
index dad7d41c1f6..35e0a52865f 100644
--- a/pkgs/development/tools/misc/kdbg/default.nix
+++ b/pkgs/development/tools/misc/kdbg/default.nix
@@ -18,6 +18,8 @@ stdenv.mkDerivation rec {
     wrapProgram $out/bin/kdbg --prefix QT_PLUGIN_PATH : ${qtbase}/${qtbase.qtPluginPrefix}
   '';
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://www.kdbg.org/";
     description = ''
diff --git a/pkgs/development/tools/phantomjs2/default.nix b/pkgs/development/tools/phantomjs2/default.nix
index 594deeb1c73..3d0db49aedc 100644
--- a/pkgs/development/tools/phantomjs2/default.nix
+++ b/pkgs/development/tools/phantomjs2/default.nix
@@ -77,6 +77,8 @@ in stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  dontWrapQtApps = true;
+
   installPhase = ''
     mkdir -p $out/share/doc/phantomjs
     cp -a bin $out
diff --git a/pkgs/development/tools/rgp/default.nix b/pkgs/development/tools/rgp/default.nix
index 8beeccfa2fd..3cfd608e225 100644
--- a/pkgs/development/tools/rgp/default.nix
+++ b/pkgs/development/tools/rgp/default.nix
@@ -53,6 +53,8 @@ stdenv.mkDerivation rec {
     "${placeholder "out"}/opt/rgp/qt"
   ];
 
+  dontWrapQtApps = true;
+
   installPhase = ''
     mkdir -p $out/opt/rgp $out/bin
     cp -r . $out/opt/rgp/
diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
index 83e181c85e6..bd8825582c4 100644
--- a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
+++ b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
     cp -r DwarfTherapist.app $out/Applications
   '' else null;
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Tool to manage dwarves in a running game of Dwarf Fortress";
     maintainers = with maintainers; [ abbradar bendlas numinit jonringer ];
diff --git a/pkgs/games/freeciv/default.nix b/pkgs/games/freeciv/default.nix
index f9938eaca31..665122c05bc 100644
--- a/pkgs/games/freeciv/default.nix
+++ b/pkgs/games/freeciv/default.nix
@@ -38,6 +38,8 @@ in stdenv.mkDerivation rec {
     ++ optional server readline
     ++ optional enableSqlite sqlite;
 
+  dontWrapQtApps = true;
+
   configureFlags = [ "--enable-shared" ]
     ++ optional sdlClient "--enable-client=sdl"
     ++ optionals qtClient [
diff --git a/pkgs/games/leela-zero/default.nix b/pkgs/games/leela-zero/default.nix
index 4a71fc25c0f..13b423832e6 100644
--- a/pkgs/games/leela-zero/default.nix
+++ b/pkgs/games/leela-zero/default.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "Go engine modeled after AlphaGo Zero";
     homepage    = "https://github.com/gcp/leela-zero";
diff --git a/pkgs/games/openmw/default.nix b/pkgs/games/openmw/default.nix
index 23572998d03..cc1893a9ed3 100644
--- a/pkgs/games/openmw/default.nix
+++ b/pkgs/games/openmw/default.nix
@@ -30,6 +30,8 @@ stdenv.mkDerivation rec {
     "-DDESIRED_QT_VERSION:INT=5"
   ];
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "An unofficial open source engine reimplementation of the game Morrowind";
     homepage = "http://openmw.org";
diff --git a/pkgs/games/openmw/tes3mp.nix b/pkgs/games/openmw/tes3mp.nix
index 47b383a82bd..95659e5a088 100644
--- a/pkgs/games/openmw/tes3mp.nix
+++ b/pkgs/games/openmw/tes3mp.nix
@@ -61,6 +61,8 @@ in openmw.overrideAttrs (oldAttrs: rec {
     "-DRakNet_LIBRARY_DEBUG=${rakNetLibrary}/lib/libRakNetLibStatic.a"
   ];
 
+  dontWrapQtApps = true;
+
   # https://github.com/TES3MP/openmw-tes3mp/issues/552
   patches = [
     ./tes3mp.patch
diff --git a/pkgs/misc/emulators/citra/default.nix b/pkgs/misc/emulators/citra/default.nix
index e1a31d208e4..ae7228c2246 100644
--- a/pkgs/misc/emulators/citra/default.nix
+++ b/pkgs/misc/emulators/citra/default.nix
@@ -14,6 +14,8 @@ mkDerivation {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ SDL2 qtbase qtmultimedia boost ];
 
+  dontWrapQtApps = true;
+
   preConfigure = ''
     # Trick configure system.
     sed -n 's,^ *path = \(.*\),\1,p' .gitmodules | while read path; do
diff --git a/pkgs/os-specific/linux/akvcam/default.nix b/pkgs/os-specific/linux/akvcam/default.nix
index 9e745077514..026ef5b0f46 100644
--- a/pkgs/os-specific/linux/akvcam/default.nix
+++ b/pkgs/os-specific/linux/akvcam/default.nix
@@ -12,6 +12,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ qmake ];
+  dontWrapQtApps = true;
 
   qmakeFlags = [
     "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
diff --git a/pkgs/servers/web-apps/virtlyst/default.nix b/pkgs/servers/web-apps/virtlyst/default.nix
index 05741e0ac21..3ff42050eb2 100644
--- a/pkgs/servers/web-apps/virtlyst/default.nix
+++ b/pkgs/servers/web-apps/virtlyst/default.nix
@@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake pkg-config autoPatchelfHook ];
   buildInputs = [ qtbase libvirt cutelyst grantlee ];
 
+  dontWrapQtApps = true;
+
   installPhase = ''
     mkdir -p $out/lib
     cp src/libVirtlyst.so $out/lib
diff --git a/pkgs/tools/inputmethods/fcitx-engines/fcitx-libpinyin/default.nix b/pkgs/tools/inputmethods/fcitx-engines/fcitx-libpinyin/default.nix
index 2af4061ae04..2767b4c7c0e 100644
--- a/pkgs/tools/inputmethods/fcitx-engines/fcitx-libpinyin/default.nix
+++ b/pkgs/tools/inputmethods/fcitx-engines/fcitx-libpinyin/default.nix
@@ -42,6 +42,8 @@ stdenv.mkDerivation rec {
       cp -rv ${store_path} $NIX_BUILD_TOP/$name/data/${ZHUYIN_DATA_FILE_NAME}
     '';
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     isFcitxEngine = true;
     description  = "Fcitx Wrapper for libpinyin, Library to deal with pinyin";
diff --git a/pkgs/tools/inputmethods/hime/default.nix b/pkgs/tools/inputmethods/hime/default.nix
index 8ec6146a020..988f8941d14 100644
--- a/pkgs/tools/inputmethods/hime/default.nix
+++ b/pkgs/tools/inputmethods/hime/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation {
 
   preConfigure = "patchShebangs configure";
   configureFlags = [ "--disable-lib64" "--disable-qt5-immodule" ];
-
+  dontWrapQtApps = true;
 
   meta = with lib; {
     homepage = "http://hime-ime.github.io/";
diff --git a/pkgs/tools/misc/ttfautohint/default.nix b/pkgs/tools/misc/ttfautohint/default.nix
index 9e88e5da4f8..fe121c2d51c 100644
--- a/pkgs/tools/misc/ttfautohint/default.nix
+++ b/pkgs/tools/misc/ttfautohint/default.nix
@@ -25,6 +25,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     description = "An automatic hinter for TrueType fonts";
     longDescription = ''
diff --git a/pkgs/tools/networking/spoofer/default.nix b/pkgs/tools/networking/spoofer/default.nix
index 23b3f2688c9..a983ef9c42c 100644
--- a/pkgs/tools/networking/spoofer/default.nix
+++ b/pkgs/tools/networking/spoofer/default.nix
@@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
   buildInputs = [ openssl protobuf libpcap traceroute ]
                 ++ optional withGUI qt5.qtbase ;
 
+  dontWrapQtApps = true;
+
   meta = with lib; {
     homepage = "https://www.caida.org/projects/spoofer";
     description = "Assess and report on deployment of source address validation";
diff --git a/pkgs/tools/package-management/packagekit/qt.nix b/pkgs/tools/package-management/packagekit/qt.nix
index f87ce8258fa..d1d135c1579 100644
--- a/pkgs/tools/package-management/packagekit/qt.nix
+++ b/pkgs/tools/package-management/packagekit/qt.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config qttools ];
 
+  dontWrapQtApps = true;
+
   meta = packagekit.meta // {
     description = "System to facilitate installing and updating packages - Qt";
   };
diff --git a/pkgs/tools/security/proxmark3/default.nix b/pkgs/tools/security/proxmark3/default.nix
index 3b1f21ac718..b52e7279fa9 100644
--- a/pkgs/tools/security/proxmark3/default.nix
+++ b/pkgs/tools/security/proxmark3/default.nix
@@ -15,6 +15,8 @@ let
       nativeBuildInputs = [ pkg-config gcc-arm-embedded ];
       buildInputs = [ ncurses readline pcsclite qt5.qtbase ];
 
+      dontWrapQtApps = true;
+
       postPatch = ''
         substituteInPlace client/Makefile --replace '-ltermcap' ' '
         substituteInPlace liblua/Makefile --replace '-ltermcap' ' '