git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #54525 from ttuegel/feature/qt-5/wrap-qt-apps

Wrap Qt applications

commit56d5963382da1b4848615aa9139e527978c64670 authorThomas Tuegel <ttuegel@mailbox.org> dateFri 5 Jul 2019, 14:38 (7 years ago) parent066491c3adc9d0
60 files changed+659−458
doc/languages-frameworks/qt.xml+167−65 nixos/modules/services/x11/desktop-managers/plasma5.nix+2−2 pkgs/applications/altcoins/bitcoin.nix+9−6 pkgs/applications/altcoins/monero-gui/default.nix+3−8 pkgs/applications/audio/carla/default.nix+8−5 pkgs/applications/audio/kid3/default.nix+3−6 pkgs/applications/editors/kdevelop5/kdevelop.nix+3−2 pkgs/applications/gis/openorienteering-mapper/default.nix+3−5 pkgs/applications/graphics/ktikz/default.nix+3−7 pkgs/applications/kde/ark/default.nix+20−18 pkgs/applications/kde/okular.nix+6−6 pkgs/applications/misc/albert/default.nix−5 pkgs/applications/misc/electron-cash/default.nix+2−6 pkgs/applications/misc/keepassx/community.nix+4−5 pkgs/applications/misc/masterpdfeditor/default.nix+2−7 pkgs/applications/misc/subsurface/default.nix+2−7 pkgs/applications/misc/xpdf/default.nix+4−7 pkgs/applications/networking/browsers/qtchan/default.nix+1−6 pkgs/applications/networking/instant-messengers/telegram/tdesktop/generic.nix+4−3 pkgs/applications/networking/linssid/default.nix+4−7 pkgs/applications/networking/mumble/default.nix+2−7 pkgs/applications/networking/newsreaders/quiterss/default.nix+2−7 pkgs/applications/networking/nextcloud-client/default.nix+6−6 pkgs/applications/networking/protonmail-bridge/default.nix+3−10 pkgs/applications/networking/sniffers/wireshark/default.nix+2−5 pkgs/applications/office/kmymoney/default.nix+6−6 pkgs/applications/office/scribus/unstable.nix+4−8 pkgs/applications/science/astronomy/stellarium/default.nix+3−8 pkgs/applications/science/electronics/dsview/default.nix+2−7 pkgs/applications/version-management/p4v/default.nix+5−5 pkgs/applications/video/avidemux/default.nix+10−5 pkgs/applications/video/minitube/default.nix+2−7 pkgs/desktops/plasma-5/plasma-workspace/default.nix+4−7 pkgs/development/compilers/nextpnr/default.nix+5−10 pkgs/development/libraries/cutelyst/default.nix+2−8 pkgs/development/libraries/gsettings-qt/default.nix+5−1 pkgs/development/libraries/kde-frameworks/default.nix+3−12 pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh+59−5 pkgs/development/libraries/kde-frameworks/kinit/default.nix+1−3 pkgs/development/libraries/qt-5/5.11/default.nix+24−10 pkgs/development/libraries/qt-5/5.12/default.nix+24−10 pkgs/development/libraries/qt-5/5.6/default.nix+22−8 pkgs/development/libraries/qt-5/5.9/default.nix+22−8 pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh+12−10 pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh+106 pkgs/development/libraries/qt-5/mkDerivation.nix+5−3 pkgs/development/libraries/qt-5/modules/qtspeech.nix+1−1 pkgs/development/r-modules/wrapper-rstudio.nix+5−4 pkgs/development/tools/analysis/hopper/default.nix+12−14 pkgs/development/tools/qtcreator/default.nix+8−8 pkgs/development/tools/tora/default.nix+3−4 pkgs/games/chessx/default.nix−3 pkgs/games/flightgear/default.nix+4−5 pkgs/games/nethack/default.nix+6−7 pkgs/misc/emulators/mgba/default.nix+2−4 pkgs/tools/graphics/nifskope/default.nix+4−8 pkgs/tools/misc/partition-manager/default.nix+3−7 pkgs/tools/misc/yubikey-manager-qt/default.nix+13−22 pkgs/tools/security/nitrokey-app/default.nix+3−8 pkgs/top-level/all-packages.nix+4−4
doc/languages-frameworks/qt.xml+167−65
@@ -4,71 +4,173 @@
44 <title>Qt</title>
55
66 <para>
7− Qt is a comprehensive desktop and mobile application development toolkit for
8− C++. Legacy support is available for Qt 3 and Qt 4, but all current
9− development uses Qt 5. The Qt 5 packages in Nixpkgs are updated frequently to
10− take advantage of new features, but older versions are typically retained
11− until their support window ends. The most important consideration in
12− packaging Qt-based software is ensuring that each package and all its
13− dependencies use the same version of Qt 5; this consideration motivates most
14− of the tools described below.
7+ This section describes the differences between Nix expressions for Qt
8+ libraries and applications and Nix expressions for other C++ software. Some
9+ knowledge of the latter is assumed. There are primarily two problems which
10+ the Qt infrastructure is designed to address: ensuring consistent versioning
11+ of all dependencies and finding dependencies at runtime.
1512 </para>
1613
17− <section xml:id="ssec-qt-libraries">
18− <title>Packaging Libraries for Nixpkgs</title>
19−
20− <para>
21− Whenever possible, libraries that use Qt 5 should be built with each
22− available version. Packages providing libraries should be added to the
23− top-level function <varname>mkLibsForQt5</varname>, which is used to build a
24− set of libraries for every Qt 5 version. A special
25− <varname>callPackage</varname> function is used in this scope to ensure that
26− the entire dependency tree uses the same Qt 5 version. Import dependencies
27− unqualified, i.e., <literal>qtbase</literal> not
28− <literal>qt5.qtbase</literal>. <emphasis>Do not</emphasis> import a package
29− set such as <literal>qt5</literal> or <literal>libsForQt5</literal>.
30− </para>
31−
32− <para>
33− If a library does not support a particular version of Qt 5, it is best to
34− mark it as broken by setting its <literal>meta.broken</literal> attribute. A
35− package may be marked broken for certain versions by testing the
36− <literal>qtbase.version</literal> attribute, which will always give the
37− current Qt 5 version.
38− </para>
39− </section>
40−
41− <section xml:id="ssec-qt-applications">
42− <title>Packaging Applications for Nixpkgs</title>
43−
44− <para>
45− Call your application expression using
46− <literal>libsForQt5.callPackage</literal> instead of
47− <literal>callPackage</literal>. Import dependencies unqualified, i.e.,
48− <literal>qtbase</literal> not <literal>qt5.qtbase</literal>. <emphasis>Do
49− not</emphasis> import a package set such as <literal>qt5</literal> or
50− <literal>libsForQt5</literal>.
51− </para>
52−
53− <para>
54− Qt 5 maintains strict backward compatibility, so it is generally best to
55− build an application package against the latest version using the
56− <varname>libsForQt5</varname> library set. In case a package does not build
57− with the latest Qt version, it is possible to pick a set pinned to a
58− particular version, e.g. <varname>libsForQt55</varname> for Qt 5.5, if that
59− is the latest version the package supports. If a package must be pinned to
60− an older Qt version, be sure to file a bug upstream; because Qt is strictly
61− backwards-compatible, any incompatibility is by definition a bug in the
62− application.
63− </para>
64−
65− <para>
66− When testing applications in Nixpkgs, it is a common practice to build the
67− package with <literal>nix-build</literal> and run it using the created
68− symbolic link. This will not work with Qt applications, however, because
69− they have many hard runtime requirements that can only be guaranteed if the
70− package is actually installed. To test a Qt application, install it with
71− <literal>nix-env</literal> or run it inside <literal>nix-shell</literal>.
72− </para>
73− </section>
14+ <example xml:id='qt-default-nix'>
15+ <title>Nix expression for a Qt package (<filename>default.nix</filename>)</title>
16+ <programlisting>
17+{ mkDerivation, lib, qtbase }: <co xml:id='qt-default-nix-co-1' />
18+
19+mkDerivation { <co xml:id='qt-default-nix-co-2' />
20+ pname = "myapp";
21+ version = "1.0";
22+
23+ buildInputs = [ qtbase ]; <co xml:id='qt-default-nix-co-3' />
24+}
25+ </programlisting>
26+ </example>
27+
28+ <calloutlist>
29+ <callout arearefs='qt-default-nix-co-1'>
30+ <para>
31+ Import <literal>mkDerivation</literal> and Qt (such as
32+ <literal>qtbase</literal> modules directly. <emphasis>Do not</emphasis>
33+ import Qt package sets; the Qt versions of dependencies may not be
34+ coherent, causing build and runtime failures.
35+ </para>
36+ </callout>
37+ <callout arearefs='qt-default-nix-co-2'>
38+ <para>
39+ Use <literal>mkDerivation</literal> instead of
40+ <literal>stdenv.mkDerivation</literal>. <literal>mkDerivation</literal>
41+ is a wrapper around <literal>stdenv.mkDerivation</literal> which
42+ applies some Qt-specific settings.
43+ This deriver accepts the same arguments as
44+ <literal>stdenv.mkDerivation</literal>; refer to
45+ <xref linkend='chap-stdenv' /> for details.
46+ </para>
47+ <para>
48+ To use another deriver instead of
49+ <literal>stdenv.mkDerivation</literal>, use
50+ <literal>mkDerivationWith</literal>:
51+<programlisting>
52+mkDerivationWith myDeriver {
53+ # ...
54+}
55+</programlisting>
56+ If you cannot use <literal>mkDerivationWith</literal>, please refer to
57+ <xref linkend='qt-runtime-dependencies' />.
58+ </para>
59+ </callout>
60+ <callout arearefs='qt-default-nix-co-3'>
61+ <para>
62+ <literal>mkDerivation</literal> accepts the same arguments as
63+ <literal>stdenv.mkDerivation</literal>, such as
64+ <literal>buildInputs</literal>.
65+ </para>
66+ </callout>
67+ </calloutlist>
68+
69+ <formalpara xml:id='qt-runtime-dependencies'>
70+ <title>Locating runtime dependencies</title>
71+ <para>
72+ Qt applications need to be wrapped to find runtime dependencies. If you
73+ cannot use <literal>mkDerivation</literal> or
74+ <literal>mkDerivationWith</literal> above, include
75+ <literal>wrapQtAppsHook</literal> in <literal>nativeBuildInputs</literal>:
76+<programlisting>
77+stdenv.mkDerivation {
78+ # ...
79+
80+ nativeBuildInputs = [ wrapQtAppsHook ];
81+}
82+</programlisting>
83+ </para>
84+ </formalpara>
85+
86+ <para>
87+ Entries added to <literal>qtWrapperArgs</literal> are used to modify the
88+ wrappers created by <literal>wrapQtAppsHook</literal>. The entries are
89+ passed as arguments to <xref linkend='fun-wrapProgram' />.
90+<programlisting>
91+mkDerivation {
92+ # ...
93+
94+ qtWrapperArgs = [ ''--prefix PATH : /path/to/bin'' ];
95+}
96+</programlisting>
97+ </para>
98+
99+ <para>
100+ Set <literal>dontWrapQtApps</literal> to stop applications from being
101+ wrapped automatically. It is required to wrap applications manually with
102+ <literal>wrapQtApp</literal>, using the syntax of
103+ <xref linkend='fun-wrapProgram' />:
104+<programlisting>
105+mkDerivation {
106+ # ...
107+
108+ dontWrapQtApps = true;
109+ preFixup = ''
110+ wrapQtApp "$out/bin/myapp" --prefix PATH : /path/to/bin
111+ '';
112+}
113+</programlisting>
114+ </para>
115+
116+ <para>
117+ Libraries are built with every available version of Qt. Use the <literal>meta.broken</literal>
118+ attribute to disable the package for unsupported Qt versions:
119+<programlisting>
120+mkDerivation {
121+ # ...
122+
123+ # Disable this library with Qt &lt; 5.9.0
124+ meta.broken = builtins.compareVersions qtbase.version "5.9.0" &lt; 0;
125+}
126+</programlisting>
127+ </para>
128+
129+ <formalpara>
130+ <title>Adding a library to Nixpkgs</title>
131+ <para>
132+ Add a Qt library to <filename>all-packages.nix</filename> by adding it to the
133+ collection inside <literal>mkLibsForQt5</literal>. This ensures that the
134+ library is built with every available version of Qt as needed.
135+ <example xml:id='qt-library-all-packages-nix'>
136+ <title>Adding a Qt library to <filename>all-packages.nix</filename></title>
137+<programlisting>
138+{
139+ # ...
140+
141+ mkLibsForQt5 = self: with self; {
142+ # ...
143+
144+ mylib = callPackage ../path/to/mylib {};
145+ };
146+
147+ # ...
148+}
149+</programlisting>
150+ </example>
151+ </para>
152+ </formalpara>
153+
154+ <formalpara>
155+ <title>Adding an application to Nixpkgs</title>
156+ <para>
157+ Add a Qt application to <filename>all-packages.nix</filename> using
158+ <literal>libsForQt5.callPackage</literal> instead of the usual
159+ <literal>callPackage</literal>. The former ensures that all dependencies
160+ are built with the same version of Qt.
161+ <example xml:id='qt-application-all-packages-nix'>
162+ <title>Adding a Qt application to <filename>all-packages.nix</filename></title>
163+<programlisting>
164+{
165+ # ...
166+
167+ myapp = libsForQt5.callPackage ../path/to/myapp/ {};
168+
169+ # ...
170+}
171+</programlisting>
172+ </example>
173+ </para>
174+ </formalpara>
175+
74176</section>
nixos/modules/services/x11/desktop-managers/plasma5.nix+2−2
@@ -64,8 +64,8 @@ in
6464 };
6565
6666 security.wrappers = {
67− kcheckpass.source = "${lib.getBin plasma5.kscreenlocker}/lib/libexec/kcheckpass";
68− "start_kdeinit".source = "${lib.getBin pkgs.kinit}/lib/libexec/kf5/start_kdeinit";
67+ kcheckpass.source = "${lib.getBin plasma5.kscreenlocker}/libexec/kcheckpass";
68+ "start_kdeinit".source = "${lib.getBin pkgs.kinit}/libexec/kf5/start_kdeinit";
6969 kwin_wayland = {
7070 source = "${lib.getBin plasma5.kwin}/bin/kwin_wayland";
7171 capabilities = "cap_sys_nice+ep";
pkgs/applications/altcoins/bitcoin.nix+9−6
@@ -1,5 +1,5 @@
11{ stdenv, fetchurl, pkgconfig, autoreconfHook, openssl, db48, boost, zeromq, rapidcheck
2−, zlib, miniupnpc, qtbase ? null, qttools ? null, utillinux, protobuf, python3, qrencode, libevent
2+, zlib, miniupnpc, qtbase ? null, qttools ? null, wrapQtAppsHook ? null, utillinux, protobuf, python3, qrencode, libevent
33, withGui }:
44
55with stdenv.lib;
@@ -14,7 +14,9 @@ stdenv.mkDerivation rec{
1414 sha256 = "5e4e6890e07b620a93fdb24605dae2bb53e8435b2a93d37558e1db1913df405f";
1515 };
1616
17− nativeBuildInputs = [ pkgconfig autoreconfHook ];
17+ nativeBuildInputs =
18+ [ pkgconfig autoreconfHook ]
19+ ++ optional withGui wrapQtAppsHook;
1820 buildInputs = [ openssl db48 boost zlib zeromq
1921 miniupnpc protobuf libevent]
2022 ++ optionals stdenv.isLinux [ utillinux ]
@@ -34,10 +36,11 @@ stdenv.mkDerivation rec{
3436
3537 doCheck = true;
3638
37− # QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI.
38− # See also https://github.com/NixOS/nixpkgs/issues/24256
39− checkFlags = optionals withGui [ "QT_PLUGIN_PATH=${qtbase}/lib/qt-5.${versions.minor qtbase.version}/plugins" ]
40− ++ [ "LC_ALL=C.UTF-8" ];
39+ checkFlags =
40+ [ "LC_ALL=C.UTF-8" ]
41+ # QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI.
42+ # See also https://github.com/NixOS/nixpkgs/issues/24256
43+ ++ optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}";
4144
4245 enableParallelBuilding = true;
4346
pkgs/applications/altcoins/monero-gui/default.nix+3−8
@@ -1,5 +1,5 @@
11{ stdenv, fetchFromGitHub
2−, makeWrapper, makeDesktopItem
2+, wrapQtAppsHook, makeDesktopItem
33, qtbase, qmake, qtmultimedia, qttools
44, qtgraphicaleffects, qtdeclarative
55, qtlocation, qtquickcontrols, qtquickcontrols2
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
3434 sha256 = "1l4kx2vidr7bpds43jdbwyaz0q1dy7sricpz061ff1fkappbxdh8";
3535 };
3636
37− nativeBuildInputs = [ qmake pkgconfig ];
37+ nativeBuildInputs = [ qmake pkgconfig wrapQtAppsHook ];
3838
3939 buildInputs = [
4040 qtbase qtmultimedia qtgraphicaleffects
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
4343 qtwebchannel qtwebengine qtx11extras
4444 qtxmlpatterns monero unbound readline
4545 boost libunwind libsodium pcsclite zeromq
46− cppzmq makeWrapper hidapi
46+ cppzmq hidapi
4747 ];
4848
4949 patches = [
@@ -94,11 +94,6 @@ stdenv.mkDerivation rec {
9494 cp $src/images/appicons/$size.png \
9595 $out/share/icons/hicolor/$size/apps/monero.png
9696 done;
97−
98− # wrap runtime dependencies
99− wrapProgram $out/bin/monero-wallet-gui \
100− --set QML2_IMPORT_PATH "${qml2ImportPath}" \
101− --set QT_PLUGIN_PATH "${qtbase.bin}/${qtbase.qtPluginPrefix}"
10297 '';
10398
10499 meta = {
pkgs/applications/audio/carla/default.nix+8−5
@@ -1,7 +1,7 @@
11{ stdenv, fetchFromGitHub, alsaLib, file, fluidsynth, ffmpeg, jack2,
22 liblo, libpulseaudio, libsndfile, pkgconfig, python3Packages,
33 which, withFrontend ? true,
4− withQt ? true, qtbase ? null,
4+ withQt ? true, qtbase ? null, wrapQtAppsHook ? null,
55 withGtk2 ? true, gtk2 ? null,
66 withGtk3 ? true, gtk3 ? null }:
77
@@ -9,6 +9,7 @@ with stdenv.lib;
99
1010assert withFrontend -> python3Packages ? pyqt5;
1111assert withQt -> qtbase != null;
12+assert withQt -> wrapQtAppsHook != null;
1213assert withGtk2 -> gtk2 != null;
1314assert withGtk3 -> gtk3 != null;
1415
@@ -23,7 +24,9 @@ stdenv.mkDerivation rec {
2324 sha256 = "0fqgncqlr86n38yy7pa118mswfacmfczj7w9xx6c6k0jav3wk29k";
2425 };
2526
26− nativeBuildInputs = [ python3Packages.wrapPython pkgconfig which ];
27+ nativeBuildInputs = [
28+ python3Packages.wrapPython pkgconfig which wrapQtAppsHook
29+ ];
2730
2831 pythonPath = with python3Packages; [
2932 rdflib pyliblo
@@ -38,6 +41,7 @@ stdenv.mkDerivation rec {
3841
3942 installFlags = [ "PREFIX=$(out)" ];
4043
44+ dontWrapQtApps = true;
4145 postFixup = ''
4246 # Also sets program_PYTHONPATH and program_PATH variables
4347 wrapPythonPrograms
@@ -48,10 +52,9 @@ stdenv.mkDerivation rec {
4852 patchPythonScript "$out/share/carla/carla_settings.py"
4953
5054 for program in $out/bin/*; do
51− wrapProgram "$program" \
55+ wrapQtApp "$program" \
5256 --prefix PATH : "$program_PATH:${which}/bin" \
53− --set PYTHONNOUSERSITE true \
54− --prefix QT_PLUGIN_PATH : "${qtbase.bin}/${qtbase.qtPluginPrefix}"
57+ --set PYTHONNOUSERSITE true
5558 done
5659 '';
5760
pkgs/applications/audio/kid3/default.nix+3−6
@@ -3,7 +3,7 @@
33, chromaprint, docbook_xml_dtd_45, docbook_xsl, libxslt
44, id3lib, taglib, mp4v2, flac, libogg, libvorbis
55, zlib, readline , qtbase, qttools, qtmultimedia, qtquickcontrols
6−, makeWrapper
6+, wrapQtAppsHook
77}:
88
99stdenv.mkDerivation rec {
@@ -16,11 +16,12 @@ stdenv.mkDerivation rec {
1616 sha256 = "0xkrsjrbr3z8cn8hjf623l28r3b755gr11i0clv8d8i3s10vhbd8";
1717 };
1818
19+ nativeBuildInputs = [ wrapQtAppsHook ];
1920 buildInputs = with stdenv.lib;
2021 [ pkgconfig cmake python ffmpeg phonon automoc4
2122 chromaprint docbook_xml_dtd_45 docbook_xsl libxslt
2223 id3lib taglib mp4v2 flac libogg libvorbis zlib readline
23− qtbase qttools qtmultimedia qtquickcontrols makeWrapper ];
24+ qtbase qttools qtmultimedia qtquickcontrols ];
2425
2526 cmakeFlags = [ "-DWITH_APPS=Qt;CLI" ];
2627 NIX_LDFLAGS = "-lm -lpthread";
@@ -29,10 +30,6 @@ stdenv.mkDerivation rec {
2930 export DOCBOOKDIR="${docbook_xsl}/xml/xsl/docbook/"
3031 '';
3132
32− postInstall = ''
33− wrapProgram $out/bin/kid3-qt --prefix QT_PLUGIN_PATH : $out/lib/qt5/plugins
34− '';
35−
3633 enableParallelBuilding = true;
3734
3835 meta = with stdenv.lib; {
pkgs/applications/editors/kdevelop5/kdevelop.nix+3−2
@@ -43,6 +43,8 @@ mkDerivation rec {
4343 "-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${(builtins.parseDrvName llvmPackages.clang.name).version}/include"
4444 ];
4545
46+ dontWrapQtApps = true;
47+
4648 postPatch = ''
4749 # FIXME: temporary until https://invent.kde.org/kde/kdevelop/merge_requests/8 is merged
4850 substituteInPlace kdevplatform/language/backgroundparser/parsejob.cpp --replace \
@@ -55,8 +57,7 @@ mkDerivation rec {
5557 wrapProgram "$out/bin/kdevelop!" \
5658 --prefix PATH ":" "${lib.makeBinPath [ qttools kde-cli-tools ]}"
5759
58− wrapProgram "$out/bin/kdevelop" \
59− --prefix QT_PLUGIN_PATH : $out/lib/qt-${qtVersion}/plugins
60+ wrapQtApp "$out/bin/kdevelop"
6061
6162 # Fix the (now wrapped) kdevelop! to find things in right places:
6263 # - Fixup the one use where KDEV_BASEDIR is assumed to contain kdevelop.
pkgs/applications/gis/openorienteering-mapper/default.nix+3−5
@@ -1,5 +1,5 @@
11{ stdenv, fetchFromGitHub, gdal, cmake, ninja, proj, clipper, zlib, qtbase, qttools
2− , qtlocation, qtsensors, doxygen, cups, makeWrapper, qtimageformats
2+, qtlocation, qtsensors, doxygen, cups, wrapQtAppsHook, qtimageformats
33}:
44
55stdenv.mkDerivation rec {
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
99 buildInputs = [ gdal qtbase qttools qtlocation qtimageformats
1010 qtsensors clipper zlib proj doxygen cups];
1111
12− nativeBuildInputs = [ cmake makeWrapper ninja ];
12+ nativeBuildInputs = [ cmake wrapQtAppsHook ninja ];
1313
1414 src = fetchFromGitHub {
1515 owner = "OpenOrienteering";
@@ -48,9 +48,7 @@ stdenv.mkDerivation rec {
4848 stdenv.lib.optionalString stdenv.isDarwin ''
4949 # Fixes "This application failed to start because it could not find or load the Qt
5050 # platform plugin "cocoa"."
51− wrapProgram $out/Mapper.app/Contents/MacOS/Mapper \
52− --set QT_QPA_PLATFORM_PLUGIN_PATH ${qtbase.bin}/lib/qt-*/plugins/platforms \
53− --set QT_PLUGIN_PATH ${qtbase.bin}/${qtbase.qtPluginPrefix}:${qtimageformats}/${qtbase.qtPluginPrefix}
51+ wrapQtApp $out/Mapper.app/Contents/MacOS/Mapper
5452 mkdir -p $out/bin
5553 ln -s $out/Mapper.app/Contents/MacOS/Mapper $out/bin/mapper
5654 '';
pkgs/applications/graphics/ktikz/default.nix+3−7
@@ -1,5 +1,5 @@
11{ stdenv, fetchFromGitHub, fetchpatch
2−, pkgconfig, makeWrapper
2+, pkgconfig, wrapQtAppsHook
33, poppler, qt5, gnuplot
44}:
55
@@ -36,9 +36,9 @@ stdenv.mkDerivation rec {
3636 })
3737 ];
3838
39+ nativeBuildInputs = [ pkgconfig qt5.qttools qt5.qmake wrapQtAppsHook ];
3940 QT_PLUGIN_PATH = "${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}";
4041
41− nativeBuildInputs = [ pkgconfig qt5.qttools qt5.qmake makeWrapper ];
4242 buildInputs = [ qt5.qtbase poppler ];
4343 enableParallelBuilding = true;
4444
@@ -50,9 +50,5 @@ stdenv.mkDerivation rec {
5050 "QCOLLECTIONGENERATORCOMMAND=qhelpgenerator"
5151 ];
5252
53− postFixup = ''
54− wrapProgram "$out/bin/qtikz" \
55− --prefix QT_PLUGIN_PATH : "${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}" \
56− --prefix PATH : "${gnuplot}/bin"
57− '';
53+ qtWrapperArgs = [ ''--prefix PATH : "${gnuplot}/bin"'' ];
5854}
pkgs/applications/kde/ark/default.nix+20−18
@@ -1,37 +1,39 @@
11{
2− mkDerivation, lib, makeWrapper,
2+ mkDerivation, lib, config,
33
44 extra-cmake-modules, kdoctools,
55
6− karchive, kconfig, kcrash, kdbusaddons, ki18n, kiconthemes, kitemmodels,
7− khtml, kio, kparts, kpty, kservice, kwidgetsaddons, libarchive,
6+ breeze-icons, karchive, kconfig, kcrash, kdbusaddons, ki18n,
7+ kiconthemes, kitemmodels, khtml, kio, kparts, kpty, kservice, kwidgetsaddons,
8+
9+ libarchive, libzip,
810
911 # Archive tools
10− p7zip, unzip, zip,
12+ p7zip, lrzip,
1113
1214 # Unfree tools
1315 unfreeEnableUnrar ? false, unrar,
1416}:
1517
18+let
19+ extraTools = [ p7zip lrzip ] ++ lib.optional unfreeEnableUnrar unrar;
20+in
21+
1622mkDerivation {
1723 name = "ark";
18− nativeBuildInputs = [ extra-cmake-modules kdoctools makeWrapper ];
19− propagatedBuildInputs = [
20− karchive kconfig kcrash kdbusaddons khtml ki18n kiconthemes kio kitemmodels
21− kparts kpty kservice kwidgetsaddons libarchive
22− ];
23− outputs = [ "out" "dev" ];
24− postFixup =
25− let
26− PATH =
27− lib.makeBinPath
28− ([ p7zip unzip zip ] ++ lib.optional unfreeEnableUnrar unrar);
29− in ''
30− wrapProgram "$out/bin/ark" --prefix PATH : "${PATH}"
31− '';
3224 meta = {
3325 license = with lib.licenses;
3426 [ gpl2 lgpl3 ] ++ lib.optional unfreeEnableUnrar unfree;
3527 maintainers = [ lib.maintainers.ttuegel ];
3628 };
29+
30+ outputs = [ "out" "dev" ];
31+ nativeBuildInputs = [ extra-cmake-modules kdoctools ];
32+ buildInputs = [ libarchive libzip ] ++ extraTools;
33+ propagatedBuildInputs = [
34+ breeze-icons karchive kconfig kcrash kdbusaddons khtml ki18n kiconthemes kio
35+ kitemmodels kparts kpty kservice kwidgetsaddons
36+ ];
37+
38+ qtWrapperArgs = [ "--prefix" "PATH" ":" (lib.makeBinPath extraTools) ];
3739}
pkgs/applications/kde/okular.nix+6−6
@@ -1,18 +1,18 @@
11{
22 stdenv, mkDerivation, lib,
33 extra-cmake-modules, kdoctools,
4− chmlib ? null, discount, djvulibre, ebook_tools, kactivities, karchive, kbookmarks,
5− kcompletion, kconfig, kconfigwidgets, kcoreaddons, kdbusaddons,
6− kdegraphics-mobipocket, kiconthemes, kjs, khtml, kio, kparts, kpty, kwallet,
7− kwindowsystem, libkexiv2, libspectre, libzip, phonon, poppler, qca-qt5,
8− qtdeclarative, qtsvg, threadweaver, kcrash
4+ breeze-icons, chmlib ? null, discount, djvulibre, ebook_tools, kactivities,
5+ karchive, kbookmarks, kcompletion, kconfig, kconfigwidgets, kcoreaddons,
6+ kdbusaddons, kdegraphics-mobipocket, kiconthemes, kjs, khtml, kio, kparts,
7+ kpty, kwallet, kwindowsystem, libkexiv2, libspectre, libzip, phonon, poppler,
8+ qca-qt5, qtdeclarative, qtsvg, threadweaver, kcrash
99}:
1010
1111mkDerivation {
1212 name = "okular";
1313 nativeBuildInputs = [ extra-cmake-modules kdoctools ];
1414 buildInputs = [
15− discount djvulibre ebook_tools kactivities karchive kbookmarks
15+ breeze-icons discount djvulibre ebook_tools kactivities karchive kbookmarks
1616 kcompletion kconfig kconfigwidgets kcoreaddons kdbusaddons
1717 kdegraphics-mobipocket kiconthemes kjs khtml kio kparts kpty kwallet
1818 kwindowsystem libkexiv2 libspectre libzip phonon poppler qca-qt5
pkgs/applications/misc/albert/default.nix−5
@@ -37,11 +37,6 @@ mkDerivation rec {
3737 rm "$out/lib"
3838 '';
3939
40− postInstall = ''
41− wrapProgram $out/bin/albert \
42− --prefix XDG_DATA_DIRS : $out/share
43− '';
44−
4540 meta = with lib; {
4641 homepage = https://albertlauncher.github.io/;
4742 description = "Desktop agnostic launcher";
pkgs/applications/misc/electron-cash/default.nix+2−6
@@ -1,4 +1,4 @@
1−{ lib, fetchurl, python3Packages, qtbase, makeWrapper }:
1+{ lib, fetchurl, python3Packages, qtbase, wrapQtAppsHook }:
22
33python3Packages.buildPythonApplication rec {
44 pname = "electron-cash";
@@ -32,7 +32,7 @@ python3Packages.buildPythonApplication rec {
3232 btchip
3333 ];
3434
35− nativeBuildInputs = [ makeWrapper ];
35+ nativeBuildInputs = [ wrapQtAppsHook ];
3636
3737 postPatch = ''
3838 substituteInPlace contrib/requirements/requirements.txt \
@@ -54,10 +54,6 @@ python3Packages.buildPythonApplication rec {
5454 postInstall = ''
5555 substituteInPlace $out/share/applications/electron-cash.desktop \
5656 --replace "Exec=electron-cash" "Exec=$out/bin/electron-cash"
57−
58− # Please remove this when #44047 is fixed
59− wrapProgram $out/bin/electron-cash \
60− --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-5.${lib.versions.minor qtbase.version}/plugins
6157 '';
6258
6359 doInstallCheck = true;
pkgs/applications/misc/keepassx/community.nix+4−5
@@ -17,6 +17,7 @@
1717, qtsvg
1818, qtx11extras
1919, quazip
20+, wrapQtAppsHook
2021, yubikey-personalization
2122, zlib
2223
@@ -73,12 +74,11 @@ stdenv.mkDerivation rec {
7374 doCheck = true;
7475 checkPhase = ''
7576 export LC_ALL="en_US.UTF-8"
76− export QT_PLUGIN_PATH="${qtbase.bin}/${qtbase.qtPluginPrefix}"
7777 export QT_QPA_PLATFORM=offscreen
7878 make test ARGS+="-E testgui --output-on-failure"
7979 '';
8080
81− nativeBuildInputs = [ cmake makeWrapper qttools ];
81+ nativeBuildInputs = [ cmake wrapQtAppsHook qttools ];
8282
8383 buildInputs = [
8484 curl
@@ -102,10 +102,9 @@ stdenv.mkDerivation rec {
102102 ++ stdenv.lib.optional withKeePassKeeShareSecure quazip
103103 ++ stdenv.lib.optional stdenv.isDarwin qtmacextras;
104104
105− postInstall = optionalString stdenv.isDarwin ''
105+ preFixup = optionalString stdenv.isDarwin ''
106106 # Make it work without Qt in PATH.
107− wrapProgram $out/Applications/KeePassXC.app/Contents/MacOS/KeePassXC \
108− --set QT_PLUGIN_PATH ${qtbase.bin}/${qtbase.qtPluginPrefix}
107+ wrapQtApp $out/Applications/KeePassXC.app/Contents/MacOS/KeePassXC
109108 '';
110109
111110 meta = {
pkgs/applications/misc/masterpdfeditor/default.nix+2−7
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, sane-backends, qtbase, qtsvg, nss, autoPatchelfHook, lib, makeWrapper }:
1+{ stdenv, fetchurl, sane-backends, qtbase, qtsvg, nss, autoPatchelfHook, lib, wrapQtAppsHook }:
22
33let
44 version = "5.4.10";
@@ -11,17 +11,12 @@ in stdenv.mkDerivation {
1111 sha256 = "1902ahb2g9xanrip1n0ihr31az8sv9fsvzddnzf70kbwlfclnqf7";
1212 };
1313
14− nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
14+ nativeBuildInputs = [ autoPatchelfHook wrapQtAppsHook ];
1515
1616 buildInputs = [ nss qtbase qtsvg sane-backends stdenv.cc.cc ];
1717
1818 dontStrip = true;
1919
20− # Please remove this when #44047 is fixed
21− postInstall = ''
22− wrapProgram $out/bin/masterpdfeditor5 --prefix QT_PLUGIN_PATH : ${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
23− '';
24−
2520 installPhase = ''
2621 runHook preInstall
2722
pkgs/applications/misc/subsurface/default.nix+2−7
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, fetchFromGitHub, autoreconfHook, cmake, makeWrapper, pkgconfig, qmake
1+{ stdenv, fetchurl, fetchFromGitHub, autoreconfHook, cmake, wrapQtAppsHook, pkgconfig, qmake
22, curl, grantlee, libgit2, libusb, libssh2, libxml2, libxslt, libzip, zlib
33, qtbase, qtconnectivity, qtlocation, qtsvg, qttools, qtwebkit, libXcomposite
44}:
@@ -79,18 +79,13 @@ in stdenv.mkDerivation rec {
7979 qtbase qtconnectivity qtsvg qttools qtwebkit
8080 ];
8181
82− nativeBuildInputs = [ cmake makeWrapper pkgconfig ];
82+ nativeBuildInputs = [ cmake wrapQtAppsHook pkgconfig ];
8383
8484 cmakeFlags = [
8585 "-DLIBDC_FROM_PKGCONFIG=ON"
8686 "-DNO_PRINTING=OFF"
8787 ];
8888
89− postInstall = ''
90− wrapProgram $out/bin/subsurface \
91− --prefix QT_PLUGIN_PATH : "${googlemaps}/${googlemaps.pluginsSubdir}"
92− '';
93−
9489 enableParallelBuilding = true;
9590
9691 passthru = { inherit version libdc googlemaps; };
pkgs/applications/misc/xpdf/default.nix+4−7
@@ -1,6 +1,6 @@
11{ enableGUI ? true, enablePDFtoPPM ? true, useT1Lib ? false
22, stdenv, fetchurl, zlib, libpng, freetype ? null, t1lib ? null
3−, cmake, qtbase ? null, qtsvg ? null, makeWrapper
3+, cmake, qtbase ? null, qtsvg ? null, wrapQtAppsHook
44}:
55
66assert enableGUI -> qtbase != null && qtsvg != null && freetype != null;
@@ -22,7 +22,9 @@ stdenv.mkDerivation {
2222 # https://cmake.org/cmake/help/v3.10/command/cmake_minimum_required.html
2323 patches = stdenv.lib.optional stdenv.isDarwin ./cmake_version.patch;
2424
25− nativeBuildInputs = [ cmake makeWrapper ];
25+ nativeBuildInputs =
26+ [ cmake ]
27+ ++ stdenv.lib.optional enableGUI wrapQtAppsHook;
2628
2729 cmakeFlags = ["-DSYSTEM_XPDFRC=/etc/xpdfrc" "-DA4_PAPER=ON"];
2830
@@ -36,11 +38,6 @@ stdenv.mkDerivation {
3638
3739 hardeningDisable = [ "format" ];
3840
39− postInstall = stdenv.lib.optionalString (stdenv.isDarwin && enableGUI) ''
40− wrapProgram $out/bin/xpdf \
41− --set QT_PLUGIN_PATH ${qtbase.bin}/${qtbase.qtPluginPrefix}:${qtsvg.bin}/${qtbase.qtPluginPrefix}
42− '';
43−
4441 meta = with stdenv.lib; {
4542 homepage = https://www.xpdfreader.com;
4643 description = "Viewer for Portable Document Format (PDF) files";
pkgs/applications/networking/browsers/qtchan/default.nix+1−6
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
1919 ];
2020
2121 enableParallelBuilding = true;
22− nativeBuildInputs = [ qt.qmake makeWrapper ];
22+ nativeBuildInputs = [ qt.qmake qt.wrapQtAppsHook ];
2323 buildInputs = [ qt.qtbase ];
2424
2525 qmakeFlags = [ "CONFIG-=app_bundle" ];
@@ -29,11 +29,6 @@ stdenv.mkDerivation rec {
2929 cp qtchan $out/bin
3030 '';
3131
32− preFixup = ''
33− wrapProgram $out/bin/qtchan \
34− --suffix QT_PLUGIN_PATH : ${qt.qtbase.bin}/${qt.qtbase.qtPluginPrefix}
35− '';
36−
3732 meta = with stdenv.lib; {
3833 description = "4chan browser in qt5";
3934 homepage = "https://github.com/siavash119/qtchan";
pkgs/applications/networking/instant-messengers/telegram/tdesktop/generic.nix+4−3
@@ -1,7 +1,7 @@
11{ stable, version, sha256Hash, archPatchesRevision, archPatchesHash }:
22
33{ mkDerivation, lib, fetchFromGitHub, fetchsvn
4−, pkgconfig, pythonPackages, cmake, wrapGAppsHook, gcc8
4+, pkgconfig, pythonPackages, cmake, wrapGAppsHook, wrapQtAppsHook, gcc8
55, qtbase, qtimageformats, gtk3, libappindicator-gtk3, libnotify, xdg_utils
66, dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3
77}:
@@ -39,7 +39,7 @@ mkDerivation rec {
3939 --replace '"notify"' '"${libnotify}/lib/libnotify.so"'
4040 '';
4141
42− nativeBuildInputs = [ pkgconfig pythonPackages.gyp cmake wrapGAppsHook gcc8 ];
42+ nativeBuildInputs = [ pkgconfig pythonPackages.gyp cmake wrapGAppsHook wrapQtAppsHook gcc8 ];
4343
4444 # We want to run wrapProgram manually (with additional parameters)
4545 dontWrapGApps = true;
@@ -129,12 +129,13 @@ mkDerivation rec {
129129 done
130130 '';
131131
132+ dontWrapQtApps = true;
132133 postFixup = ''
133134 # This is necessary to run Telegram in a pure environment.
134135 # We also use gappsWrapperArgs from wrapGAppsHook.
135136 wrapProgram $out/bin/telegram-desktop \
136137 "''${gappsWrapperArgs[@]}" \
137− --prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}" \
138+ "''${qtWrapperArgs[@]}" \
138139 --prefix PATH : ${xdg_utils}/bin \
139140 --set XDG_RUNTIME_DIR "XDG-RUNTIME-DIR"
140141 sed -i $out/bin/telegram-desktop \
pkgs/applications/networking/linssid/default.nix+4−7
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, qtbase, qtsvg, qmake, pkgconfig, boost, wirelesstools, iw, qwt, makeWrapper }:
1+{ stdenv, fetchurl, qtbase, qtsvg, qmake, pkgconfig, boost, wirelesstools, iw, qwt, wrapQtAppsHook }:
22
33stdenv.mkDerivation rec {
44 name = "linssid-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
99 sha256 = "13d35rlcjncd8lx3khkgn9x8is2xjd5fp6ns5xsn3w6l4xj9b4gl";
1010 };
1111
12− nativeBuildInputs = [ pkgconfig qmake makeWrapper ];
12+ nativeBuildInputs = [ pkgconfig qmake wrapQtAppsHook ];
1313 buildInputs = [ qtbase qtsvg boost qwt ];
1414
1515 patches = [ ./0001-unbundled-qwt.patch ];
@@ -26,11 +26,8 @@ stdenv.mkDerivation rec {
2626 rm -fr qwt-lib
2727 '';
2828
29− postInstall = ''
30− wrapProgram $out/bin/linssid \
31− --prefix QT_PLUGIN_PATH : ${qtbase}/${qtbase.qtPluginPrefix} \
32− --prefix PATH : ${stdenv.lib.makeBinPath [ wirelesstools iw ]}
33− '';
29+ qtWrapperArgs =
30+ [ ''--prefix PATH : ${stdenv.lib.makeBinPath [ wirelesstools iw ]}'' ];
3431
3532 meta = with stdenv.lib; {
3633 description = "Graphical wireless scanning for Linux";
pkgs/applications/networking/mumble/default.nix+2−7
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, fetchFromGitHub, fetchpatch, makeWrapper, pkgconfig
1+{ stdenv, fetchurl, fetchFromGitHub, fetchpatch, pkgconfig
22, qt4, qmake4Hook, qt5, avahi, boost, libopus, libsndfile, protobuf3_6, speex, libcap
33, alsaLib, python
44, jackSupport ? false, libjack2 ? null
@@ -158,11 +158,6 @@ in {
158158 murmur_git = (server gitSource).overrideAttrs (old: {
159159 meta = old.meta // { broken = iceSupport; };
160160
161− nativeBuildInputs = old.nativeBuildInputs or [] ++ [ makeWrapper ];
162−
163− installPhase = old.installPhase or "" + ''
164− wrapProgram $out/bin/murmurd --suffix QT_PLUGIN_PATH : \
165− ${getBin qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}
166− '';
161+ nativeBuildInputs = old.nativeBuildInputs or [] ++ [ qt5.wrapQtAppsHook ];
167162 });
168163}
pkgs/applications/networking/newsreaders/quiterss/default.nix+2−7
@@ -1,4 +1,4 @@
1−{ stdenv, fetchFromGitHub, qmake, pkgconfig, makeWrapper
1+{ stdenv, fetchFromGitHub, qmake, pkgconfig, wrapQtAppsHook
22, qtbase, qttools, qtwebkit, sqlite
33}:
44
@@ -13,14 +13,9 @@ stdenv.mkDerivation rec {
1313 sha256 = "0xav9qr8n6310636nfbgx4iix65fs3ya5rz2isxsf38bkjm7r3pa";
1414 };
1515
16− nativeBuildInputs = [ qmake pkgconfig makeWrapper ];
16+ nativeBuildInputs = [ qmake pkgconfig wrapQtAppsHook ];
1717 buildInputs = [ qtbase qttools qtwebkit sqlite.dev ];
1818
19− postFixup = ''
20− wrapProgram $out/bin/quiterss \
21− --prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}"
22− '';
23−
2419 meta = with stdenv.lib; {
2520 description = "A Qt-based RSS/Atom news feed reader";
2621 longDescription = ''
pkgs/applications/networking/nextcloud-client/default.nix+6−6
@@ -1,5 +1,5 @@
11{ stdenv, fetchgit, cmake, pkgconfig, qtbase, qtwebkit, qtkeychain, qttools, sqlite
2−, inotify-tools, makeWrapper, openssl_1_1, pcre, qtwebengine, libsecret
2+, inotify-tools, wrapQtAppsHook, openssl_1_1, pcre, qtwebengine, libsecret
33, libcloudproviders
44}:
55
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
1414 fetchSubmodules = true;
1515 };
1616
17− nativeBuildInputs = [ pkgconfig cmake makeWrapper ];
17+ nativeBuildInputs = [ pkgconfig cmake wrapQtAppsHook ];
1818
1919 buildInputs = [ qtbase qtwebkit qtkeychain qttools qtwebengine sqlite openssl_1_1.out pcre inotify-tools libcloudproviders ];
2020
@@ -31,13 +31,13 @@ stdenv.mkDerivation rec {
3131 "-DINOTIFY_INCLUDE_DIR=${inotify-tools}/include"
3232 ];
3333
34+ qtWrapperArgs = [
35+ ''--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ libsecret ]}''
36+ ];
37+
3438 postInstall = ''
3539 sed -i 's/\(Icon.*\)=nextcloud/\1=Nextcloud/g' \
3640 $out/share/applications/nextcloud.desktop
37−
38− wrapProgram "$out/bin/nextcloud" \
39− --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ libsecret ]} \
40− --prefix QT_PLUGIN_PATH : ${qtbase}/${qtbase.qtPluginPrefix}
4141 '';
4242
4343 meta = with stdenv.lib; {
pkgs/applications/networking/protonmail-bridge/default.nix+3−10
@@ -1,5 +1,5 @@
1−{ stdenv, fetchurl, lib, qtbase, qtmultimedia, qtsvg, qtdeclarative, qttools, full,
2− libsecret, libGL, libpulseaudio, glib, makeWrapper, makeDesktopItem }:
1+{ stdenv, fetchurl, lib, qtbase, qtmultimedia, qtsvg, qtdeclarative, qttools, full
2+, libsecret, libGL, libpulseaudio, glib, wrapQtAppsHook, makeDesktopItem }:
33
44let
55 version = "1.1.5-1";
@@ -28,7 +28,7 @@ in stdenv.mkDerivation rec {
2828 sha256 = "1y5mphrs60zd6km9z64vskk70q9zzw4g6js7qvgl572wv81w2l75";
2929 };
3030
31− nativeBuildInputs = [ makeWrapper ];
31+ nativeBuildInputs = [ wrapQtAppsHook ];
3232
3333 sourceRoot = ".";
3434
@@ -60,18 +60,11 @@ in stdenv.mkDerivation rec {
6060 libpulseaudio
6161 glib
6262 ];
63−
64− qtPath = prefix: "${full}/${prefix}";
6563 in ''
6664 patchelf \
6765 --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
6866 --set-rpath "${rpath}" \
6967 $out/lib/protonmail-bridge
70−
71− wrapProgram $out/lib/protonmail-bridge \
72− --set QT_PLUGIN_PATH "${qtPath qtbase.qtPluginPrefix}" \
73− --set QML_IMPORT_PATH "${qtPath qtbase.qtQmlPrefix}" \
74− --set QML2_IMPORT_PATH "${qtPath qtbase.qtQmlPrefix}" \
7568 '';
7669
7770 meta = with stdenv.lib; {
pkgs/applications/networking/sniffers/wireshark/default.nix+2−5
@@ -30,7 +30,7 @@ in stdenv.mkDerivation {
3030
3131 nativeBuildInputs = [
3232 bison cmake extra-cmake-modules flex pkgconfig
33− ];
33+ ] ++ optional withQt qt5.wrapQtAppsHook;
3434
3535 buildInputs = [
3636 gettext pcre perl libpcap lua5 libssh nghttp2 openssl libgcrypt
@@ -70,12 +70,9 @@ in stdenv.mkDerivation {
7070 done
7171 done
7272
73− wrapProgram $out/Applications/Wireshark.app/Contents/MacOS/Wireshark \
74− --set QT_PLUGIN_PATH ${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}
73+ wrapQtApp $out/Applications/Wireshark.app/Contents/MacOS/Wireshark
7574 '' else optionalString withQt ''
7675 install -Dm644 -t $out/share/applications ../wireshark.desktop
77− wrapProgram $out/bin/wireshark \
78− --set QT_PLUGIN_PATH ${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}
7976
8077 substituteInPlace $out/share/applications/*.desktop \
8178 --replace "Exec=wireshark" "Exec=$out/bin/wireshark"
pkgs/applications/office/kmymoney/default.nix+6−6
@@ -1,4 +1,5 @@
11{ stdenv, lib, fetchurl, doxygen, extra-cmake-modules, graphviz, kdoctools
2+, wrapQtAppsHook
23
34, akonadi, alkimia, aqbanking, gmp, gwenhywfar, kactivities, karchive
45, kcmutils, kcontacts, kdewebkit, kdiagram, kholidays, kidentitymanagement
@@ -29,6 +30,7 @@ stdenv.mkDerivation rec {
2930
3031 nativeBuildInputs = [
3132 doxygen extra-cmake-modules graphviz kdoctools python2Packages.wrapPython
33+ wrapQtAppsHook
3234 ];
3335
3436 buildInputs = [
@@ -57,13 +59,11 @@ stdenv.mkDerivation rec {
5759
5860 doInstallCheck = stdenv.hostPlatform == stdenv.buildPlatform;
5961 installCheckInputs = [ xvfb_run ];
60− installCheckPhase = let
61− pluginPath = "${qtbase.bin}/${qtbase.qtPluginPrefix}";
62− in lib.optionalString doInstallCheck ''
63− QT_PLUGIN_PATH=${lib.escapeShellArg pluginPath} \
62+ installCheckPhase =
63+ lib.optionalString doInstallCheck ''
6464 xvfb-run -s '-screen 0 1024x768x24' make test \
65− ARGS="-E '(reports-chart-test)'" # Test fails, so exclude it for now.
66− '';
65+ ARGS="-E '(reports-chart-test)'" # Test fails, so exclude it for now.
66+ '';
6767
6868 meta = {
6969 description = "Personal finance manager for KDE";
pkgs/applications/office/scribus/unstable.nix+4−8
@@ -1,11 +1,11 @@
1−{ stdenv, fetchsvn, makeWrapper, pkgconfig, cmake, qtbase, cairo, pixman,
1+{ stdenv, fetchsvn, wrapQtAppsHook, pkgconfig, cmake, qtbase, cairo, pixman,
22boost, cups, fontconfig, freetype, hunspell, libjpeg, libtiff, libxml2, lcms2,
33podofo, poppler, poppler_data, python2, harfbuzz, qtimageformats, qttools }:
44
55let
66 pythonEnv = python2.withPackages(ps: [ps.tkinter ps.pillow]);
77 revision = "22806";
8−in
8+in
99stdenv.mkDerivation rec {
1010 name = "scribus-unstable-${version}";
1111 version = "2019-01-16";
@@ -18,17 +18,13 @@ stdenv.mkDerivation rec {
1818
1919 enableParallelBuilding = true;
2020
21+ nativeBuildInputs = [ wrapQtAppsHook ];
2122 buildInputs = [
22− makeWrapper pkgconfig cmake qtbase cairo pixman boost cups fontconfig
23+ pkgconfig cmake qtbase cairo pixman boost cups fontconfig
2324 freetype hunspell libjpeg libtiff libxml2 lcms2 podofo poppler
2425 poppler_data pythonEnv harfbuzz qtimageformats qttools
2526 ];
2627
27− postFixup = ''
28− wrapProgram $out/bin/scribus \
29− --prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}"
30− '';
31−
3228 meta = {
3329 maintainers = [ stdenv.lib.maintainers.erictapen ];
3430 platforms = stdenv.lib.platforms.linux;
pkgs/applications/science/astronomy/stellarium/default.nix+3−8
@@ -1,7 +1,7 @@
11{ mkDerivation, lib, fetchFromGitHub
22, cmake, freetype, libpng, libGLU_combined, openssl, perl, libiconv
33, qtscript, qtserialport, qttools
4−, qtmultimedia, qtlocation, makeWrapper, qtbase
4+, qtmultimedia, qtlocation, qtbase, wrapQtAppsHook
55}:
66
77mkDerivation rec {
@@ -15,18 +15,13 @@ mkDerivation rec {
1515 sha256 = "0hf1wv2bb5j7ny2xh29mj9m4hjblhn02zylay8gl85w7xlqs7s5r";
1616 };
1717
18− nativeBuildInputs = [ cmake perl ];
18+ nativeBuildInputs = [ cmake perl wrapQtAppsHook ];
1919
2020 buildInputs = [
2121 freetype libpng libGLU_combined openssl libiconv qtscript qtserialport qttools
22− qtmultimedia qtlocation qtbase makeWrapper
22+ qtmultimedia qtlocation qtbase
2323 ];
2424
25− postInstall = ''
26− wrapProgram $out/bin/stellarium \
27− --prefix QT_PLUGIN_PATH : "${qtbase}/lib/qt-5.${lib.versions.minor qtbase.version}/plugins"
28− '';
29−
3025 meta = with lib; {
3126 description = "Free open-source planetarium";
3227 homepage = http://stellarium.org/;
pkgs/applications/science/electronics/dsview/default.nix+2−7
@@ -1,6 +1,6 @@
11{ stdenv, fetchFromGitHub, pkgconfig, cmake,
22libzip, boost, fftw, qtbase,
3−libusb, makeWrapper, libsigrok4dsl, libsigrokdecode4dsl
3+libusb, wrapQtAppsHook, libsigrok4dsl, libsigrokdecode4dsl
44}:
55
66stdenv.mkDerivation rec {
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
2424 ./install.patch
2525 ];
2626
27− nativeBuildInputs = [ cmake pkgconfig makeWrapper ];
27+ nativeBuildInputs = [ cmake pkgconfig wrapQtAppsHook ];
2828
2929 buildInputs = [
3030 boost fftw qtbase libusb libzip libsigrokdecode4dsl libsigrok4dsl
@@ -32,11 +32,6 @@ stdenv.mkDerivation rec {
3232
3333 enableParallelBuilding = true;
3434
35− postFixup = ''
36− wrapProgram $out/bin/DSView --suffix QT_PLUGIN_PATH : \
37− ${qtbase.bin}/${qtbase.qtPluginPrefix}
38− '';
39−
4035 meta = with stdenv.lib; {
4136 description = "A GUI program for supporting various instruments from DreamSourceLab, including logic analyzer, oscilloscope, etc";
4237 homepage = https://www.dreamsourcelab.com/;
pkgs/applications/version-management/p4v/default.nix+5−5
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, lib, qtbase, qtmultimedia, qtscript, qtsensors, qtwebkit, openssl, xkeyboard_config, makeWrapper }:
1+{ stdenv, fetchurl, lib, qtbase, qtmultimedia, qtscript, qtsensors, qtwebkit, openssl, xkeyboard_config, wrapQtAppsHook }:
22
33stdenv.mkDerivation rec {
44 name = "p4v-${version}";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
1010 };
1111
1212 dontBuild = true;
13− nativeBuildInputs = [makeWrapper];
13+ nativeBuildInputs = [ wrapQtAppsHook ];
1414
1515 ldLibraryPath = lib.makeLibraryPath [
1616 stdenv.cc.cc.lib
@@ -22,6 +22,7 @@ stdenv.mkDerivation rec {
2222 openssl
2323 ];
2424
25+ dontWrapQtApps = true;
2526 installPhase = ''
2627 mkdir $out
2728 cp -r bin $out
@@ -31,10 +32,9 @@ stdenv.mkDerivation rec {
3132 for f in $out/bin/*.bin ; do
3233 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f
3334
34− wrapProgram $f \
35+ wrapQtApp $f \
3536 --suffix LD_LIBRARY_PATH : ${ldLibraryPath} \
36− --suffix QT_XKB_CONFIG_ROOT : ${xkeyboard_config}/share/X11/xkb \
37− --suffix QT_PLUGIN_PATH : ${qtbase.bin}/${qtbase.qtPluginPrefix}
37+ --suffix QT_XKB_CONFIG_ROOT : ${xkeyboard_config}/share/X11/xkb
3838 done
3939 '';
4040
pkgs/applications/video/avidemux/default.nix+10−5
@@ -1,7 +1,7 @@
11{ stdenv, lib, fetchurl, cmake, pkgconfig
22, zlib, gettext, libvdpau, libva, libXv, sqlite
33, yasm, freetype, fontconfig, fribidi
4−, makeWrapper, libXext, libGLU, qttools, qtbase
4+, makeWrapper, libXext, libGLU, qttools, qtbase, wrapQtAppsHook
55, alsaLib
66, withX265 ? true, x265
77, withX264 ? true, x264
@@ -37,7 +37,9 @@ stdenv.mkDerivation rec {
3737 ./bootstrap_logging.patch
3838 ];
3939
40− nativeBuildInputs = [ yasm cmake pkgconfig ];
40+ nativeBuildInputs =
41+ [ yasm cmake pkgconfig ]
42+ ++ lib.optional withQT wrapQtAppsHook;
4143 buildInputs = [
4244 zlib gettext libvdpau libva libXv sqlite fribidi fontconfig
4345 freetype alsaLib libXext libGLU makeWrapper
@@ -55,7 +57,10 @@ stdenv.mkDerivation rec {
5557
5658 buildCommand = let
5759 qtVersion = "5.${stdenv.lib.versions.minor qtbase.version}";
58− wrapProgram = f: "wrapProgram ${f} --set ADM_ROOT_DIR $out --prefix LD_LIBRARY_PATH : ${libXext}/lib";
60+ wrapWith = makeWrapper: filename:
61+ "${makeWrapper} ${filename} --set ADM_ROOT_DIR $out --prefix LD_LIBRARY_PATH : ${libXext}/lib";
62+ wrapQtApp = wrapWith "wrapQtApp";
63+ wrapProgram = wrapWith "wrapProgram";
5964 in ''
6065 unpackPhase
6166 cd "$sourceRoot"
@@ -74,8 +79,8 @@ stdenv.mkDerivation rec {
7479 ${wrapProgram "$out/bin/avidemux3_cli"}
7580
7681 ${stdenv.lib.optionalString withQT ''
77− ${wrapProgram "$out/bin/avidemux3_qt5"} --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins
78− ${wrapProgram "$out/bin/avidemux3_jobs_qt5"} --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins
82+ ${wrapQtApp "$out/bin/avidemux3_qt5"}
83+ ${wrapQtApp "$out/bin/avidemux3_jobs_qt5"}
7984 ''}
8085
8186 ln -s "$out/bin/avidemux3_${default}" "$out/bin/avidemux"
pkgs/applications/video/minitube/default.nix+2−7
@@ -1,4 +1,4 @@
1−{ stdenv, fetchFromGitHub, makeWrapper, phonon, phonon-backend-vlc, qtbase, qmake
1+{ stdenv, fetchFromGitHub, wrapQtAppsHook, phonon, phonon-backend-vlc, qtbase, qmake
22, qtdeclarative, qttools
33
44# "Free" key generated by nckx <github@tobias.gr>. I no longer have a Google
@@ -17,17 +17,12 @@ stdenv.mkDerivation rec {
1717 };
1818
1919 buildInputs = [ phonon phonon-backend-vlc qtbase qtdeclarative qttools ];
20− nativeBuildInputs = [ makeWrapper qmake ];
20+ nativeBuildInputs = [ wrapQtAppsHook qmake ];
2121
2222 qmakeFlags = [ "DEFINES+=APP_GOOGLE_API_KEY=${withAPIKey}" ];
2323
2424 enableParallelBuilding = true;
2525
26− postInstall = ''
27− wrapProgram $out/bin/minitube \
28− --prefix QT_PLUGIN_PATH : "${phonon-backend-vlc}/lib/qt-5.${stdenv.lib.versions.minor qtbase.version}/plugins"
29− '';
30−
3126 meta = with stdenv.lib; {
3227 description = "Stand-alone YouTube video player";
3328 longDescription = ''
pkgs/desktops/plasma-5/plasma-workspace/default.nix+4−7
@@ -34,7 +34,8 @@ mkDerivation {
3434
3535 qtgraphicaleffects qtquickcontrols qtquickcontrols2 qtscript qtwayland qtx11extras
3636 ];
37− outputs = [ "bin" "dev" "out" ];
37+ propagatedUserEnvPkgs = [ qtgraphicaleffects ];
38+ outputs = [ "out" "dev" ];
3839
3940 cmakeFlags = [
4041 "-DNIXPKGS_XMESSAGE=${getBin xmessage}/bin/xmessage"
@@ -45,7 +46,7 @@ mkDerivation {
4546 "-DNIXPKGS_XPROP=${getBin xprop}/bin/xprop"
4647 "-DNIXPKGS_ID=${getBin coreutils}/bin/id"
4748 "-DNIXPKGS_DBUS_UPDATE_ACTIVATION_ENVIRONMENT=${getBin dbus}/bin/dbus-update-activation-environment"
48− "-DNIXPKGS_START_KDEINIT_WRAPPER=${getLib kinit}/lib/libexec/kf5/start_kdeinit_wrapper"
49+ "-DNIXPKGS_START_KDEINIT_WRAPPER=${getLib kinit}/libexec/kf5/start_kdeinit_wrapper"
4950 "-DNIXPKGS_QDBUS=${getBin qttools}/bin/qdbus"
5051 "-DNIXPKGS_KWRAPPER5=${getBin kinit}/bin/kwrapper5"
5152 "-DNIXPKGS_KREADCONFIG5=${getBin kconfig}/bin/kreadconfig5"
@@ -72,10 +73,6 @@ mkDerivation {
7273
7374 preConfigure = ''
7475 NIX_CFLAGS_COMPILE+=" -DNIXPKGS_KDOSTARTUPCONFIG5=\"''${!outputBin}/bin/kdostartupconfig5\""
75− cmakeFlags+=" -DNIXPKGS_STARTPLASMA=''${!outputBin}/lib/libexec/startplasma"
76− '';
77−
78− postInstall = ''
79− moveToOutput lib/libexec/startplasma ''${!outputBin}
76+ cmakeFlags+=" -DNIXPKGS_STARTPLASMA=''${!outputBin}/libexec/startplasma"
8077 '';
8178}
pkgs/development/compilers/nextpnr/default.nix+5−10
@@ -1,4 +1,4 @@
1−{ stdenv, fetchFromGitHub, cmake, makeWrapper
1+{ stdenv, fetchFromGitHub, cmake
22, boost, python3, eigen
33, icestorm, trellis
44
@@ -6,7 +6,7 @@
66# laptop (and over a remote X server on my server...), so mark it broken for
77# now, with intent to fix later.
88, enableGui ? false
9−, qtbase
9+, qtbase, wrapQtAppsHook
1010}:
1111
1212let
@@ -36,7 +36,9 @@ stdenv.mkDerivation rec {
3636 sha256 = "1y14jpa948cwk0i19bsfqh7yxsxkgskm4xym4z179sjcvcdvrn3a";
3737 };
3838
39− nativeBuildInputs = [ cmake makeWrapper ];
39+ nativeBuildInputs
40+ = [ cmake ]
41+ ++ (stdenv.lib.optional enableGui wrapQtAppsHook);
4042 buildInputs
4143 = [ boostPython python3 eigen ]
4244 ++ (stdenv.lib.optional enableGui qtbase);
@@ -56,13 +58,6 @@ stdenv.mkDerivation rec {
5658 --replace 'git log -1 --format=%h' 'echo ${substring 0 11 src.rev}'
5759 '';
5860
59− postInstall = stdenv.lib.optionalString enableGui ''
60− for x in generic ice40 ecp5; do
61− wrapProgram $out/bin/nextpnr-$x \
62− --prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}"
63− done
64− '';
65−
6661 meta = with stdenv.lib; {
6762 description = "Place and route tool for FPGAs";
6863 homepage = https://github.com/yosyshq/nextpnr;
pkgs/development/libraries/cutelyst/default.nix+2−8
@@ -1,4 +1,4 @@
1−{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, makeWrapper
1+{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, wrapQtAppsHook
22, qtbase, libuuid, libcap, uwsgi, grantlee, pcre
33}:
44
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
1313 sha256 = "09cgfpr2k1jp98h1ahxqm5lmv3qbk0bcxpqpill6n5wmq2c8kl8b";
1414 };
1515
16− nativeBuildInputs = [ cmake pkgconfig makeWrapper ];
16+ nativeBuildInputs = [ cmake pkgconfig wrapQtAppsHook ];
1717 buildInputs = [ qtbase libuuid libcap uwsgi grantlee pcre ];
1818
1919 cmakeFlags = [
@@ -31,12 +31,6 @@ stdenv.mkDerivation rec {
3131 unset LD_LIBRARY_PATH
3232 '';
3333
34− postInstall = ''
35− for prog in $out/bin/*; do
36− wrapProgram "$prog" --set QT_PLUGIN_PATH '${qtbase}/${qtbase.qtPluginPrefix}'
37− done
38− '';
39−
4034 meta = with lib; {
4135 description = "C++ Web Framework built on top of Qt";
4236 homepage = https://cutelyst.org/;
pkgs/development/libraries/gsettings-qt/default.nix+5−1
@@ -1,4 +1,7 @@
1−{ stdenv, fetchbzr, pkgconfig, qmake, qtbase, qtdeclarative, glib, gobject-introspection }:
1+{ stdenv, fetchbzr, pkgconfig
2+, qmake, qtbase, qtdeclarative, wrapQtAppsHook
3+, glib, gobject-introspection
4+}:
25
36stdenv.mkDerivation rec {
47 name = "gsettings-qt-${version}";
@@ -14,6 +17,7 @@ stdenv.mkDerivation rec {
1417 pkgconfig
1518 qmake
1619 gobject-introspection
20+ wrapQtAppsHook
1721 ];
1822
1923 buildInputs = [
pkgs/development/libraries/kde-frameworks/default.nix+3−12
@@ -45,17 +45,9 @@ let
4545 if [ "$hookName" != postHook ]; then
4646 postHooks+=("source @dev@/nix-support/setup-hook")
4747 else
48− # Propagate $${out} output
49− propagatedUserEnvPkgs="$propagatedUserEnvPkgs @${out}@"
50−
51− if [ -z "$outputDev" ]; then
52− echo "error: \$outputDev is unset!" >&2
53− exit 1
54− fi
55−
5648 # Propagate $dev so that this setup hook is propagated
5749 # But only if there is a separate $dev output
58− if [ "$outputDev" != out ]; then
50+ if [ "''${outputDev:?}" != out ]; then
5951 propagatedBuildInputs="$propagatedBuildInputs @dev@"
6052 fi
6153 fi
@@ -75,10 +67,9 @@ let
7567 inherit (srcs."${name}") src version;
7668
7769 outputs = args.outputs or [ "bin" "dev" "out" ];
78− hasBin = lib.elem "bin" outputs;
79− hasDev = lib.elem "dev" outputs;
70+ hasSeparateDev = lib.elem "dev" outputs;
8071
81− defaultSetupHook = if hasBin && hasDev then propagateBin else null;
72+ defaultSetupHook = if hasSeparateDev then propagateBin else null;
8273 setupHook = args.setupHook or defaultSetupHook;
8374
8475 meta = {
pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh+59−5
@@ -1,16 +1,16 @@
1−_ecmEnvHook() {
1+ecmEnvHook() {
22 addToSearchPath XDG_DATA_DIRS "$1/share"
33 addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg"
44}
5−addEnvHooks "$targetOffset" _ecmEnvHook
5+addEnvHooks "$targetOffset" ecmEnvHook
66
7−_ecmPreConfigureHook() {
7+ecmPostHook() {
88 # Because we need to use absolute paths here, we must set *all* the paths.
99 cmakeFlags+=" -DKDE_INSTALL_EXECROOTDIR=${!outputBin}"
1010 cmakeFlags+=" -DKDE_INSTALL_BINDIR=${!outputBin}/bin"
1111 cmakeFlags+=" -DKDE_INSTALL_SBINDIR=${!outputBin}/sbin"
1212 cmakeFlags+=" -DKDE_INSTALL_LIBDIR=${!outputLib}/lib"
13− cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputLib}/lib/libexec"
13+ cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputLib}/libexec"
1414 cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake"
1515 cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include"
1616 cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var"
@@ -51,4 +51,58 @@ _ecmPreConfigureHook() {
5151 cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix"
5252 fi
5353}
54−preConfigureHooks+=(_ecmPreConfigureHook)
54+postHooks+=(ecmPostHook)
55+
56+xdgDataSubdirs=(
57+ "doc" "config.kcfg" "kconf_update" "kservices5" "kservicetypes5" \
58+ "kxmlgui5" "knotifications5" "icons" "locale" "sounds" "templates" \
59+ "wallpapers" "applications" "desktop-directories" "mime" "appdata" "dbus-1" \
60+)
61+
62+
63+ecmHostPathSeen=( )
64+
65+ecmUnseenHostPath() {
66+ for pkg in "${ecmHostPathSeen[@]}"
67+ do
68+ if [ "${pkg:?}" == "$1" ]
69+ then
70+ return 1
71+ fi
72+ done
73+
74+ ecmHostPathSeen+=("$1")
75+ return 0
76+}
77+
78+ecmHostPathHook() {
79+ ecmUnseenHostPath "$1" || return 0
80+
81+ local xdgConfigDir="$1/etc/xdg"
82+ if [ -d "$xdgConfigDir" ]
83+ then
84+ qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir")
85+ fi
86+
87+ for xdgDataSubdir in "${xdgDataSubdirs[@]}"
88+ do
89+ if [ -d "$1/share/$xdgDataSubdir" ]
90+ then
91+ qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$1/share")
92+ break
93+ fi
94+ done
95+
96+ local manDir="$1/man"
97+ if [ -d "$manDir" ]
98+ then
99+ qtWrapperArgs+=(--prefix MANPATH : "$manDir")
100+ fi
101+
102+ local infoDir="$1/info"
103+ if [ -d "$infoDir" ]
104+ then
105+ qtWrapperArgs+=(--prefix INFOPATH : "$infoDir")
106+ fi
107+}
108+addEnvHooks "$hostOffset" ecmHostPathHook
pkgs/development/libraries/kde-frameworks/kinit/default.nix+1−3
@@ -9,6 +9,7 @@ let inherit (lib) getLib; in
99mkDerivation {
1010 name = "kinit";
1111 meta = { maintainers = [ lib.maintainers.ttuegel ]; };
12+ outputs = [ "out" "dev" ];
1213 nativeBuildInputs = [ extra-cmake-modules kdoctools ];
1314 buildInputs = [
1415 kconfig kcrash ki18n kio kservice kwindowsystem
@@ -19,9 +20,6 @@ mkDerivation {
1920 ''-DNIXPKGS_KF5_PARTS=\"${getLib kparts}/lib/libKF5Parts.so.5\"''
2021 ''-DNIXPKGS_KF5_PLASMA=\"${getLib plasma-framework}/lib/libKF5Plasma.so.5\"''
2122 ];
22− postFixup = ''
23− moveToOutput "lib/libexec/kf5/start_kdeinit" "$bin"
24− '';
2523 setupHook = writeScript "setup-hook.sh" ''
2624 kinitFixupOutputHook() {
2725 if [ $prefix != ''${!outputBin} ] && [ -d $prefix/lib ]; then
pkgs/development/libraries/qt-5/5.11/default.nix+24−10
@@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
1717
1818{
1919 newScope,
20− stdenv, fetchurl, fetchFromGitHub, makeSetupHook,
20+ stdenv, fetchurl, fetchFromGitHub, makeSetupHook, makeWrapper,
2121 bison, cups ? null, harfbuzz, libGL, perl,
2222 gstreamer, gst-plugins-base, gtk3, dconf,
2323 llvmPackages_5,
@@ -34,6 +34,8 @@ let
3434
3535 qtCompatVersion = "5.11";
3636
37+ stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
38+
3739 mirror = "https://download.qt.io";
3840 srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
3941 # Community port of the now unmaintained upstream qtwebkit.
@@ -64,16 +66,18 @@ let
6466 qtwebkit = [ ./qtwebkit.patch ];
6567 };
6668
67− mkDerivation =
68− import ../mkDerivation.nix {
69− inherit (stdenv) lib;
70− stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
71− }
72− { inherit debug; };
73−
7469 qtModule =
7570 import ../qtModule.nix
76− { inherit mkDerivation perl; inherit (stdenv) lib; }
71+ {
72+ inherit perl;
73+ inherit (stdenv) lib;
74+ # Use a variant of mkDerivation that does not include wrapQtApplications
75+ # to avoid cyclic dependencies between Qt modules.
76+ mkDerivation =
77+ import ../mkDerivation.nix
78+ { inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
79+ stdenvActual.mkDerivation;
80+ }
7781 { inherit self srcs patches; };
7882
7983 addPackages = self: with self;
@@ -81,7 +85,11 @@ let
8185 callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
8286 in {
8387
84− inherit mkDerivation;
88+ mkDerivationWith =
89+ import ../mkDerivation.nix
90+ { inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
91+
92+ mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
8593
8694 qtbase = callPackage ../modules/qtbase.nix {
8795 inherit (srcs.qtbase) src version;
@@ -142,6 +150,12 @@ let
142150 fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
143151 };
144152 } ../hooks/qmake-hook.sh;
153+
154+ wrapQtAppsHook = makeSetupHook {
155+ deps =
156+ [ self.qtbase.dev makeWrapper ]
157+ ++ optional stdenv.isLinux self.qtwayland.dev;
158+ } ../hooks/wrap-qt-apps-hook.sh;
145159 };
146160
147161 self = makeScope newScope addPackages;
pkgs/development/libraries/qt-5/5.12/default.nix+24−10
@@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
1717
1818{
1919 newScope,
20− stdenv, fetchurl, fetchFromGitHub, makeSetupHook,
20+ stdenv, fetchurl, fetchFromGitHub, makeSetupHook, makeWrapper,
2121 bison, cups ? null, harfbuzz, libGL, perl,
2222 gstreamer, gst-plugins-base, gtk3, dconf,
2323 llvmPackages_5,
@@ -34,6 +34,8 @@ let
3434
3535 qtCompatVersion = "5.12";
3636
37+ stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
38+
3739 mirror = "https://download.qt.io";
3840 srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
3941 # Community port of the now unmaintained upstream qtwebkit.
@@ -69,16 +71,18 @@ let
6971 qttools = [ ./qttools.patch ];
7072 };
7173
72− mkDerivation =
73− import ../mkDerivation.nix {
74− inherit (stdenv) lib;
75− stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
76− }
77− { inherit debug; };
78−
7974 qtModule =
8075 import ../qtModule.nix
81− { inherit mkDerivation perl; inherit (stdenv) lib; }
76+ {
77+ inherit perl;
78+ inherit (stdenv) lib;
79+ # Use a variant of mkDerivation that does not include wrapQtApplications
80+ # to avoid cyclic dependencies between Qt modules.
81+ mkDerivation =
82+ import ../mkDerivation.nix
83+ { inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
84+ stdenvActual.mkDerivation;
85+ }
8286 { inherit self srcs patches; };
8387
8488 addPackages = self: with self;
@@ -86,7 +90,11 @@ let
8690 callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
8791 in {
8892
89− inherit mkDerivation;
93+ mkDerivationWith =
94+ import ../mkDerivation.nix
95+ { inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
96+
97+ mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
9098
9199 qtbase = callPackage ../modules/qtbase.nix {
92100 inherit (srcs.qtbase) src version;
@@ -147,6 +155,12 @@ let
147155 fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
148156 };
149157 } ../hooks/qmake-hook.sh;
158+
159+ wrapQtAppsHook = makeSetupHook {
160+ deps =
161+ [ self.qtbase.dev makeWrapper ]
162+ ++ optional stdenv.isLinux self.qtwayland.dev;
163+ } ../hooks/wrap-qt-apps-hook.sh;
150164 };
151165
152166 self = makeScope newScope addPackages;
pkgs/development/libraries/qt-5/5.6/default.nix+22−8
@@ -26,7 +26,7 @@ existing packages here and modify it as necessary.
2626
2727{
2828 newScope,
29− stdenv, fetchurl, fetchpatch, makeSetupHook,
29+ stdenv, fetchurl, fetchpatch, makeSetupHook, makeWrapper,
3030 bison, cups ? null, harfbuzz, libGL, perl,
3131 gstreamer, gst-plugins-base,
3232
@@ -104,14 +104,18 @@ let
104104 ];
105105 };
106106
107− mkDerivation =
108− import ../mkDerivation.nix
109− { inherit stdenv; inherit (stdenv) lib; }
110− { inherit debug; };
111−
112107 qtModule =
113108 import ../qtModule.nix
114− { inherit mkDerivation perl; inherit (stdenv) lib; }
109+ {
110+ inherit perl;
111+ inherit (stdenv) lib;
112+ # Use a variant of mkDerivation that does not include wrapQtApplications
113+ # to avoid cyclic dependencies between Qt modules.
114+ mkDerivation =
115+ import ../mkDerivation.nix
116+ { inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
117+ stdenv.mkDerivation;
118+ }
115119 { inherit self srcs patches; };
116120
117121 addPackages = self: with self;
@@ -119,7 +123,11 @@ let
119123 callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
120124 in {
121125
122− inherit mkDerivation;
126+ mkDerivationWith =
127+ import ../mkDerivation.nix
128+ { inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
129+
130+ mkDerivation = mkDerivationWith stdenv.mkDerivation;
123131
124132 qtbase = callPackage ../modules/qtbase.nix {
125133 inherit bison cups harfbuzz libGL;
@@ -173,6 +181,12 @@ let
173181 deps = [ self.qtbase.dev ];
174182 substitutions = { inherit (stdenv) isDarwin; };
175183 } ../hooks/qmake-hook.sh;
184+
185+ wrapQtAppsHook = makeSetupHook {
186+ deps =
187+ [ self.qtbase.dev makeWrapper ]
188+ ++ optional stdenv.isLinux self.qtwayland.dev;
189+ } ../hooks/wrap-qt-apps-hook.sh;
176190 };
177191
178192 self = makeScope newScope addPackages;
pkgs/development/libraries/qt-5/5.9/default.nix+22−8
@@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
1717
1818{
1919 newScope,
20− stdenv, fetchurl, fetchpatch, makeSetupHook,
20+ stdenv, fetchurl, fetchpatch, makeSetupHook, makeWrapper,
2121 bison, cups ? null, harfbuzz, libGL, perl,
2222 gstreamer, gst-plugins-base, gtk3, dconf,
2323
@@ -67,14 +67,18 @@ let
6767
6868 };
6969
70− mkDerivation =
71− import ../mkDerivation.nix
72− { inherit stdenv; inherit (stdenv) lib; }
73− { inherit debug; };
74−
7570 qtModule =
7671 import ../qtModule.nix
77− { inherit mkDerivation perl; inherit (stdenv) lib; }
72+ {
73+ inherit perl;
74+ inherit (stdenv) lib;
75+ # Use a variant of mkDerivation that does not include wrapQtApplications
76+ # to avoid cyclic dependencies between Qt modules.
77+ mkDerivation =
78+ import ../mkDerivation.nix
79+ { inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
80+ stdenv.mkDerivation;
81+ }
7882 { inherit self srcs patches; };
7983
8084 addPackages = self: with self;
@@ -82,7 +86,11 @@ let
8286 callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
8387 in {
8488
85− inherit mkDerivation;
89+ mkDerivationWith =
90+ import ../mkDerivation.nix
91+ { inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
92+
93+ mkDerivation = mkDerivationWith stdenv.mkDerivation;
8694
8795 qtbase = callPackage ../modules/qtbase.nix {
8896 inherit (srcs.qtbase) src version;
@@ -140,6 +148,12 @@ let
140148 fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
141149 };
142150 } ../hooks/qmake-hook.sh;
151+
152+ wrapQtAppsHook = makeSetupHook {
153+ deps =
154+ [ self.qtbase.dev makeWrapper ]
155+ ++ optional stdenv.isLinux self.qtwayland.dev;
156+ } ../hooks/wrap-qt-apps-hook.sh;
143157 };
144158
145159 self = makeScope newScope addPackages;
pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh+12−10
@@ -19,12 +19,14 @@ export QMAKEPATH
1919QMAKEMODULES=
2020export QMAKEMODULES
2121
22−addToQMAKEPATH() {
23− if [ -d "$1/mkspecs" ]; then
22+qmakePathHook() {
23+ if [ -d "$1/mkspecs" ]
24+ then
2425 QMAKEMODULES="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs"
2526 QMAKEPATH="${QMAKEPATH}${QMAKEPATH:+:}$1"
2627 fi
2728}
29+envBuildHostHooks+=(qmakePathHook)
2830
2931# Propagate any runtime dependency of the building package.
3032# Each dependency is propagated to the user environment and as a build
@@ -32,18 +34,18 @@ addToQMAKEPATH() {
3234# package depending on the building package. (This is necessary in case
3335# the building package does not provide runtime dependencies itself and so
3436# would not be propagated to the user environment.)
35−qtEnvHook() {
36− addToQMAKEPATH "$1"
37− if providesQtRuntime "$1"; then
38− if [ "z${!outputBin}" != "z${!outputDev}" ]; then
39− propagatedBuildInputs+=" $1"
40− fi
41− propagatedUserEnvPkgs+=" $1"
37+qtEnvHostTargetHook() {
38+ if providesQtRuntime "$1" && [ "z${!outputBin}" != "z${!outputDev}" ]
39+ then
40+ propagatedBuildInputs+=" $1"
4241 fi
4342}
44−envHostTargetHooks+=(qtEnvHook)
43+envHostTargetHooks+=(qtEnvHostTargetHook)
4544
4645postPatchMkspecs() {
46+ # Prevent this hook from running multiple times
47+ dontPatchMkspecs=1
48+
4749 local bin="${!outputBin}"
4850 local dev="${!outputDev}"
4951 local doc="${!outputDoc}"
pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.shnew file+106
@@ -0,0 +1,106 @@
1+# Inherit arguments given in mkDerivation
2+qtWrapperArgs=( $qtWrapperArgs )
3+
4+qtHostPathSeen=()
5+
6+qtUnseenHostPath() {
7+ for pkg in "${qtHostPathSeen[@]}"
8+ do
9+ if [ "${pkg:?}" == "$1" ]
10+ then
11+ return 1
12+ fi
13+ done
14+
15+ qtHostPathSeen+=("$1")
16+ return 0
17+}
18+
19+qtHostPathHook() {
20+ qtUnseenHostPath "$1" || return 0
21+
22+ local pluginDir="$1/${qtPluginPrefix:?}"
23+ if [ -d "$pluginDir" ]
24+ then
25+ qtWrapperArgs+=(--prefix QT_PLUGIN_PATH : "$pluginDir")
26+ fi
27+
28+ local qmlDir="$1/${qtQmlPrefix:?}"
29+ if [ -d "$qmlDir" ]
30+ then
31+ qtWrapperArgs+=(--prefix QML2_IMPORT_PATH : "$qmlDir")
32+ fi
33+}
34+addEnvHooks "$hostOffset" qtHostPathHook
35+
36+makeQtWrapper() {
37+ local original="$1"
38+ local wrapper="$2"
39+ shift 2
40+ makeWrapper "$original" "$wrapper" "${qtWrapperArgs[@]}" "$@"
41+}
42+
43+wrapQtApp() {
44+ local program="$1"
45+ shift 1
46+ wrapProgram "$program" "${qtWrapperArgs[@]}" "$@"
47+}
48+
49+qtOwnPathsHook() {
50+ local xdgDataDir="${!outputBin}/share"
51+ if [ -d "$xdgDataDir" ]
52+ then
53+ qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$xdgDataDir")
54+ fi
55+
56+ local xdgConfigDir="${!outputBin}/etc/xdg"
57+ if [ -d "$xdgConfigDir" ]
58+ then
59+ qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir")
60+ fi
61+
62+ qtHostPathHook "${!outputBin}"
63+}
64+
65+preFixupPhases+=" qtOwnPathsHook"
66+
67+isQtApp () {
68+ readelf -d "$1" 2>/dev/null | grep -q -F 'libQt5Core'
69+}
70+
71+# Note: $qtWrapperArgs still gets defined even if $dontWrapQtApps is set.
72+wrapQtAppsHook() {
73+ # skip this hook when requested
74+ [ -z "$dontWrapQtApps" ] || return 0
75+
76+ # guard against running multiple times (e.g. due to propagation)
77+ [ -z "$wrapQtAppsHookHasRun" ] || return 0
78+ wrapQtAppsHookHasRun=1
79+
80+ local targetDirs=( "$prefix/bin" )
81+ echo "wrapping Qt applications in ${targetDirs[@]}"
82+
83+ for targetDir in "${targetDirs[@]}"
84+ do
85+ [ -d "$targetDir" ] || continue
86+
87+ find "$targetDir" -executable -print0 | while IFS= read -r -d '' file
88+ do
89+ isQtApp "$file" || continue
90+
91+ if [ -f "$file" ]
92+ then
93+ echo "wrapping $file"
94+ wrapQtApp "$file"
95+ elif [ -h "$file" ]
96+ then
97+ target="$(readlink -e "$file")"
98+ echo "wrapping $file -> $target"
99+ rm "$file"
100+ makeQtWrapper "$target" "$file"
101+ fi
102+ done
103+ done
104+}
105+
106+fixupOutputHooks+=(wrapQtAppsHook)
pkgs/development/libraries/qt-5/mkDerivation.nix+5−3
@@ -1,8 +1,8 @@
1−{ stdenv, lib }:
1+{ lib, debug, wrapQtAppsHook }:
22
33let inherit (lib) optional; in
44
5−{ debug }:
5+mkDerivation:
66
77args:
88
@@ -24,7 +24,9 @@ let
2424
2525 enableParallelBuilding = args.enableParallelBuilding or true;
2626
27+ nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ wrapQtAppsHook ];
28+
2729 };
2830in
2931
30−stdenv.mkDerivation (args // args_)
32+mkDerivation (args // args_)
pkgs/development/libraries/qt-5/modules/qtspeech.nix+1−1
@@ -3,5 +3,5 @@
33qtModule {
44 name = "qtspeech";
55 qtInputs = [ ];
6− outputs = [ "out" "dev" "bin" ];
6+ outputs = [ "out" "dev" ];
77}
pkgs/development/r-modules/wrapper-rstudio.nix+5−4
@@ -1,4 +1,4 @@
1−{ lib, runCommand, R, rstudio, makeWrapper, recommendedPackages, packages, qtbase }:
1+{ lib, runCommand, R, rstudio, wrapQtAppsHook, recommendedPackages, packages, qtbase }:
22
33let
44 qtVersion = with lib.versions; "${major qtbase.version}.${minor qtbase.version}";
@@ -7,7 +7,8 @@ runCommand (rstudio.name + "-wrapper") {
77 preferLocalBuild = true;
88 allowSubstitutes = false;
99
10− nativeBuildInputs = [makeWrapper];
10+ nativeBuildInputs = [wrapQtAppsHook];
11+ dontWrapQtApps = true;
1112
1213 buildInputs = [R rstudio] ++ recommendedPackages ++ packages;
1314
@@ -29,6 +30,6 @@ echo -n ".libPaths(c(.libPaths(), \"" >> $out/$fixLibsR
2930echo -n $R_LIBS_SITE | sed -e 's/:/", "/g' >> $out/$fixLibsR
3031echo -n "\"))" >> $out/$fixLibsR
3132echo >> $out/$fixLibsR
32−makeWrapper ${rstudio}/bin/rstudio $out/bin/rstudio --set R_PROFILE_USER $out/$fixLibsR \
33− --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins
33+makeQtWrapper ${rstudio}/bin/rstudio $out/bin/rstudio \
34+ --set R_PROFILE_USER $out/$fixLibsR
3435''
pkgs/development/tools/analysis/hopper/default.nix+12−14
@@ -1,4 +1,4 @@
1−{ stdenv, fetchurl, pkgs, makeWrapper, lib }:
1+{ stdenv, fetchurl, pkgs, lib }:
22
33stdenv.mkDerivation rec {
44 pname = "hopper";
@@ -16,22 +16,20 @@ stdenv.mkDerivation rec {
1616libbsd.out libffi.out gmpxx.out python27Full.out python27Packages.libxml2 qt5.qtbase zlib xlibs.libX11.out xorg_sys_opengl.out xlibs.libXrender.out gcc-unwrapped.lib
1717 ];
1818
19− nativeBuildInputs = [ makeWrapper ];
19+ nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
20+
21+ qtWrapperArgs = [ ''--suffix LD_LIBRARY_PATH : ${ldLibraryPath}'' ];
2022
2123 installPhase = ''
22− mkdir -p $out/bin
23− mkdir -p $out/lib
24− mkdir -p $out/share
25− cp $sourceRoot/opt/hopper-${rev}/bin/Hopper $out/bin/hopper
26− cp -r $sourceRoot/opt/hopper-${rev}/lib $out
27− cp -r $sourceRoot/usr/share $out/share
24+ mkdir -p $out/bin
25+ mkdir -p $out/lib
26+ mkdir -p $out/share
27+ cp $sourceRoot/opt/hopper-${rev}/bin/Hopper $out/bin/hopper
28+ cp -r $sourceRoot/opt/hopper-${rev}/lib $out
29+ cp -r $sourceRoot/usr/share $out/share
2830 patchelf \
29− --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \
30− $out/bin/hopper
31− # Details: https://nixos.wiki/wiki/Qt
32− wrapProgram $out/bin/hopper \
33− --suffix LD_LIBRARY_PATH : ${ldLibraryPath} \
34− --suffix QT_PLUGIN_PATH : ${pkgs.qt5.qtbase}/lib/qt-${pkgs.qt5.qtbase.qtCompatVersion}/plugins
31+ --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \
32+ $out/bin/hopper
3533 '';
3634
3735 meta = {
pkgs/development/tools/qtcreator/default.nix+8−8
@@ -10,7 +10,7 @@ let
1010 revision = "1";
1111
1212 # Fetch clang from qt vendor, this contains submodules like this:
13− # clang<-clang-tools-extra<-clazy.
13+ # clang<-clang-tools-extra<-clazy.
1414 clang_qt_vendor = llvmPackages_8.clang-unwrapped.overrideAttrs (oldAttrs: rec {
1515 src = fetchgit {
1616 url = "https://code.qt.io/clang/clang.git";
@@ -32,15 +32,15 @@ stdenv.mkDerivation rec {
3232
3333 buildInputs = [ qtbase qtscript qtquickcontrols qtdeclarative llvmPackages_8.libclang clang_qt_vendor llvmPackages_8.llvm ];
3434
35− nativeBuildInputs = [ qmake makeWrapper ];
35+ nativeBuildInputs = [ qmake ];
3636
37− # 0001-Fix-clang-libcpp-regexp.patch is for fixing regexp that is used to
37+ # 0001-Fix-clang-libcpp-regexp.patch is for fixing regexp that is used to
3838 # find clang libc++ library include paths. By default it's not covering paths
3939 # like libc++-version, which is default name for libc++ folder in nixos.
40− patches = [ ./0001-Fix-clang-libcpp-regexp.patch
40+ patches = [ ./0001-Fix-clang-libcpp-regexp.patch
4141
42− # Fix clazy plugin name. This plugin was renamed with clang8
43− # release, and patch didn't make it into 4.9.1 release. Should be removed
42+ # Fix clazy plugin name. This plugin was renamed with clang8
43+ # release, and patch didn't make it into 4.9.1 release. Should be removed
4444 # on qtcreator update, if this problem is fixed.
4545 (fetchpatch {
4646 url = "https://code.qt.io/cgit/qt-creator/qt-creator.git/patch/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp?id=53c407bc0c87e0b65b537bf26836ddd8e00ead82";
@@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
5151 url = "https://code.qt.io/cgit/qt-creator/qt-creator.git/patch/src/plugins/clangtools/clangtidyclazyrunner.cpp?id=53c407bc0c87e0b65b537bf26836ddd8e00ead82";
5252 sha256 = "1rl0rc2l297lpfhhawvkkmj77zb081hhp0bbi7nnykf3q9ch0clh";
5353 })
54− ];
54+ ];
5555
5656 doCheck = true;
5757
@@ -70,7 +70,7 @@ stdenv.mkDerivation rec {
7070 --replace '$$clean_path($${LLVM_LIBDIR}/clang/$${LLVM_VERSION}/include)' '${clang_qt_vendor}/lib/clang/8.0.0/include' \
7171 --replace '$$clean_path($${LLVM_BINDIR})' '${clang_qt_vendor}/bin'
7272
73− # Fix include path to find clang and clang-c include directories.
73+ # Fix include path to find clang and clang-c include directories.
7474 substituteInPlace src/plugins/clangtools/clangtools.pro \
7575 --replace 'INCLUDEPATH += $$LLVM_INCLUDEPATH' 'INCLUDEPATH += $$LLVM_INCLUDEPATH ${clang_qt_vendor}'
7676
pkgs/development/tools/tora/default.nix+3−4
@@ -53,10 +53,9 @@ in mkDerivation rec {
5353
5454 NIX_CFLAGS_COMPILE = [ "-L${mysql.connector-c}/lib/mysql" "-I${mysql.connector-c}/include/mysql" ];
5555
56− postFixup = ''
57− wrapProgram $out/bin/tora \
58− --prefix PATH : ${lib.getBin graphviz}/bin
59− '';
56+ qtWrapperArgs = [
57+ ''--prefix PATH : ${lib.getBin graphviz}/bin''
58+ ];
6059
6160 meta = with lib; {
6261 description = "Tora SQL tool";
pkgs/games/chessx/default.nix−3
@@ -32,9 +32,6 @@ stdenv.mkDerivation rec {
3232 cp -pr release/chessx "$out/bin"
3333 cp -pr unix/chessx.desktop "$out/share/applications"
3434
35− wrapProgram $out/bin/chessx \
36− --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-5.${lib.versions.minor qtbase.version}/plugins
37−
3835 runHook postInstall
3936 '';
4037
pkgs/games/flightgear/default.nix+4−5
@@ -62,13 +62,12 @@ stdenv.mkDerivation rec {
6262 postInstall = ''
6363 mkdir -p "$out/share/applications/"
6464 cp "${desktopItem}"/share/applications/* "$out/share/applications/" #*/
65−
66− for f in $out/bin/* #*/
67− do
68− wrapProgram $f --set FG_ROOT "${data}/share/FlightGear"
69− done
7065 '';
7166
67+ qtWrapperArgs = [
68+ ''--set FG_ROOT "${data}/share/FlightGear"''
69+ ];
70+
7271 enableParallelBuilding = true;
7372
7473 meta = with stdenv.lib; {
pkgs/games/nethack/default.nix+6−7
@@ -1,5 +1,5 @@
11{ stdenv, lib, fetchurl, coreutils, ncurses, gzip, flex, bison
2−, less, makeWrapper
2+, less
33, buildPackages
44, x11Mode ? false, qtMode ? false, libXaw, libXext, libXpm, bdftopcf, mkfontdir, pkgconfig, qt5
55}:
@@ -37,7 +37,7 @@ in stdenv.mkDerivation rec {
3737 ++ lib.optionals x11Mode [ mkfontdir bdftopcf ]
3838 ++ lib.optionals qtMode [
3939 pkgconfig mkfontdir qt5.qtbase.dev
40− qt5.qtmultimedia.dev makeWrapper
40+ qt5.qtmultimedia.dev qt5.wrapQtAppsHook
4141 bdftopcf
4242 ];
4343
@@ -97,6 +97,10 @@ in stdenv.mkDerivation rec {
9797
9898 enableParallelBuilding = true;
9999
100+ preFixup = ''
101+ wrapQtApp "$out/games/nethack"
102+ '';
103+
100104 postInstall = ''
101105 mkdir -p $out/games/lib/nethackuserdir
102106 for i in xlogfile logfile perm record save; do
@@ -137,11 +141,6 @@ in stdenv.mkDerivation rec {
137141 ${lib.optionalString (!(x11Mode || qtMode)) "install -Dm 555 util/dlb -t $out/libexec/nethack/"}
138142 '';
139143
140− postFixup = lib.optionalString qtMode ''
141− wrapProgram $out/bin/nethack-qt \
142− --prefix QT_PLUGIN_PATH : "${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}"
143− '';
144−
145144 meta = with stdenv.lib; {
146145 description = "Rogue-like game";
147146 homepage = http://nethack.org/;
pkgs/misc/emulators/mgba/default.nix+2−4
@@ -1,4 +1,4 @@
1−{ stdenv, fetchFromGitHub, makeDesktopItem, makeWrapper, pkgconfig
1+{ stdenv, fetchFromGitHub, makeDesktopItem, wrapQtAppsHook, pkgconfig
22, cmake, epoxy, libzip, ffmpeg, imagemagick, SDL2, qtbase, qtmultimedia, libedit
33, qttools, minizip }:
44
@@ -25,7 +25,7 @@ in stdenv.mkDerivation rec {
2525 };
2626
2727 enableParallelBuilding = true;
28− nativeBuildInputs = [ makeWrapper pkgconfig cmake ];
28+ nativeBuildInputs = [ wrapQtAppsHook pkgconfig cmake ];
2929
3030 buildInputs = [
3131 libzip epoxy ffmpeg imagemagick SDL2 qtbase qtmultimedia libedit minizip
@@ -34,8 +34,6 @@ in stdenv.mkDerivation rec {
3434
3535 postInstall = ''
3636 cp -r ${desktopItem}/share/applications $out/share
37− wrapProgram $out/bin/mgba-qt --suffix QT_PLUGIN_PATH : \
38− ${qtbase.bin}/${qtbase.qtPluginPrefix}
3937 '';
4038
4139 meta = with stdenv.lib; {
pkgs/tools/graphics/nifskope/default.nix+4−8
@@ -1,4 +1,4 @@
1−{ stdenv, fetchFromGitHub, qmake, qtbase, qttools, substituteAll, libGLU, makeWrapper }:
1+{ stdenv, fetchFromGitHub, qmake, qtbase, qttools, substituteAll, libGLU, wrapQtAppsHook }:
22
33stdenv.mkDerivation rec {
44 name = "nifskope-${version}";
@@ -20,8 +20,8 @@ stdenv.mkDerivation rec {
2020 })
2121 ];
2222
23− buildInputs = [ qtbase qttools libGLU.dev makeWrapper ];
24− nativeBuildInputs = [ qmake ];
23+ buildInputs = [ qtbase qttools libGLU.dev ];
24+ nativeBuildInputs = [ qmake wrapQtAppsHook ];
2525
2626 preConfigure = ''
2727 shopt -s globstar
@@ -33,9 +33,7 @@ stdenv.mkDerivation rec {
3333 enableParallelBuilding = true;
3434
3535 # Inspired by install/linux-install/nifskope.spec.in.
36− installPhase = let
37− qtVersion = "5.${stdenv.lib.versions.minor qtbase.version}";
38− in ''
36+ installPhase = ''
3937 runHook preInstall
4038
4139 d=$out/share/nifskope
@@ -53,8 +51,6 @@ stdenv.mkDerivation rec {
5351
5452 find $out/share -type f -exec chmod -x {} \;
5553
56− wrapProgram $out/bin/NifSkope --prefix QT_PLUGIN_PATH : "${qtbase}/lib/qt-${qtVersion}/plugins"
57−
5854 runHook postInstall
5955 '';
6056
pkgs/tools/misc/partition-manager/default.nix+3−7
@@ -1,7 +1,7 @@
11{ mkDerivation, fetchurl, lib
2−, extra-cmake-modules, kdoctools, wrapGAppsHook
2+, extra-cmake-modules, kdoctools, wrapGAppsHook, wrapQtAppsHook
33, kconfig, kcrash, kinit, kpmcore
4−, eject, libatasmart , utillinux, makeWrapper, qtbase
4+, eject, libatasmart , utillinux, qtbase
55}:
66
77let
@@ -17,16 +17,12 @@ in mkDerivation rec {
1717
1818 enableParallelBuilding = true;
1919
20− nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook makeWrapper ];
20+ nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook wrapQtAppsHook ];
2121
2222 # refer to kpmcore for the use of eject
2323 buildInputs = [ eject libatasmart utillinux ];
2424 propagatedBuildInputs = [ kconfig kcrash kinit kpmcore ];
2525
26− postInstall = ''
27− wrapProgram "$out/bin/partitionmanager" --prefix QT_PLUGIN_PATH : "${kpmcore}/lib/qt-5.${lib.versions.minor qtbase.version}/plugins"
28− '';
29−
3026 meta = with lib; {
3127 description = "KDE Partition Manager";
3228 license = licenses.gpl2;
pkgs/tools/misc/yubikey-manager-qt/default.nix+13−22
@@ -1,6 +1,6 @@
11{ stdenv
22, fetchurl
3−, makeWrapper
3+, wrapQtAppsHook
44, pcsclite
55, pyotherside
66, pythonPackages
@@ -16,16 +16,9 @@
1616, yubikey-personalization
1717}:
1818
19−let
20− qmlPath = qmlLib: "${qmlLib}/${qtbase.qtQmlPrefix}";
19+let inherit (stdenv) lib; in
2120
22− inherit (stdenv) lib;
23−
24− qml2ImportPath = lib.concatMapStringsSep ":" qmlPath [
25− qtbase.bin qtdeclarative.bin pyotherside qtquickcontrols qtquickcontrols2.bin qtgraphicaleffects
26− ];
27−
28−in stdenv.mkDerivation rec {
21+stdenv.mkDerivation rec {
2922 pname = "yubikey-manager-qt";
3023 version = "1.1.2";
3124
@@ -34,7 +27,7 @@ in stdenv.mkDerivation rec {
3427 sha256 = "01ax8zjrahs2sjbgsys2ahh57sdcap0ij3y1r1bbvsgzr7xxm2q8";
3528 };
3629
37− nativeBuildInputs = [ makeWrapper python3.pkgs.wrapPython qmake ];
30+ nativeBuildInputs = [ wrapQtAppsHook python3.pkgs.wrapPython qmake ];
3831
3932 postPatch = ''
4033 substituteInPlace ykman-gui/deployment.pri --replace '/usr/bin' "$out/bin"
@@ -46,22 +39,20 @@ in stdenv.mkDerivation rec {
4639
4740 pythonPath = [ yubikey-manager ];
4841
42+ dontWrapQtApps = true;
4943 postInstall = ''
5044 buildPythonPath "$pythonPath"
5145
52− wrapProgram $out/bin/ykman-gui \
46+ wrapQtApp $out/bin/ykman-gui \
5347 --prefix LD_LIBRARY_PATH : "${stdenv.lib.getLib pcsclite}/lib:${yubikey-personalization}/lib" \
54− --prefix PYTHONPATH : "$program_PYTHONPATH" \
55− --set QML2_IMPORT_PATH "${qml2ImportPath}" \
56− --set QT_QPA_PLATFORM_PLUGIN_PATH ${qtbase.bin}/lib/qt-*/plugins/platforms \
57− --prefix QT_PLUGIN_PATH : "${qtsvg.bin}/${qtbase.qtPluginPrefix}"
48+ --prefix PYTHONPATH : "$program_PYTHONPATH"
5849
59− mkdir -p $out/share/applications
60− cp resources/ykman-gui.desktop $out/share/applications/ykman-gui.desktop
61− mkdir -p $out/share/ykman-gui/icons
62− cp resources/icons/*.{icns,ico,png,xpm} $out/share/ykman-gui/icons
63− substituteInPlace $out/share/applications/ykman-gui.desktop \
64− --replace 'Exec=ykman-gui' "Exec=$out/bin/ykman-gui" \
50+ mkdir -p $out/share/applications
51+ cp resources/ykman-gui.desktop $out/share/applications/ykman-gui.desktop
52+ mkdir -p $out/share/ykman-gui/icons
53+ cp resources/icons/*.{icns,ico,png,xpm} $out/share/ykman-gui/icons
54+ substituteInPlace $out/share/applications/ykman-gui.desktop \
55+ --replace 'Exec=ykman-gui' "Exec=$out/bin/ykman-gui" \
6556 '';
6657
6758 meta = with lib; {
pkgs/tools/security/nitrokey-app/default.nix+3−8
@@ -1,5 +1,5 @@
1−{ stdenv, makeWrapper, bash-completion, cmake, fetchFromGitHub, hidapi, libusb1, pkgconfig
2−, qtbase, qttranslations, qtsvg }:
1+{ stdenv, bash-completion, cmake, fetchFromGitHub, hidapi, libusb1, pkgconfig
2+, qtbase, qttranslations, qtsvg, wrapQtAppsHook }:
33
44stdenv.mkDerivation rec {
55 name = "nitrokey-app-${version}";
@@ -29,15 +29,10 @@ stdenv.mkDerivation rec {
2929 nativeBuildInputs = [
3030 cmake
3131 pkgconfig
32− makeWrapper
32+ wrapQtAppsHook
3333 ];
3434 cmakeFlags = "-DCMAKE_BUILD_TYPE=Release";
3535
36− postFixup = ''
37− wrapProgram $out/bin/nitrokey-app \
38− --prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}"
39− '';
40−
4136 meta = with stdenv.lib; {
4237 description = "Provides extra functionality for the Nitrokey Pro and Storage";
4338 longDescription = ''
pkgs/top-level/all-packages.nix+4−4
@@ -12777,7 +12777,7 @@ in
1277712777 qt56 = recurseIntoAttrs (makeOverridable
1277812778 (import ../development/libraries/qt-5/5.6) {
1277912779 inherit newScope;
12780− inherit stdenv fetchurl fetchpatch makeSetupHook;
12780+ inherit stdenv fetchurl fetchpatch makeSetupHook makeWrapper;
1278112781 bison = bison2; # error: too few arguments to function 'int yylex(...
1278212782 inherit cups;
1278312783 harfbuzz = harfbuzzFull;
@@ -12791,7 +12791,7 @@ in
1279112791 qt59 = recurseIntoAttrs (makeOverridable
1279212792 (import ../development/libraries/qt-5/5.9) {
1279312793 inherit newScope;
12794− inherit stdenv fetchurl fetchpatch makeSetupHook;
12794+ inherit stdenv fetchurl fetchpatch makeSetupHook makeWrapper;
1279512795 bison = bison2; # error: too few arguments to function 'int yylex(...
1279612796 inherit cups;
1279712797 harfbuzz = harfbuzzFull;
@@ -12807,7 +12807,7 @@ in
1280712807 qt511 = recurseIntoAttrs (makeOverridable
1280812808 (import ../development/libraries/qt-5/5.11) {
1280912809 inherit newScope;
12810− inherit stdenv fetchurl fetchFromGitHub makeSetupHook;
12810+ inherit stdenv fetchurl fetchFromGitHub makeSetupHook makeWrapper;
1281112811 bison = bison2; # error: too few arguments to function 'int yylex(...
1281212812 inherit cups;
1281312813 harfbuzz = harfbuzzFull;
@@ -12824,7 +12824,7 @@ in
1282412824 qt512 = recurseIntoAttrs (makeOverridable
1282512825 (import ../development/libraries/qt-5/5.12) {
1282612826 inherit newScope;
12827− inherit stdenv fetchurl fetchFromGitHub makeSetupHook;
12827+ inherit stdenv fetchurl fetchFromGitHub makeSetupHook makeWrapper;
1282812828 bison = bison2; # error: too few arguments to function 'int yylex(...
1282912829 inherit cups;
1283012830 harfbuzz = harfbuzzFull;