Merge pull request #54525 from ttuegel/feature/qt-5/wrap-qt-apps

Wrap Qt applications
This commit is contained in:
Thomas Tuegel 2019-07-05 14:38:10 -05:00 committed by GitHub
commit 56d5963382
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 653 additions and 452 deletions

View File

@ -4,71 +4,173 @@
<title>Qt</title> <title>Qt</title>
<para> <para>
Qt is a comprehensive desktop and mobile application development toolkit for This section describes the differences between Nix expressions for Qt
C++. Legacy support is available for Qt 3 and Qt 4, but all current libraries and applications and Nix expressions for other C++ software. Some
development uses Qt 5. The Qt 5 packages in Nixpkgs are updated frequently to knowledge of the latter is assumed. There are primarily two problems which
take advantage of new features, but older versions are typically retained the Qt infrastructure is designed to address: ensuring consistent versioning
until their support window ends. The most important consideration in of all dependencies and finding dependencies at runtime.
packaging Qt-based software is ensuring that each package and all its
dependencies use the same version of Qt 5; this consideration motivates most
of the tools described below.
</para> </para>
<section xml:id="ssec-qt-libraries"> <example xml:id='qt-default-nix'>
<title>Packaging Libraries for Nixpkgs</title> <title>Nix expression for a Qt package (<filename>default.nix</filename>)</title>
<programlisting>
{ mkDerivation, lib, qtbase }: <co xml:id='qt-default-nix-co-1' />
<para> mkDerivation { <co xml:id='qt-default-nix-co-2' />
Whenever possible, libraries that use Qt 5 should be built with each pname = "myapp";
available version. Packages providing libraries should be added to the version = "1.0";
top-level function <varname>mkLibsForQt5</varname>, which is used to build a
set of libraries for every Qt 5 version. A special
<varname>callPackage</varname> function is used in this scope to ensure that
the entire dependency tree uses the same Qt 5 version. Import dependencies
unqualified, i.e., <literal>qtbase</literal> not
<literal>qt5.qtbase</literal>. <emphasis>Do not</emphasis> import a package
set such as <literal>qt5</literal> or <literal>libsForQt5</literal>.
</para>
<para> buildInputs = [ qtbase ]; <co xml:id='qt-default-nix-co-3' />
If a library does not support a particular version of Qt 5, it is best to }
mark it as broken by setting its <literal>meta.broken</literal> attribute. A </programlisting>
package may be marked broken for certain versions by testing the </example>
<literal>qtbase.version</literal> attribute, which will always give the
current Qt 5 version.
</para>
</section>
<section xml:id="ssec-qt-applications"> <calloutlist>
<title>Packaging Applications for Nixpkgs</title> <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.
</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>
</calloutlist>
<para> <formalpara xml:id='qt-runtime-dependencies'>
Call your application expression using <title>Locating runtime dependencies</title>
<literal>libsForQt5.callPackage</literal> instead of <para>
<literal>callPackage</literal>. Import dependencies unqualified, i.e., Qt applications need to be wrapped to find runtime dependencies. If you
<literal>qtbase</literal> not <literal>qt5.qtbase</literal>. <emphasis>Do cannot use <literal>mkDerivation</literal> or
not</emphasis> import a package set such as <literal>qt5</literal> or <literal>mkDerivationWith</literal> above, include
<literal>libsForQt5</literal>. <literal>wrapQtAppsHook</literal> in <literal>nativeBuildInputs</literal>:
</para> <programlisting>
stdenv.mkDerivation {
# ...
<para> nativeBuildInputs = [ wrapQtAppsHook ];
Qt 5 maintains strict backward compatibility, so it is generally best to }
build an application package against the latest version using the </programlisting>
<varname>libsForQt5</varname> library set. In case a package does not build </para>
with the latest Qt version, it is possible to pick a set pinned to a </formalpara>
particular version, e.g. <varname>libsForQt55</varname> for Qt 5.5, if that
is the latest version the package supports. If a package must be pinned to <para>
an older Qt version, be sure to file a bug upstream; because Qt is strictly Entries added to <literal>qtWrapperArgs</literal> are used to modify the
backwards-compatible, any incompatibility is by definition a bug in the wrappers created by <literal>wrapQtAppsHook</literal>. The entries are
application. passed as arguments to <xref linkend='fun-wrapProgram' />.
</para> <programlisting>
mkDerivation {
# ...
qtWrapperArgs = [ ''--prefix PATH : /path/to/bin'' ];
}
</programlisting>
</para>
<para>
Set <literal>dontWrapQtApps</literal> to stop applications from being
wrapped automatically. It is required to wrap applications manually with
<literal>wrapQtApp</literal>, using the syntax of
<xref linkend='fun-wrapProgram' />:
<programlisting>
mkDerivation {
# ...
dontWrapQtApps = true;
preFixup = ''
wrapQtApp "$out/bin/myapp" --prefix PATH : /path/to/bin
'';
}
</programlisting>
</para>
<para>
Libraries are built with every available version of Qt. Use the <literal>meta.broken</literal>
attribute to disable the package for unsupported Qt versions:
<programlisting>
mkDerivation {
# ...
# Disable this library with Qt &lt; 5.9.0
meta.broken = builtins.compareVersions qtbase.version "5.9.0" &lt; 0;
}
</programlisting>
</para>
<formalpara>
<title>Adding a library to Nixpkgs</title>
<para>
Add a Qt library to <filename>all-packages.nix</filename> by adding it to the
collection inside <literal>mkLibsForQt5</literal>. This ensures that the
library is built with every available version of Qt as needed.
<example xml:id='qt-library-all-packages-nix'>
<title>Adding a Qt library to <filename>all-packages.nix</filename></title>
<programlisting>
{
# ...
mkLibsForQt5 = self: with self; {
# ...
mylib = callPackage ../path/to/mylib {};
};
# ...
}
</programlisting>
</example>
</para>
</formalpara>
<formalpara>
<title>Adding an application to Nixpkgs</title>
<para>
Add a Qt application to <filename>all-packages.nix</filename> using
<literal>libsForQt5.callPackage</literal> instead of the usual
<literal>callPackage</literal>. The former ensures that all dependencies
are built with the same version of Qt.
<example xml:id='qt-application-all-packages-nix'>
<title>Adding a Qt application to <filename>all-packages.nix</filename></title>
<programlisting>
{
# ...
myapp = libsForQt5.callPackage ../path/to/myapp/ {};
# ...
}
</programlisting>
</example>
</para>
</formalpara>
<para>
When testing applications in Nixpkgs, it is a common practice to build the
package with <literal>nix-build</literal> and run it using the created
symbolic link. This will not work with Qt applications, however, because
they have many hard runtime requirements that can only be guaranteed if the
package is actually installed. To test a Qt application, install it with
<literal>nix-env</literal> or run it inside <literal>nix-shell</literal>.
</para>
</section>
</section> </section>

View File

@ -64,8 +64,8 @@ in
}; };
security.wrappers = { security.wrappers = {
kcheckpass.source = "${lib.getBin plasma5.kscreenlocker}/lib/libexec/kcheckpass"; kcheckpass.source = "${lib.getBin plasma5.kscreenlocker}/libexec/kcheckpass";
"start_kdeinit".source = "${lib.getBin pkgs.kinit}/lib/libexec/kf5/start_kdeinit"; "start_kdeinit".source = "${lib.getBin pkgs.kinit}/libexec/kf5/start_kdeinit";
kwin_wayland = { kwin_wayland = {
source = "${lib.getBin plasma5.kwin}/bin/kwin_wayland"; source = "${lib.getBin plasma5.kwin}/bin/kwin_wayland";
capabilities = "cap_sys_nice+ep"; capabilities = "cap_sys_nice+ep";

View File

@ -1,5 +1,5 @@
{ stdenv, fetchurl, pkgconfig, autoreconfHook, openssl, db48, boost, zeromq, rapidcheck { stdenv, fetchurl, pkgconfig, autoreconfHook, openssl, db48, boost, zeromq, rapidcheck
, zlib, miniupnpc, qtbase ? null, qttools ? null, utillinux, protobuf, python3, qrencode, libevent , zlib, miniupnpc, qtbase ? null, qttools ? null, wrapQtAppsHook ? null, utillinux, protobuf, python3, qrencode, libevent
, withGui }: , withGui }:
with stdenv.lib; with stdenv.lib;
@ -14,7 +14,9 @@ stdenv.mkDerivation rec{
sha256 = "5e4e6890e07b620a93fdb24605dae2bb53e8435b2a93d37558e1db1913df405f"; sha256 = "5e4e6890e07b620a93fdb24605dae2bb53e8435b2a93d37558e1db1913df405f";
}; };
nativeBuildInputs = [ pkgconfig autoreconfHook ]; nativeBuildInputs =
[ pkgconfig autoreconfHook ]
++ optional withGui wrapQtAppsHook;
buildInputs = [ openssl db48 boost zlib zeromq buildInputs = [ openssl db48 boost zlib zeromq
miniupnpc protobuf libevent] miniupnpc protobuf libevent]
++ optionals stdenv.isLinux [ utillinux ] ++ optionals stdenv.isLinux [ utillinux ]
@ -34,10 +36,11 @@ stdenv.mkDerivation rec{
doCheck = true; doCheck = true;
# QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI. checkFlags =
# See also https://github.com/NixOS/nixpkgs/issues/24256 [ "LC_ALL=C.UTF-8" ]
checkFlags = optionals withGui [ "QT_PLUGIN_PATH=${qtbase}/lib/qt-5.${versions.minor qtbase.version}/plugins" ] # QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI.
++ [ "LC_ALL=C.UTF-8" ]; # See also https://github.com/NixOS/nixpkgs/issues/24256
++ optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}";
enableParallelBuilding = true; enableParallelBuilding = true;

View File

@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub { stdenv, fetchFromGitHub
, makeWrapper, makeDesktopItem , wrapQtAppsHook, makeDesktopItem
, qtbase, qmake, qtmultimedia, qttools , qtbase, qmake, qtmultimedia, qttools
, qtgraphicaleffects, qtdeclarative , qtgraphicaleffects, qtdeclarative
, qtlocation, qtquickcontrols, qtquickcontrols2 , qtlocation, qtquickcontrols, qtquickcontrols2
@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
sha256 = "1l4kx2vidr7bpds43jdbwyaz0q1dy7sricpz061ff1fkappbxdh8"; sha256 = "1l4kx2vidr7bpds43jdbwyaz0q1dy7sricpz061ff1fkappbxdh8";
}; };
nativeBuildInputs = [ qmake pkgconfig ]; nativeBuildInputs = [ qmake pkgconfig wrapQtAppsHook ];
buildInputs = [ buildInputs = [
qtbase qtmultimedia qtgraphicaleffects qtbase qtmultimedia qtgraphicaleffects
@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
qtwebchannel qtwebengine qtx11extras qtwebchannel qtwebengine qtx11extras
qtxmlpatterns monero unbound readline qtxmlpatterns monero unbound readline
boost libunwind libsodium pcsclite zeromq boost libunwind libsodium pcsclite zeromq
cppzmq makeWrapper hidapi cppzmq hidapi
]; ];
patches = [ patches = [
@ -94,11 +94,6 @@ stdenv.mkDerivation rec {
cp $src/images/appicons/$size.png \ cp $src/images/appicons/$size.png \
$out/share/icons/hicolor/$size/apps/monero.png $out/share/icons/hicolor/$size/apps/monero.png
done; done;
# wrap runtime dependencies
wrapProgram $out/bin/monero-wallet-gui \
--set QML2_IMPORT_PATH "${qml2ImportPath}" \
--set QT_PLUGIN_PATH "${qtbase.bin}/${qtbase.qtPluginPrefix}"
''; '';
meta = { meta = {

View File

@ -1,7 +1,7 @@
{ stdenv, fetchFromGitHub, alsaLib, file, fluidsynth, ffmpeg, jack2, { stdenv, fetchFromGitHub, alsaLib, file, fluidsynth, ffmpeg, jack2,
liblo, libpulseaudio, libsndfile, pkgconfig, python3Packages, liblo, libpulseaudio, libsndfile, pkgconfig, python3Packages,
which, withFrontend ? true, which, withFrontend ? true,
withQt ? true, qtbase ? null, withQt ? true, qtbase ? null, wrapQtAppsHook ? null,
withGtk2 ? true, gtk2 ? null, withGtk2 ? true, gtk2 ? null,
withGtk3 ? true, gtk3 ? null }: withGtk3 ? true, gtk3 ? null }:
@ -9,6 +9,7 @@ with stdenv.lib;
assert withFrontend -> python3Packages ? pyqt5; assert withFrontend -> python3Packages ? pyqt5;
assert withQt -> qtbase != null; assert withQt -> qtbase != null;
assert withQt -> wrapQtAppsHook != null;
assert withGtk2 -> gtk2 != null; assert withGtk2 -> gtk2 != null;
assert withGtk3 -> gtk3 != null; assert withGtk3 -> gtk3 != null;
@ -23,7 +24,9 @@ stdenv.mkDerivation rec {
sha256 = "0fqgncqlr86n38yy7pa118mswfacmfczj7w9xx6c6k0jav3wk29k"; sha256 = "0fqgncqlr86n38yy7pa118mswfacmfczj7w9xx6c6k0jav3wk29k";
}; };
nativeBuildInputs = [ python3Packages.wrapPython pkgconfig which ]; nativeBuildInputs = [
python3Packages.wrapPython pkgconfig which wrapQtAppsHook
];
pythonPath = with python3Packages; [ pythonPath = with python3Packages; [
rdflib pyliblo rdflib pyliblo
@ -38,6 +41,7 @@ stdenv.mkDerivation rec {
installFlags = [ "PREFIX=$(out)" ]; installFlags = [ "PREFIX=$(out)" ];
dontWrapQtApps = true;
postFixup = '' postFixup = ''
# Also sets program_PYTHONPATH and program_PATH variables # Also sets program_PYTHONPATH and program_PATH variables
wrapPythonPrograms wrapPythonPrograms
@ -48,10 +52,9 @@ stdenv.mkDerivation rec {
patchPythonScript "$out/share/carla/carla_settings.py" patchPythonScript "$out/share/carla/carla_settings.py"
for program in $out/bin/*; do for program in $out/bin/*; do
wrapProgram "$program" \ wrapQtApp "$program" \
--prefix PATH : "$program_PATH:${which}/bin" \ --prefix PATH : "$program_PATH:${which}/bin" \
--set PYTHONNOUSERSITE true \ --set PYTHONNOUSERSITE true
--prefix QT_PLUGIN_PATH : "${qtbase.bin}/${qtbase.qtPluginPrefix}"
done done
''; '';

View File

@ -3,7 +3,7 @@
, chromaprint, docbook_xml_dtd_45, docbook_xsl, libxslt , chromaprint, docbook_xml_dtd_45, docbook_xsl, libxslt
, id3lib, taglib, mp4v2, flac, libogg, libvorbis , id3lib, taglib, mp4v2, flac, libogg, libvorbis
, zlib, readline , qtbase, qttools, qtmultimedia, qtquickcontrols , zlib, readline , qtbase, qttools, qtmultimedia, qtquickcontrols
, makeWrapper , wrapQtAppsHook
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -16,11 +16,12 @@ stdenv.mkDerivation rec {
sha256 = "0xkrsjrbr3z8cn8hjf623l28r3b755gr11i0clv8d8i3s10vhbd8"; sha256 = "0xkrsjrbr3z8cn8hjf623l28r3b755gr11i0clv8d8i3s10vhbd8";
}; };
nativeBuildInputs = [ wrapQtAppsHook ];
buildInputs = with stdenv.lib; buildInputs = with stdenv.lib;
[ pkgconfig cmake python ffmpeg phonon automoc4 [ pkgconfig cmake python ffmpeg phonon automoc4
chromaprint docbook_xml_dtd_45 docbook_xsl libxslt chromaprint docbook_xml_dtd_45 docbook_xsl libxslt
id3lib taglib mp4v2 flac libogg libvorbis zlib readline id3lib taglib mp4v2 flac libogg libvorbis zlib readline
qtbase qttools qtmultimedia qtquickcontrols makeWrapper ]; qtbase qttools qtmultimedia qtquickcontrols ];
cmakeFlags = [ "-DWITH_APPS=Qt;CLI" ]; cmakeFlags = [ "-DWITH_APPS=Qt;CLI" ];
NIX_LDFLAGS = "-lm -lpthread"; NIX_LDFLAGS = "-lm -lpthread";
@ -29,10 +30,6 @@ stdenv.mkDerivation rec {
export DOCBOOKDIR="${docbook_xsl}/xml/xsl/docbook/" export DOCBOOKDIR="${docbook_xsl}/xml/xsl/docbook/"
''; '';
postInstall = ''
wrapProgram $out/bin/kid3-qt --prefix QT_PLUGIN_PATH : $out/lib/qt5/plugins
'';
enableParallelBuilding = true; enableParallelBuilding = true;
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -43,6 +43,8 @@ mkDerivation rec {
"-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${(builtins.parseDrvName llvmPackages.clang.name).version}/include" "-DCLANG_BUILTIN_DIR=${llvmPackages.clang-unwrapped}/lib/clang/${(builtins.parseDrvName llvmPackages.clang.name).version}/include"
]; ];
dontWrapQtApps = true;
postPatch = '' postPatch = ''
# FIXME: temporary until https://invent.kde.org/kde/kdevelop/merge_requests/8 is merged # FIXME: temporary until https://invent.kde.org/kde/kdevelop/merge_requests/8 is merged
substituteInPlace kdevplatform/language/backgroundparser/parsejob.cpp --replace \ substituteInPlace kdevplatform/language/backgroundparser/parsejob.cpp --replace \
@ -55,8 +57,7 @@ mkDerivation rec {
wrapProgram "$out/bin/kdevelop!" \ wrapProgram "$out/bin/kdevelop!" \
--prefix PATH ":" "${lib.makeBinPath [ qttools kde-cli-tools ]}" --prefix PATH ":" "${lib.makeBinPath [ qttools kde-cli-tools ]}"
wrapProgram "$out/bin/kdevelop" \ wrapQtApp "$out/bin/kdevelop"
--prefix QT_PLUGIN_PATH : $out/lib/qt-${qtVersion}/plugins
# Fix the (now wrapped) kdevelop! to find things in right places: # Fix the (now wrapped) kdevelop! to find things in right places:
# - Fixup the one use where KDEV_BASEDIR is assumed to contain kdevelop. # - Fixup the one use where KDEV_BASEDIR is assumed to contain kdevelop.

View File

@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub, gdal, cmake, ninja, proj, clipper, zlib, qtbase, qttools { stdenv, fetchFromGitHub, gdal, cmake, ninja, proj, clipper, zlib, qtbase, qttools
, qtlocation, qtsensors, doxygen, cups, makeWrapper, qtimageformats , qtlocation, qtsensors, doxygen, cups, wrapQtAppsHook, qtimageformats
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
buildInputs = [ gdal qtbase qttools qtlocation qtimageformats buildInputs = [ gdal qtbase qttools qtlocation qtimageformats
qtsensors clipper zlib proj doxygen cups]; qtsensors clipper zlib proj doxygen cups];
nativeBuildInputs = [ cmake makeWrapper ninja ]; nativeBuildInputs = [ cmake wrapQtAppsHook ninja ];
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "OpenOrienteering"; owner = "OpenOrienteering";
@ -48,9 +48,7 @@ stdenv.mkDerivation rec {
stdenv.lib.optionalString stdenv.isDarwin '' stdenv.lib.optionalString stdenv.isDarwin ''
# Fixes "This application failed to start because it could not find or load the Qt # Fixes "This application failed to start because it could not find or load the Qt
# platform plugin "cocoa"." # platform plugin "cocoa"."
wrapProgram $out/Mapper.app/Contents/MacOS/Mapper \ wrapQtApp $out/Mapper.app/Contents/MacOS/Mapper
--set QT_QPA_PLATFORM_PLUGIN_PATH ${qtbase.bin}/lib/qt-*/plugins/platforms \
--set QT_PLUGIN_PATH ${qtbase.bin}/${qtbase.qtPluginPrefix}:${qtimageformats}/${qtbase.qtPluginPrefix}
mkdir -p $out/bin mkdir -p $out/bin
ln -s $out/Mapper.app/Contents/MacOS/Mapper $out/bin/mapper ln -s $out/Mapper.app/Contents/MacOS/Mapper $out/bin/mapper
''; '';

View File

@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub, fetchpatch { stdenv, fetchFromGitHub, fetchpatch
, pkgconfig, makeWrapper , pkgconfig, wrapQtAppsHook
, poppler, qt5, gnuplot , poppler, qt5, gnuplot
}: }:
@ -36,9 +36,9 @@ stdenv.mkDerivation rec {
}) })
]; ];
nativeBuildInputs = [ pkgconfig qt5.qttools qt5.qmake wrapQtAppsHook ];
QT_PLUGIN_PATH = "${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}"; QT_PLUGIN_PATH = "${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}";
nativeBuildInputs = [ pkgconfig qt5.qttools qt5.qmake makeWrapper ];
buildInputs = [ qt5.qtbase poppler ]; buildInputs = [ qt5.qtbase poppler ];
enableParallelBuilding = true; enableParallelBuilding = true;
@ -50,9 +50,5 @@ stdenv.mkDerivation rec {
"QCOLLECTIONGENERATORCOMMAND=qhelpgenerator" "QCOLLECTIONGENERATORCOMMAND=qhelpgenerator"
]; ];
postFixup = '' qtWrapperArgs = [ ''--prefix PATH : "${gnuplot}/bin"'' ];
wrapProgram "$out/bin/qtikz" \
--prefix QT_PLUGIN_PATH : "${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}" \
--prefix PATH : "${gnuplot}/bin"
'';
} }

View File

@ -1,37 +1,39 @@
{ {
mkDerivation, lib, makeWrapper, mkDerivation, lib, config,
extra-cmake-modules, kdoctools, extra-cmake-modules, kdoctools,
karchive, kconfig, kcrash, kdbusaddons, ki18n, kiconthemes, kitemmodels, breeze-icons, karchive, kconfig, kcrash, kdbusaddons, ki18n,
khtml, kio, kparts, kpty, kservice, kwidgetsaddons, libarchive, kiconthemes, kitemmodels, khtml, kio, kparts, kpty, kservice, kwidgetsaddons,
libarchive, libzip,
# Archive tools # Archive tools
p7zip, unzip, zip, p7zip, lrzip,
# Unfree tools # Unfree tools
unfreeEnableUnrar ? false, unrar, unfreeEnableUnrar ? false, unrar,
}: }:
let
extraTools = [ p7zip lrzip ] ++ lib.optional unfreeEnableUnrar unrar;
in
mkDerivation { mkDerivation {
name = "ark"; name = "ark";
nativeBuildInputs = [ extra-cmake-modules kdoctools makeWrapper ];
propagatedBuildInputs = [
karchive kconfig kcrash kdbusaddons khtml ki18n kiconthemes kio kitemmodels
kparts kpty kservice kwidgetsaddons libarchive
];
outputs = [ "out" "dev" ];
postFixup =
let
PATH =
lib.makeBinPath
([ p7zip unzip zip ] ++ lib.optional unfreeEnableUnrar unrar);
in ''
wrapProgram "$out/bin/ark" --prefix PATH : "${PATH}"
'';
meta = { meta = {
license = with lib.licenses; license = with lib.licenses;
[ gpl2 lgpl3 ] ++ lib.optional unfreeEnableUnrar unfree; [ gpl2 lgpl3 ] ++ lib.optional unfreeEnableUnrar unfree;
maintainers = [ lib.maintainers.ttuegel ]; maintainers = [ lib.maintainers.ttuegel ];
}; };
outputs = [ "out" "dev" ];
nativeBuildInputs = [ extra-cmake-modules kdoctools ];
buildInputs = [ libarchive libzip ] ++ extraTools;
propagatedBuildInputs = [
breeze-icons karchive kconfig kcrash kdbusaddons khtml ki18n kiconthemes kio
kitemmodels kparts kpty kservice kwidgetsaddons
];
qtWrapperArgs = [ "--prefix" "PATH" ":" (lib.makeBinPath extraTools) ];
} }

View File

@ -1,18 +1,18 @@
{ {
stdenv, mkDerivation, lib, stdenv, mkDerivation, lib,
extra-cmake-modules, kdoctools, extra-cmake-modules, kdoctools,
chmlib ? null, discount, djvulibre, ebook_tools, kactivities, karchive, kbookmarks, breeze-icons, chmlib ? null, discount, djvulibre, ebook_tools, kactivities,
kcompletion, kconfig, kconfigwidgets, kcoreaddons, kdbusaddons, karchive, kbookmarks, kcompletion, kconfig, kconfigwidgets, kcoreaddons,
kdegraphics-mobipocket, kiconthemes, kjs, khtml, kio, kparts, kpty, kwallet, kdbusaddons, kdegraphics-mobipocket, kiconthemes, kjs, khtml, kio, kparts,
kwindowsystem, libkexiv2, libspectre, libzip, phonon, poppler, qca-qt5, kpty, kwallet, kwindowsystem, libkexiv2, libspectre, libzip, phonon, poppler,
qtdeclarative, qtsvg, threadweaver, kcrash qca-qt5, qtdeclarative, qtsvg, threadweaver, kcrash
}: }:
mkDerivation { mkDerivation {
name = "okular"; name = "okular";
nativeBuildInputs = [ extra-cmake-modules kdoctools ]; nativeBuildInputs = [ extra-cmake-modules kdoctools ];
buildInputs = [ buildInputs = [
discount djvulibre ebook_tools kactivities karchive kbookmarks breeze-icons discount djvulibre ebook_tools kactivities karchive kbookmarks
kcompletion kconfig kconfigwidgets kcoreaddons kdbusaddons kcompletion kconfig kconfigwidgets kcoreaddons kdbusaddons
kdegraphics-mobipocket kiconthemes kjs khtml kio kparts kpty kwallet kdegraphics-mobipocket kiconthemes kjs khtml kio kparts kpty kwallet
kwindowsystem libkexiv2 libspectre libzip phonon poppler qca-qt5 kwindowsystem libkexiv2 libspectre libzip phonon poppler qca-qt5

View File

@ -37,11 +37,6 @@ mkDerivation rec {
rm "$out/lib" rm "$out/lib"
''; '';
postInstall = ''
wrapProgram $out/bin/albert \
--prefix XDG_DATA_DIRS : $out/share
'';
meta = with lib; { meta = with lib; {
homepage = https://albertlauncher.github.io/; homepage = https://albertlauncher.github.io/;
description = "Desktop agnostic launcher"; description = "Desktop agnostic launcher";

View File

@ -1,4 +1,4 @@
{ lib, fetchurl, python3Packages, qtbase, makeWrapper }: { lib, fetchurl, python3Packages, qtbase, wrapQtAppsHook }:
python3Packages.buildPythonApplication rec { python3Packages.buildPythonApplication rec {
pname = "electron-cash"; pname = "electron-cash";
@ -32,7 +32,7 @@ python3Packages.buildPythonApplication rec {
btchip btchip
]; ];
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ wrapQtAppsHook ];
postPatch = '' postPatch = ''
substituteInPlace contrib/requirements/requirements.txt \ substituteInPlace contrib/requirements/requirements.txt \
@ -54,10 +54,6 @@ python3Packages.buildPythonApplication rec {
postInstall = '' postInstall = ''
substituteInPlace $out/share/applications/electron-cash.desktop \ substituteInPlace $out/share/applications/electron-cash.desktop \
--replace "Exec=electron-cash" "Exec=$out/bin/electron-cash" --replace "Exec=electron-cash" "Exec=$out/bin/electron-cash"
# Please remove this when #44047 is fixed
wrapProgram $out/bin/electron-cash \
--prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-5.${lib.versions.minor qtbase.version}/plugins
''; '';
doInstallCheck = true; doInstallCheck = true;

View File

@ -17,6 +17,7 @@
, qtsvg , qtsvg
, qtx11extras , qtx11extras
, quazip , quazip
, wrapQtAppsHook
, yubikey-personalization , yubikey-personalization
, zlib , zlib
@ -73,12 +74,11 @@ stdenv.mkDerivation rec {
doCheck = true; doCheck = true;
checkPhase = '' checkPhase = ''
export LC_ALL="en_US.UTF-8" export LC_ALL="en_US.UTF-8"
export QT_PLUGIN_PATH="${qtbase.bin}/${qtbase.qtPluginPrefix}"
export QT_QPA_PLATFORM=offscreen export QT_QPA_PLATFORM=offscreen
make test ARGS+="-E testgui --output-on-failure" make test ARGS+="-E testgui --output-on-failure"
''; '';
nativeBuildInputs = [ cmake makeWrapper qttools ]; nativeBuildInputs = [ cmake wrapQtAppsHook qttools ];
buildInputs = [ buildInputs = [
curl curl
@ -102,10 +102,9 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional withKeePassKeeShareSecure quazip ++ stdenv.lib.optional withKeePassKeeShareSecure quazip
++ stdenv.lib.optional stdenv.isDarwin qtmacextras; ++ stdenv.lib.optional stdenv.isDarwin qtmacextras;
postInstall = optionalString stdenv.isDarwin '' preFixup = optionalString stdenv.isDarwin ''
# Make it work without Qt in PATH. # Make it work without Qt in PATH.
wrapProgram $out/Applications/KeePassXC.app/Contents/MacOS/KeePassXC \ wrapQtApp $out/Applications/KeePassXC.app/Contents/MacOS/KeePassXC
--set QT_PLUGIN_PATH ${qtbase.bin}/${qtbase.qtPluginPrefix}
''; '';
meta = { meta = {

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, sane-backends, qtbase, qtsvg, nss, autoPatchelfHook, lib, makeWrapper }: { stdenv, fetchurl, sane-backends, qtbase, qtsvg, nss, autoPatchelfHook, lib, wrapQtAppsHook }:
let let
version = "5.4.10"; version = "5.4.10";
@ -11,17 +11,12 @@ in stdenv.mkDerivation {
sha256 = "1902ahb2g9xanrip1n0ihr31az8sv9fsvzddnzf70kbwlfclnqf7"; sha256 = "1902ahb2g9xanrip1n0ihr31az8sv9fsvzddnzf70kbwlfclnqf7";
}; };
nativeBuildInputs = [ autoPatchelfHook makeWrapper ]; nativeBuildInputs = [ autoPatchelfHook wrapQtAppsHook ];
buildInputs = [ nss qtbase qtsvg sane-backends stdenv.cc.cc ]; buildInputs = [ nss qtbase qtsvg sane-backends stdenv.cc.cc ];
dontStrip = true; dontStrip = true;
# Please remove this when #44047 is fixed
postInstall = ''
wrapProgram $out/bin/masterpdfeditor5 --prefix QT_PLUGIN_PATH : ${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
'';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, fetchFromGitHub, autoreconfHook, cmake, makeWrapper, pkgconfig, qmake { stdenv, fetchurl, fetchFromGitHub, autoreconfHook, cmake, wrapQtAppsHook, pkgconfig, qmake
, curl, grantlee, libgit2, libusb, libssh2, libxml2, libxslt, libzip, zlib , curl, grantlee, libgit2, libusb, libssh2, libxml2, libxslt, libzip, zlib
, qtbase, qtconnectivity, qtlocation, qtsvg, qttools, qtwebkit, libXcomposite , qtbase, qtconnectivity, qtlocation, qtsvg, qttools, qtwebkit, libXcomposite
}: }:
@ -79,18 +79,13 @@ in stdenv.mkDerivation rec {
qtbase qtconnectivity qtsvg qttools qtwebkit qtbase qtconnectivity qtsvg qttools qtwebkit
]; ];
nativeBuildInputs = [ cmake makeWrapper pkgconfig ]; nativeBuildInputs = [ cmake wrapQtAppsHook pkgconfig ];
cmakeFlags = [ cmakeFlags = [
"-DLIBDC_FROM_PKGCONFIG=ON" "-DLIBDC_FROM_PKGCONFIG=ON"
"-DNO_PRINTING=OFF" "-DNO_PRINTING=OFF"
]; ];
postInstall = ''
wrapProgram $out/bin/subsurface \
--prefix QT_PLUGIN_PATH : "${googlemaps}/${googlemaps.pluginsSubdir}"
'';
enableParallelBuilding = true; enableParallelBuilding = true;
passthru = { inherit version libdc googlemaps; }; passthru = { inherit version libdc googlemaps; };

View File

@ -1,6 +1,6 @@
{ enableGUI ? true, enablePDFtoPPM ? true, useT1Lib ? false { enableGUI ? true, enablePDFtoPPM ? true, useT1Lib ? false
, stdenv, fetchurl, zlib, libpng, freetype ? null, t1lib ? null , stdenv, fetchurl, zlib, libpng, freetype ? null, t1lib ? null
, cmake, qtbase ? null, qtsvg ? null, makeWrapper , cmake, qtbase ? null, qtsvg ? null, wrapQtAppsHook
}: }:
assert enableGUI -> qtbase != null && qtsvg != null && freetype != null; assert enableGUI -> qtbase != null && qtsvg != null && freetype != null;
@ -22,7 +22,9 @@ stdenv.mkDerivation {
# https://cmake.org/cmake/help/v3.10/command/cmake_minimum_required.html # https://cmake.org/cmake/help/v3.10/command/cmake_minimum_required.html
patches = stdenv.lib.optional stdenv.isDarwin ./cmake_version.patch; patches = stdenv.lib.optional stdenv.isDarwin ./cmake_version.patch;
nativeBuildInputs = [ cmake makeWrapper ]; nativeBuildInputs =
[ cmake ]
++ stdenv.lib.optional enableGUI wrapQtAppsHook;
cmakeFlags = ["-DSYSTEM_XPDFRC=/etc/xpdfrc" "-DA4_PAPER=ON"]; cmakeFlags = ["-DSYSTEM_XPDFRC=/etc/xpdfrc" "-DA4_PAPER=ON"];
@ -36,11 +38,6 @@ stdenv.mkDerivation {
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
postInstall = stdenv.lib.optionalString (stdenv.isDarwin && enableGUI) ''
wrapProgram $out/bin/xpdf \
--set QT_PLUGIN_PATH ${qtbase.bin}/${qtbase.qtPluginPrefix}:${qtsvg.bin}/${qtbase.qtPluginPrefix}
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = https://www.xpdfreader.com; homepage = https://www.xpdfreader.com;
description = "Viewer for Portable Document Format (PDF) files"; description = "Viewer for Portable Document Format (PDF) files";

View File

@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
]; ];
enableParallelBuilding = true; enableParallelBuilding = true;
nativeBuildInputs = [ qt.qmake makeWrapper ]; nativeBuildInputs = [ qt.qmake qt.wrapQtAppsHook ];
buildInputs = [ qt.qtbase ]; buildInputs = [ qt.qtbase ];
qmakeFlags = [ "CONFIG-=app_bundle" ]; qmakeFlags = [ "CONFIG-=app_bundle" ];
@ -29,11 +29,6 @@ stdenv.mkDerivation rec {
cp qtchan $out/bin cp qtchan $out/bin
''; '';
preFixup = ''
wrapProgram $out/bin/qtchan \
--suffix QT_PLUGIN_PATH : ${qt.qtbase.bin}/${qt.qtbase.qtPluginPrefix}
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "4chan browser in qt5"; description = "4chan browser in qt5";
homepage = "https://github.com/siavash119/qtchan"; homepage = "https://github.com/siavash119/qtchan";

View File

@ -1,7 +1,7 @@
{ stable, version, sha256Hash, archPatchesRevision, archPatchesHash }: { stable, version, sha256Hash, archPatchesRevision, archPatchesHash }:
{ mkDerivation, lib, fetchFromGitHub, fetchsvn { mkDerivation, lib, fetchFromGitHub, fetchsvn
, pkgconfig, pythonPackages, cmake, wrapGAppsHook, gcc8 , pkgconfig, pythonPackages, cmake, wrapGAppsHook, wrapQtAppsHook, gcc8
, qtbase, qtimageformats, gtk3, libappindicator-gtk3, libnotify, xdg_utils , qtbase, qtimageformats, gtk3, libappindicator-gtk3, libnotify, xdg_utils
, dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3 , dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3
}: }:
@ -39,7 +39,7 @@ mkDerivation rec {
--replace '"notify"' '"${libnotify}/lib/libnotify.so"' --replace '"notify"' '"${libnotify}/lib/libnotify.so"'
''; '';
nativeBuildInputs = [ pkgconfig pythonPackages.gyp cmake wrapGAppsHook gcc8 ]; nativeBuildInputs = [ pkgconfig pythonPackages.gyp cmake wrapGAppsHook wrapQtAppsHook gcc8 ];
# We want to run wrapProgram manually (with additional parameters) # We want to run wrapProgram manually (with additional parameters)
dontWrapGApps = true; dontWrapGApps = true;
@ -129,12 +129,13 @@ mkDerivation rec {
done done
''; '';
dontWrapQtApps = true;
postFixup = '' postFixup = ''
# This is necessary to run Telegram in a pure environment. # This is necessary to run Telegram in a pure environment.
# We also use gappsWrapperArgs from wrapGAppsHook. # We also use gappsWrapperArgs from wrapGAppsHook.
wrapProgram $out/bin/telegram-desktop \ wrapProgram $out/bin/telegram-desktop \
"''${gappsWrapperArgs[@]}" \ "''${gappsWrapperArgs[@]}" \
--prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}" \ "''${qtWrapperArgs[@]}" \
--prefix PATH : ${xdg_utils}/bin \ --prefix PATH : ${xdg_utils}/bin \
--set XDG_RUNTIME_DIR "XDG-RUNTIME-DIR" --set XDG_RUNTIME_DIR "XDG-RUNTIME-DIR"
sed -i $out/bin/telegram-desktop \ sed -i $out/bin/telegram-desktop \

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, qtbase, qtsvg, qmake, pkgconfig, boost, wirelesstools, iw, qwt, makeWrapper }: { stdenv, fetchurl, qtbase, qtsvg, qmake, pkgconfig, boost, wirelesstools, iw, qwt, wrapQtAppsHook }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "linssid-${version}"; name = "linssid-${version}";
@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "13d35rlcjncd8lx3khkgn9x8is2xjd5fp6ns5xsn3w6l4xj9b4gl"; sha256 = "13d35rlcjncd8lx3khkgn9x8is2xjd5fp6ns5xsn3w6l4xj9b4gl";
}; };
nativeBuildInputs = [ pkgconfig qmake makeWrapper ]; nativeBuildInputs = [ pkgconfig qmake wrapQtAppsHook ];
buildInputs = [ qtbase qtsvg boost qwt ]; buildInputs = [ qtbase qtsvg boost qwt ];
patches = [ ./0001-unbundled-qwt.patch ]; patches = [ ./0001-unbundled-qwt.patch ];
@ -26,11 +26,8 @@ stdenv.mkDerivation rec {
rm -fr qwt-lib rm -fr qwt-lib
''; '';
postInstall = '' qtWrapperArgs =
wrapProgram $out/bin/linssid \ [ ''--prefix PATH : ${stdenv.lib.makeBinPath [ wirelesstools iw ]}'' ];
--prefix QT_PLUGIN_PATH : ${qtbase}/${qtbase.qtPluginPrefix} \
--prefix PATH : ${stdenv.lib.makeBinPath [ wirelesstools iw ]}
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Graphical wireless scanning for Linux"; description = "Graphical wireless scanning for Linux";

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, fetchFromGitHub, fetchpatch, makeWrapper, pkgconfig { stdenv, fetchurl, fetchFromGitHub, fetchpatch, pkgconfig
, qt4, qmake4Hook, qt5, avahi, boost, libopus, libsndfile, protobuf3_6, speex, libcap , qt4, qmake4Hook, qt5, avahi, boost, libopus, libsndfile, protobuf3_6, speex, libcap
, alsaLib, python , alsaLib, python
, jackSupport ? false, libjack2 ? null , jackSupport ? false, libjack2 ? null
@ -158,11 +158,6 @@ in {
murmur_git = (server gitSource).overrideAttrs (old: { murmur_git = (server gitSource).overrideAttrs (old: {
meta = old.meta // { broken = iceSupport; }; meta = old.meta // { broken = iceSupport; };
nativeBuildInputs = old.nativeBuildInputs or [] ++ [ makeWrapper ]; nativeBuildInputs = old.nativeBuildInputs or [] ++ [ qt5.wrapQtAppsHook ];
installPhase = old.installPhase or "" + ''
wrapProgram $out/bin/murmurd --suffix QT_PLUGIN_PATH : \
${getBin qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}
'';
}); });
} }

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, qmake, pkgconfig, makeWrapper { stdenv, fetchFromGitHub, qmake, pkgconfig, wrapQtAppsHook
, qtbase, qttools, qtwebkit, sqlite , qtbase, qttools, qtwebkit, sqlite
}: }:
@ -13,14 +13,9 @@ stdenv.mkDerivation rec {
sha256 = "0xav9qr8n6310636nfbgx4iix65fs3ya5rz2isxsf38bkjm7r3pa"; sha256 = "0xav9qr8n6310636nfbgx4iix65fs3ya5rz2isxsf38bkjm7r3pa";
}; };
nativeBuildInputs = [ qmake pkgconfig makeWrapper ]; nativeBuildInputs = [ qmake pkgconfig wrapQtAppsHook ];
buildInputs = [ qtbase qttools qtwebkit sqlite.dev ]; buildInputs = [ qtbase qttools qtwebkit sqlite.dev ];
postFixup = ''
wrapProgram $out/bin/quiterss \
--prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}"
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A Qt-based RSS/Atom news feed reader"; description = "A Qt-based RSS/Atom news feed reader";
longDescription = '' longDescription = ''

View File

@ -1,5 +1,5 @@
{ stdenv, fetchgit, cmake, pkgconfig, qtbase, qtwebkit, qtkeychain, qttools, sqlite { stdenv, fetchgit, cmake, pkgconfig, qtbase, qtwebkit, qtkeychain, qttools, sqlite
, inotify-tools, makeWrapper, openssl_1_1, pcre, qtwebengine, libsecret , inotify-tools, wrapQtAppsHook, openssl_1_1, pcre, qtwebengine, libsecret
, libcloudproviders , libcloudproviders
}: }:
@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
fetchSubmodules = true; fetchSubmodules = true;
}; };
nativeBuildInputs = [ pkgconfig cmake makeWrapper ]; nativeBuildInputs = [ pkgconfig cmake wrapQtAppsHook ];
buildInputs = [ qtbase qtwebkit qtkeychain qttools qtwebengine sqlite openssl_1_1.out pcre inotify-tools libcloudproviders ]; buildInputs = [ qtbase qtwebkit qtkeychain qttools qtwebengine sqlite openssl_1_1.out pcre inotify-tools libcloudproviders ];
@ -31,13 +31,13 @@ stdenv.mkDerivation rec {
"-DINOTIFY_INCLUDE_DIR=${inotify-tools}/include" "-DINOTIFY_INCLUDE_DIR=${inotify-tools}/include"
]; ];
qtWrapperArgs = [
''--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ libsecret ]}''
];
postInstall = '' postInstall = ''
sed -i 's/\(Icon.*\)=nextcloud/\1=Nextcloud/g' \ sed -i 's/\(Icon.*\)=nextcloud/\1=Nextcloud/g' \
$out/share/applications/nextcloud.desktop $out/share/applications/nextcloud.desktop
wrapProgram "$out/bin/nextcloud" \
--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ libsecret ]} \
--prefix QT_PLUGIN_PATH : ${qtbase}/${qtbase.qtPluginPrefix}
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -1,5 +1,5 @@
{ stdenv, fetchurl, lib, qtbase, qtmultimedia, qtsvg, qtdeclarative, qttools, full, { stdenv, fetchurl, lib, qtbase, qtmultimedia, qtsvg, qtdeclarative, qttools, full
libsecret, libGL, libpulseaudio, glib, makeWrapper, makeDesktopItem }: , libsecret, libGL, libpulseaudio, glib, wrapQtAppsHook, makeDesktopItem }:
let let
version = "1.1.5-1"; version = "1.1.5-1";
@ -28,7 +28,7 @@ in stdenv.mkDerivation rec {
sha256 = "1y5mphrs60zd6km9z64vskk70q9zzw4g6js7qvgl572wv81w2l75"; sha256 = "1y5mphrs60zd6km9z64vskk70q9zzw4g6js7qvgl572wv81w2l75";
}; };
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ wrapQtAppsHook ];
sourceRoot = "."; sourceRoot = ".";
@ -60,18 +60,11 @@ in stdenv.mkDerivation rec {
libpulseaudio libpulseaudio
glib glib
]; ];
qtPath = prefix: "${full}/${prefix}";
in '' in ''
patchelf \ patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${rpath}" \ --set-rpath "${rpath}" \
$out/lib/protonmail-bridge $out/lib/protonmail-bridge
wrapProgram $out/lib/protonmail-bridge \
--set QT_PLUGIN_PATH "${qtPath qtbase.qtPluginPrefix}" \
--set QML_IMPORT_PATH "${qtPath qtbase.qtQmlPrefix}" \
--set QML2_IMPORT_PATH "${qtPath qtbase.qtQmlPrefix}" \
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -30,7 +30,7 @@ in stdenv.mkDerivation {
nativeBuildInputs = [ nativeBuildInputs = [
bison cmake extra-cmake-modules flex pkgconfig bison cmake extra-cmake-modules flex pkgconfig
]; ] ++ optional withQt qt5.wrapQtAppsHook;
buildInputs = [ buildInputs = [
gettext pcre perl libpcap lua5 libssh nghttp2 openssl libgcrypt gettext pcre perl libpcap lua5 libssh nghttp2 openssl libgcrypt
@ -70,12 +70,9 @@ in stdenv.mkDerivation {
done done
done done
wrapProgram $out/Applications/Wireshark.app/Contents/MacOS/Wireshark \ wrapQtApp $out/Applications/Wireshark.app/Contents/MacOS/Wireshark
--set QT_PLUGIN_PATH ${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}
'' else optionalString withQt '' '' else optionalString withQt ''
install -Dm644 -t $out/share/applications ../wireshark.desktop install -Dm644 -t $out/share/applications ../wireshark.desktop
wrapProgram $out/bin/wireshark \
--set QT_PLUGIN_PATH ${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}
substituteInPlace $out/share/applications/*.desktop \ substituteInPlace $out/share/applications/*.desktop \
--replace "Exec=wireshark" "Exec=$out/bin/wireshark" --replace "Exec=wireshark" "Exec=$out/bin/wireshark"

View File

@ -1,4 +1,5 @@
{ stdenv, lib, fetchurl, doxygen, extra-cmake-modules, graphviz, kdoctools { stdenv, lib, fetchurl, doxygen, extra-cmake-modules, graphviz, kdoctools
, wrapQtAppsHook
, akonadi, alkimia, aqbanking, gmp, gwenhywfar, kactivities, karchive , akonadi, alkimia, aqbanking, gmp, gwenhywfar, kactivities, karchive
, kcmutils, kcontacts, kdewebkit, kdiagram, kholidays, kidentitymanagement , kcmutils, kcontacts, kdewebkit, kdiagram, kholidays, kidentitymanagement
@ -29,6 +30,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ nativeBuildInputs = [
doxygen extra-cmake-modules graphviz kdoctools python2Packages.wrapPython doxygen extra-cmake-modules graphviz kdoctools python2Packages.wrapPython
wrapQtAppsHook
]; ];
buildInputs = [ buildInputs = [
@ -57,13 +59,11 @@ stdenv.mkDerivation rec {
doInstallCheck = stdenv.hostPlatform == stdenv.buildPlatform; doInstallCheck = stdenv.hostPlatform == stdenv.buildPlatform;
installCheckInputs = [ xvfb_run ]; installCheckInputs = [ xvfb_run ];
installCheckPhase = let installCheckPhase =
pluginPath = "${qtbase.bin}/${qtbase.qtPluginPrefix}"; lib.optionalString doInstallCheck ''
in lib.optionalString doInstallCheck ''
QT_PLUGIN_PATH=${lib.escapeShellArg pluginPath} \
xvfb-run -s '-screen 0 1024x768x24' make test \ xvfb-run -s '-screen 0 1024x768x24' make test \
ARGS="-E '(reports-chart-test)'" # Test fails, so exclude it for now. ARGS="-E '(reports-chart-test)'" # Test fails, so exclude it for now.
''; '';
meta = { meta = {
description = "Personal finance manager for KDE"; description = "Personal finance manager for KDE";

View File

@ -1,11 +1,11 @@
{ stdenv, fetchsvn, makeWrapper, pkgconfig, cmake, qtbase, cairo, pixman, { stdenv, fetchsvn, wrapQtAppsHook, pkgconfig, cmake, qtbase, cairo, pixman,
boost, cups, fontconfig, freetype, hunspell, libjpeg, libtiff, libxml2, lcms2, boost, cups, fontconfig, freetype, hunspell, libjpeg, libtiff, libxml2, lcms2,
podofo, poppler, poppler_data, python2, harfbuzz, qtimageformats, qttools }: podofo, poppler, poppler_data, python2, harfbuzz, qtimageformats, qttools }:
let let
pythonEnv = python2.withPackages(ps: [ps.tkinter ps.pillow]); pythonEnv = python2.withPackages(ps: [ps.tkinter ps.pillow]);
revision = "22806"; revision = "22806";
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "scribus-unstable-${version}"; name = "scribus-unstable-${version}";
version = "2019-01-16"; version = "2019-01-16";
@ -18,17 +18,13 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
nativeBuildInputs = [ wrapQtAppsHook ];
buildInputs = [ buildInputs = [
makeWrapper pkgconfig cmake qtbase cairo pixman boost cups fontconfig pkgconfig cmake qtbase cairo pixman boost cups fontconfig
freetype hunspell libjpeg libtiff libxml2 lcms2 podofo poppler freetype hunspell libjpeg libtiff libxml2 lcms2 podofo poppler
poppler_data pythonEnv harfbuzz qtimageformats qttools poppler_data pythonEnv harfbuzz qtimageformats qttools
]; ];
postFixup = ''
wrapProgram $out/bin/scribus \
--prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}"
'';
meta = { meta = {
maintainers = [ stdenv.lib.maintainers.erictapen ]; maintainers = [ stdenv.lib.maintainers.erictapen ];
platforms = stdenv.lib.platforms.linux; platforms = stdenv.lib.platforms.linux;

View File

@ -1,7 +1,7 @@
{ mkDerivation, lib, fetchFromGitHub { mkDerivation, lib, fetchFromGitHub
, cmake, freetype, libpng, libGLU_combined, openssl, perl, libiconv , cmake, freetype, libpng, libGLU_combined, openssl, perl, libiconv
, qtscript, qtserialport, qttools , qtscript, qtserialport, qttools
, qtmultimedia, qtlocation, makeWrapper, qtbase , qtmultimedia, qtlocation, qtbase, wrapQtAppsHook
}: }:
mkDerivation rec { mkDerivation rec {
@ -15,18 +15,13 @@ mkDerivation rec {
sha256 = "0hf1wv2bb5j7ny2xh29mj9m4hjblhn02zylay8gl85w7xlqs7s5r"; sha256 = "0hf1wv2bb5j7ny2xh29mj9m4hjblhn02zylay8gl85w7xlqs7s5r";
}; };
nativeBuildInputs = [ cmake perl ]; nativeBuildInputs = [ cmake perl wrapQtAppsHook ];
buildInputs = [ buildInputs = [
freetype libpng libGLU_combined openssl libiconv qtscript qtserialport qttools freetype libpng libGLU_combined openssl libiconv qtscript qtserialport qttools
qtmultimedia qtlocation qtbase makeWrapper qtmultimedia qtlocation qtbase
]; ];
postInstall = ''
wrapProgram $out/bin/stellarium \
--prefix QT_PLUGIN_PATH : "${qtbase}/lib/qt-5.${lib.versions.minor qtbase.version}/plugins"
'';
meta = with lib; { meta = with lib; {
description = "Free open-source planetarium"; description = "Free open-source planetarium";
homepage = http://stellarium.org/; homepage = http://stellarium.org/;

View File

@ -1,6 +1,6 @@
{ stdenv, fetchFromGitHub, pkgconfig, cmake, { stdenv, fetchFromGitHub, pkgconfig, cmake,
libzip, boost, fftw, qtbase, libzip, boost, fftw, qtbase,
libusb, makeWrapper, libsigrok4dsl, libsigrokdecode4dsl libusb, wrapQtAppsHook, libsigrok4dsl, libsigrokdecode4dsl
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
./install.patch ./install.patch
]; ];
nativeBuildInputs = [ cmake pkgconfig makeWrapper ]; nativeBuildInputs = [ cmake pkgconfig wrapQtAppsHook ];
buildInputs = [ buildInputs = [
boost fftw qtbase libusb libzip libsigrokdecode4dsl libsigrok4dsl boost fftw qtbase libusb libzip libsigrokdecode4dsl libsigrok4dsl
@ -32,11 +32,6 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
postFixup = ''
wrapProgram $out/bin/DSView --suffix QT_PLUGIN_PATH : \
${qtbase.bin}/${qtbase.qtPluginPrefix}
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A GUI program for supporting various instruments from DreamSourceLab, including logic analyzer, oscilloscope, etc"; description = "A GUI program for supporting various instruments from DreamSourceLab, including logic analyzer, oscilloscope, etc";
homepage = https://www.dreamsourcelab.com/; homepage = https://www.dreamsourcelab.com/;

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, lib, qtbase, qtmultimedia, qtscript, qtsensors, qtwebkit, openssl, xkeyboard_config, makeWrapper }: { stdenv, fetchurl, lib, qtbase, qtmultimedia, qtscript, qtsensors, qtwebkit, openssl, xkeyboard_config, wrapQtAppsHook }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "p4v-${version}"; name = "p4v-${version}";
@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
}; };
dontBuild = true; dontBuild = true;
nativeBuildInputs = [makeWrapper]; nativeBuildInputs = [ wrapQtAppsHook ];
ldLibraryPath = lib.makeLibraryPath [ ldLibraryPath = lib.makeLibraryPath [
stdenv.cc.cc.lib stdenv.cc.cc.lib
@ -22,6 +22,7 @@ stdenv.mkDerivation rec {
openssl openssl
]; ];
dontWrapQtApps = true;
installPhase = '' installPhase = ''
mkdir $out mkdir $out
cp -r bin $out cp -r bin $out
@ -31,10 +32,9 @@ stdenv.mkDerivation rec {
for f in $out/bin/*.bin ; do for f in $out/bin/*.bin ; do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f
wrapProgram $f \ wrapQtApp $f \
--suffix LD_LIBRARY_PATH : ${ldLibraryPath} \ --suffix LD_LIBRARY_PATH : ${ldLibraryPath} \
--suffix QT_XKB_CONFIG_ROOT : ${xkeyboard_config}/share/X11/xkb \ --suffix QT_XKB_CONFIG_ROOT : ${xkeyboard_config}/share/X11/xkb
--suffix QT_PLUGIN_PATH : ${qtbase.bin}/${qtbase.qtPluginPrefix}
done done
''; '';

View File

@ -1,7 +1,7 @@
{ stdenv, lib, fetchurl, cmake, pkgconfig { stdenv, lib, fetchurl, cmake, pkgconfig
, zlib, gettext, libvdpau, libva, libXv, sqlite , zlib, gettext, libvdpau, libva, libXv, sqlite
, yasm, freetype, fontconfig, fribidi , yasm, freetype, fontconfig, fribidi
, makeWrapper, libXext, libGLU, qttools, qtbase , makeWrapper, libXext, libGLU, qttools, qtbase, wrapQtAppsHook
, alsaLib , alsaLib
, withX265 ? true, x265 , withX265 ? true, x265
, withX264 ? true, x264 , withX264 ? true, x264
@ -37,7 +37,9 @@ stdenv.mkDerivation rec {
./bootstrap_logging.patch ./bootstrap_logging.patch
]; ];
nativeBuildInputs = [ yasm cmake pkgconfig ]; nativeBuildInputs =
[ yasm cmake pkgconfig ]
++ lib.optional withQT wrapQtAppsHook;
buildInputs = [ buildInputs = [
zlib gettext libvdpau libva libXv sqlite fribidi fontconfig zlib gettext libvdpau libva libXv sqlite fribidi fontconfig
freetype alsaLib libXext libGLU makeWrapper freetype alsaLib libXext libGLU makeWrapper
@ -55,7 +57,10 @@ stdenv.mkDerivation rec {
buildCommand = let buildCommand = let
qtVersion = "5.${stdenv.lib.versions.minor qtbase.version}"; qtVersion = "5.${stdenv.lib.versions.minor qtbase.version}";
wrapProgram = f: "wrapProgram ${f} --set ADM_ROOT_DIR $out --prefix LD_LIBRARY_PATH : ${libXext}/lib"; wrapWith = makeWrapper: filename:
"${makeWrapper} ${filename} --set ADM_ROOT_DIR $out --prefix LD_LIBRARY_PATH : ${libXext}/lib";
wrapQtApp = wrapWith "wrapQtApp";
wrapProgram = wrapWith "wrapProgram";
in '' in ''
unpackPhase unpackPhase
cd "$sourceRoot" cd "$sourceRoot"
@ -74,8 +79,8 @@ stdenv.mkDerivation rec {
${wrapProgram "$out/bin/avidemux3_cli"} ${wrapProgram "$out/bin/avidemux3_cli"}
${stdenv.lib.optionalString withQT '' ${stdenv.lib.optionalString withQT ''
${wrapProgram "$out/bin/avidemux3_qt5"} --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins ${wrapQtApp "$out/bin/avidemux3_qt5"}
${wrapProgram "$out/bin/avidemux3_jobs_qt5"} --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins ${wrapQtApp "$out/bin/avidemux3_jobs_qt5"}
''} ''}
ln -s "$out/bin/avidemux3_${default}" "$out/bin/avidemux" ln -s "$out/bin/avidemux3_${default}" "$out/bin/avidemux"

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, makeWrapper, phonon, phonon-backend-vlc, qtbase, qmake { stdenv, fetchFromGitHub, wrapQtAppsHook, phonon, phonon-backend-vlc, qtbase, qmake
, qtdeclarative, qttools , qtdeclarative, qttools
# "Free" key generated by nckx <github@tobias.gr>. I no longer have a Google # "Free" key generated by nckx <github@tobias.gr>. I no longer have a Google
@ -17,17 +17,12 @@ stdenv.mkDerivation rec {
}; };
buildInputs = [ phonon phonon-backend-vlc qtbase qtdeclarative qttools ]; buildInputs = [ phonon phonon-backend-vlc qtbase qtdeclarative qttools ];
nativeBuildInputs = [ makeWrapper qmake ]; nativeBuildInputs = [ wrapQtAppsHook qmake ];
qmakeFlags = [ "DEFINES+=APP_GOOGLE_API_KEY=${withAPIKey}" ]; qmakeFlags = [ "DEFINES+=APP_GOOGLE_API_KEY=${withAPIKey}" ];
enableParallelBuilding = true; enableParallelBuilding = true;
postInstall = ''
wrapProgram $out/bin/minitube \
--prefix QT_PLUGIN_PATH : "${phonon-backend-vlc}/lib/qt-5.${stdenv.lib.versions.minor qtbase.version}/plugins"
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Stand-alone YouTube video player"; description = "Stand-alone YouTube video player";
longDescription = '' longDescription = ''

View File

@ -34,7 +34,8 @@ mkDerivation {
qtgraphicaleffects qtquickcontrols qtquickcontrols2 qtscript qtwayland qtx11extras qtgraphicaleffects qtquickcontrols qtquickcontrols2 qtscript qtwayland qtx11extras
]; ];
outputs = [ "bin" "dev" "out" ]; propagatedUserEnvPkgs = [ qtgraphicaleffects ];
outputs = [ "out" "dev" ];
cmakeFlags = [ cmakeFlags = [
"-DNIXPKGS_XMESSAGE=${getBin xmessage}/bin/xmessage" "-DNIXPKGS_XMESSAGE=${getBin xmessage}/bin/xmessage"
@ -45,7 +46,7 @@ mkDerivation {
"-DNIXPKGS_XPROP=${getBin xprop}/bin/xprop" "-DNIXPKGS_XPROP=${getBin xprop}/bin/xprop"
"-DNIXPKGS_ID=${getBin coreutils}/bin/id" "-DNIXPKGS_ID=${getBin coreutils}/bin/id"
"-DNIXPKGS_DBUS_UPDATE_ACTIVATION_ENVIRONMENT=${getBin dbus}/bin/dbus-update-activation-environment" "-DNIXPKGS_DBUS_UPDATE_ACTIVATION_ENVIRONMENT=${getBin dbus}/bin/dbus-update-activation-environment"
"-DNIXPKGS_START_KDEINIT_WRAPPER=${getLib kinit}/lib/libexec/kf5/start_kdeinit_wrapper" "-DNIXPKGS_START_KDEINIT_WRAPPER=${getLib kinit}/libexec/kf5/start_kdeinit_wrapper"
"-DNIXPKGS_QDBUS=${getBin qttools}/bin/qdbus" "-DNIXPKGS_QDBUS=${getBin qttools}/bin/qdbus"
"-DNIXPKGS_KWRAPPER5=${getBin kinit}/bin/kwrapper5" "-DNIXPKGS_KWRAPPER5=${getBin kinit}/bin/kwrapper5"
"-DNIXPKGS_KREADCONFIG5=${getBin kconfig}/bin/kreadconfig5" "-DNIXPKGS_KREADCONFIG5=${getBin kconfig}/bin/kreadconfig5"
@ -72,10 +73,6 @@ mkDerivation {
preConfigure = '' preConfigure = ''
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_KDOSTARTUPCONFIG5=\"''${!outputBin}/bin/kdostartupconfig5\"" NIX_CFLAGS_COMPILE+=" -DNIXPKGS_KDOSTARTUPCONFIG5=\"''${!outputBin}/bin/kdostartupconfig5\""
cmakeFlags+=" -DNIXPKGS_STARTPLASMA=''${!outputBin}/lib/libexec/startplasma" cmakeFlags+=" -DNIXPKGS_STARTPLASMA=''${!outputBin}/libexec/startplasma"
'';
postInstall = ''
moveToOutput lib/libexec/startplasma ''${!outputBin}
''; '';
} }

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake, makeWrapper { stdenv, fetchFromGitHub, cmake
, boost, python3, eigen , boost, python3, eigen
, icestorm, trellis , icestorm, trellis
@ -6,7 +6,7 @@
# laptop (and over a remote X server on my server...), so mark it broken for # laptop (and over a remote X server on my server...), so mark it broken for
# now, with intent to fix later. # now, with intent to fix later.
, enableGui ? false , enableGui ? false
, qtbase , qtbase, wrapQtAppsHook
}: }:
let let
@ -36,7 +36,9 @@ stdenv.mkDerivation rec {
sha256 = "1y14jpa948cwk0i19bsfqh7yxsxkgskm4xym4z179sjcvcdvrn3a"; sha256 = "1y14jpa948cwk0i19bsfqh7yxsxkgskm4xym4z179sjcvcdvrn3a";
}; };
nativeBuildInputs = [ cmake makeWrapper ]; nativeBuildInputs
= [ cmake ]
++ (stdenv.lib.optional enableGui wrapQtAppsHook);
buildInputs buildInputs
= [ boostPython python3 eigen ] = [ boostPython python3 eigen ]
++ (stdenv.lib.optional enableGui qtbase); ++ (stdenv.lib.optional enableGui qtbase);
@ -56,13 +58,6 @@ stdenv.mkDerivation rec {
--replace 'git log -1 --format=%h' 'echo ${substring 0 11 src.rev}' --replace 'git log -1 --format=%h' 'echo ${substring 0 11 src.rev}'
''; '';
postInstall = stdenv.lib.optionalString enableGui ''
for x in generic ice40 ecp5; do
wrapProgram $out/bin/nextpnr-$x \
--prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}"
done
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Place and route tool for FPGAs"; description = "Place and route tool for FPGAs";
homepage = https://github.com/yosyshq/nextpnr; homepage = https://github.com/yosyshq/nextpnr;

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, cmake, pkgconfig, makeWrapper { stdenv, lib, fetchFromGitHub, cmake, pkgconfig, wrapQtAppsHook
, qtbase, libuuid, libcap, uwsgi, grantlee, pcre , qtbase, libuuid, libcap, uwsgi, grantlee, pcre
}: }:
@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
sha256 = "09cgfpr2k1jp98h1ahxqm5lmv3qbk0bcxpqpill6n5wmq2c8kl8b"; sha256 = "09cgfpr2k1jp98h1ahxqm5lmv3qbk0bcxpqpill6n5wmq2c8kl8b";
}; };
nativeBuildInputs = [ cmake pkgconfig makeWrapper ]; nativeBuildInputs = [ cmake pkgconfig wrapQtAppsHook ];
buildInputs = [ qtbase libuuid libcap uwsgi grantlee pcre ]; buildInputs = [ qtbase libuuid libcap uwsgi grantlee pcre ];
cmakeFlags = [ cmakeFlags = [
@ -31,12 +31,6 @@ stdenv.mkDerivation rec {
unset LD_LIBRARY_PATH unset LD_LIBRARY_PATH
''; '';
postInstall = ''
for prog in $out/bin/*; do
wrapProgram "$prog" --set QT_PLUGIN_PATH '${qtbase}/${qtbase.qtPluginPrefix}'
done
'';
meta = with lib; { meta = with lib; {
description = "C++ Web Framework built on top of Qt"; description = "C++ Web Framework built on top of Qt";
homepage = https://cutelyst.org/; homepage = https://cutelyst.org/;

View File

@ -1,4 +1,7 @@
{ stdenv, fetchbzr, pkgconfig, qmake, qtbase, qtdeclarative, glib, gobject-introspection }: { stdenv, fetchbzr, pkgconfig
, qmake, qtbase, qtdeclarative, wrapQtAppsHook
, glib, gobject-introspection
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "gsettings-qt-${version}"; name = "gsettings-qt-${version}";
@ -14,6 +17,7 @@ stdenv.mkDerivation rec {
pkgconfig pkgconfig
qmake qmake
gobject-introspection gobject-introspection
wrapQtAppsHook
]; ];
buildInputs = [ buildInputs = [

View File

@ -45,17 +45,9 @@ let
if [ "$hookName" != postHook ]; then if [ "$hookName" != postHook ]; then
postHooks+=("source @dev@/nix-support/setup-hook") postHooks+=("source @dev@/nix-support/setup-hook")
else else
# Propagate $${out} output
propagatedUserEnvPkgs="$propagatedUserEnvPkgs @${out}@"
if [ -z "$outputDev" ]; then
echo "error: \$outputDev is unset!" >&2
exit 1
fi
# Propagate $dev so that this setup hook is propagated # Propagate $dev so that this setup hook is propagated
# But only if there is a separate $dev output # But only if there is a separate $dev output
if [ "$outputDev" != out ]; then if [ "''${outputDev:?}" != out ]; then
propagatedBuildInputs="$propagatedBuildInputs @dev@" propagatedBuildInputs="$propagatedBuildInputs @dev@"
fi fi
fi fi
@ -75,10 +67,9 @@ let
inherit (srcs."${name}") src version; inherit (srcs."${name}") src version;
outputs = args.outputs or [ "bin" "dev" "out" ]; outputs = args.outputs or [ "bin" "dev" "out" ];
hasBin = lib.elem "bin" outputs; hasSeparateDev = lib.elem "dev" outputs;
hasDev = lib.elem "dev" outputs;
defaultSetupHook = if hasBin && hasDev then propagateBin else null; defaultSetupHook = if hasSeparateDev then propagateBin else null;
setupHook = args.setupHook or defaultSetupHook; setupHook = args.setupHook or defaultSetupHook;
meta = { meta = {

View File

@ -1,16 +1,16 @@
_ecmEnvHook() { ecmEnvHook() {
addToSearchPath XDG_DATA_DIRS "$1/share" addToSearchPath XDG_DATA_DIRS "$1/share"
addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg" addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg"
} }
addEnvHooks "$targetOffset" _ecmEnvHook addEnvHooks "$targetOffset" ecmEnvHook
_ecmPreConfigureHook() { ecmPostHook() {
# Because we need to use absolute paths here, we must set *all* the paths. # Because we need to use absolute paths here, we must set *all* the paths.
cmakeFlags+=" -DKDE_INSTALL_EXECROOTDIR=${!outputBin}" cmakeFlags+=" -DKDE_INSTALL_EXECROOTDIR=${!outputBin}"
cmakeFlags+=" -DKDE_INSTALL_BINDIR=${!outputBin}/bin" cmakeFlags+=" -DKDE_INSTALL_BINDIR=${!outputBin}/bin"
cmakeFlags+=" -DKDE_INSTALL_SBINDIR=${!outputBin}/sbin" cmakeFlags+=" -DKDE_INSTALL_SBINDIR=${!outputBin}/sbin"
cmakeFlags+=" -DKDE_INSTALL_LIBDIR=${!outputLib}/lib" cmakeFlags+=" -DKDE_INSTALL_LIBDIR=${!outputLib}/lib"
cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputLib}/lib/libexec" cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputLib}/libexec"
cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake" cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake"
cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include" cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include"
cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var" cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var"
@ -51,4 +51,58 @@ _ecmPreConfigureHook() {
cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix" cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix"
fi fi
} }
preConfigureHooks+=(_ecmPreConfigureHook) postHooks+=(ecmPostHook)
xdgDataSubdirs=(
"doc" "config.kcfg" "kconf_update" "kservices5" "kservicetypes5" \
"kxmlgui5" "knotifications5" "icons" "locale" "sounds" "templates" \
"wallpapers" "applications" "desktop-directories" "mime" "appdata" "dbus-1" \
)
ecmHostPathSeen=( )
ecmUnseenHostPath() {
for pkg in "${ecmHostPathSeen[@]}"
do
if [ "${pkg:?}" == "$1" ]
then
return 1
fi
done
ecmHostPathSeen+=("$1")
return 0
}
ecmHostPathHook() {
ecmUnseenHostPath "$1" || return 0
local xdgConfigDir="$1/etc/xdg"
if [ -d "$xdgConfigDir" ]
then
qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir")
fi
for xdgDataSubdir in "${xdgDataSubdirs[@]}"
do
if [ -d "$1/share/$xdgDataSubdir" ]
then
qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$1/share")
break
fi
done
local manDir="$1/man"
if [ -d "$manDir" ]
then
qtWrapperArgs+=(--prefix MANPATH : "$manDir")
fi
local infoDir="$1/info"
if [ -d "$infoDir" ]
then
qtWrapperArgs+=(--prefix INFOPATH : "$infoDir")
fi
}
addEnvHooks "$hostOffset" ecmHostPathHook

View File

@ -9,6 +9,7 @@ let inherit (lib) getLib; in
mkDerivation { mkDerivation {
name = "kinit"; name = "kinit";
meta = { maintainers = [ lib.maintainers.ttuegel ]; }; meta = { maintainers = [ lib.maintainers.ttuegel ]; };
outputs = [ "out" "dev" ];
nativeBuildInputs = [ extra-cmake-modules kdoctools ]; nativeBuildInputs = [ extra-cmake-modules kdoctools ];
buildInputs = [ buildInputs = [
kconfig kcrash ki18n kio kservice kwindowsystem kconfig kcrash ki18n kio kservice kwindowsystem
@ -19,9 +20,6 @@ mkDerivation {
''-DNIXPKGS_KF5_PARTS=\"${getLib kparts}/lib/libKF5Parts.so.5\"'' ''-DNIXPKGS_KF5_PARTS=\"${getLib kparts}/lib/libKF5Parts.so.5\"''
''-DNIXPKGS_KF5_PLASMA=\"${getLib plasma-framework}/lib/libKF5Plasma.so.5\"'' ''-DNIXPKGS_KF5_PLASMA=\"${getLib plasma-framework}/lib/libKF5Plasma.so.5\"''
]; ];
postFixup = ''
moveToOutput "lib/libexec/kf5/start_kdeinit" "$bin"
'';
setupHook = writeScript "setup-hook.sh" '' setupHook = writeScript "setup-hook.sh" ''
kinitFixupOutputHook() { kinitFixupOutputHook() {
if [ $prefix != ''${!outputBin} ] && [ -d $prefix/lib ]; then if [ $prefix != ''${!outputBin} ] && [ -d $prefix/lib ]; then

View File

@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
{ {
newScope, newScope,
stdenv, fetchurl, fetchFromGitHub, makeSetupHook, stdenv, fetchurl, fetchFromGitHub, makeSetupHook, makeWrapper,
bison, cups ? null, harfbuzz, libGL, perl, bison, cups ? null, harfbuzz, libGL, perl,
gstreamer, gst-plugins-base, gtk3, dconf, gstreamer, gst-plugins-base, gtk3, dconf,
llvmPackages_5, llvmPackages_5,
@ -34,6 +34,8 @@ let
qtCompatVersion = "5.11"; qtCompatVersion = "5.11";
stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
mirror = "https://download.qt.io"; mirror = "https://download.qt.io";
srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // { srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
# Community port of the now unmaintained upstream qtwebkit. # Community port of the now unmaintained upstream qtwebkit.
@ -64,16 +66,18 @@ let
qtwebkit = [ ./qtwebkit.patch ]; qtwebkit = [ ./qtwebkit.patch ];
}; };
mkDerivation =
import ../mkDerivation.nix {
inherit (stdenv) lib;
stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
}
{ inherit debug; };
qtModule = qtModule =
import ../qtModule.nix import ../qtModule.nix
{ inherit mkDerivation perl; inherit (stdenv) lib; } {
inherit perl;
inherit (stdenv) lib;
# Use a variant of mkDerivation that does not include wrapQtApplications
# to avoid cyclic dependencies between Qt modules.
mkDerivation =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
stdenvActual.mkDerivation;
}
{ inherit self srcs patches; }; { inherit self srcs patches; };
addPackages = self: with self; addPackages = self: with self;
@ -81,7 +85,11 @@ let
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; }; callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
in { in {
inherit mkDerivation; mkDerivationWith =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
qtbase = callPackage ../modules/qtbase.nix { qtbase = callPackage ../modules/qtbase.nix {
inherit (srcs.qtbase) src version; inherit (srcs.qtbase) src version;
@ -142,6 +150,12 @@ let
fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh; fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
}; };
} ../hooks/qmake-hook.sh; } ../hooks/qmake-hook.sh;
wrapQtAppsHook = makeSetupHook {
deps =
[ self.qtbase.dev makeWrapper ]
++ optional stdenv.isLinux self.qtwayland.dev;
} ../hooks/wrap-qt-apps-hook.sh;
}; };
self = makeScope newScope addPackages; self = makeScope newScope addPackages;

View File

@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
{ {
newScope, newScope,
stdenv, fetchurl, fetchFromGitHub, makeSetupHook, stdenv, fetchurl, fetchFromGitHub, makeSetupHook, makeWrapper,
bison, cups ? null, harfbuzz, libGL, perl, bison, cups ? null, harfbuzz, libGL, perl,
gstreamer, gst-plugins-base, gtk3, dconf, gstreamer, gst-plugins-base, gtk3, dconf,
llvmPackages_5, llvmPackages_5,
@ -34,6 +34,8 @@ let
qtCompatVersion = "5.12"; qtCompatVersion = "5.12";
stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
mirror = "https://download.qt.io"; mirror = "https://download.qt.io";
srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // { srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
# Community port of the now unmaintained upstream qtwebkit. # Community port of the now unmaintained upstream qtwebkit.
@ -69,16 +71,18 @@ let
qttools = [ ./qttools.patch ]; qttools = [ ./qttools.patch ];
}; };
mkDerivation =
import ../mkDerivation.nix {
inherit (stdenv) lib;
stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
}
{ inherit debug; };
qtModule = qtModule =
import ../qtModule.nix import ../qtModule.nix
{ inherit mkDerivation perl; inherit (stdenv) lib; } {
inherit perl;
inherit (stdenv) lib;
# Use a variant of mkDerivation that does not include wrapQtApplications
# to avoid cyclic dependencies between Qt modules.
mkDerivation =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
stdenvActual.mkDerivation;
}
{ inherit self srcs patches; }; { inherit self srcs patches; };
addPackages = self: with self; addPackages = self: with self;
@ -86,7 +90,11 @@ let
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; }; callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
in { in {
inherit mkDerivation; mkDerivationWith =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
qtbase = callPackage ../modules/qtbase.nix { qtbase = callPackage ../modules/qtbase.nix {
inherit (srcs.qtbase) src version; inherit (srcs.qtbase) src version;
@ -147,6 +155,12 @@ let
fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh; fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
}; };
} ../hooks/qmake-hook.sh; } ../hooks/qmake-hook.sh;
wrapQtAppsHook = makeSetupHook {
deps =
[ self.qtbase.dev makeWrapper ]
++ optional stdenv.isLinux self.qtwayland.dev;
} ../hooks/wrap-qt-apps-hook.sh;
}; };
self = makeScope newScope addPackages; self = makeScope newScope addPackages;

View File

@ -26,7 +26,7 @@ existing packages here and modify it as necessary.
{ {
newScope, newScope,
stdenv, fetchurl, fetchpatch, makeSetupHook, stdenv, fetchurl, fetchpatch, makeSetupHook, makeWrapper,
bison, cups ? null, harfbuzz, libGL, perl, bison, cups ? null, harfbuzz, libGL, perl,
gstreamer, gst-plugins-base, gstreamer, gst-plugins-base,
@ -104,14 +104,18 @@ let
]; ];
}; };
mkDerivation =
import ../mkDerivation.nix
{ inherit stdenv; inherit (stdenv) lib; }
{ inherit debug; };
qtModule = qtModule =
import ../qtModule.nix import ../qtModule.nix
{ inherit mkDerivation perl; inherit (stdenv) lib; } {
inherit perl;
inherit (stdenv) lib;
# Use a variant of mkDerivation that does not include wrapQtApplications
# to avoid cyclic dependencies between Qt modules.
mkDerivation =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
stdenv.mkDerivation;
}
{ inherit self srcs patches; }; { inherit self srcs patches; };
addPackages = self: with self; addPackages = self: with self;
@ -119,7 +123,11 @@ let
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; }; callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
in { in {
inherit mkDerivation; mkDerivationWith =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
mkDerivation = mkDerivationWith stdenv.mkDerivation;
qtbase = callPackage ../modules/qtbase.nix { qtbase = callPackage ../modules/qtbase.nix {
inherit bison cups harfbuzz libGL; inherit bison cups harfbuzz libGL;
@ -173,6 +181,12 @@ let
deps = [ self.qtbase.dev ]; deps = [ self.qtbase.dev ];
substitutions = { inherit (stdenv) isDarwin; }; substitutions = { inherit (stdenv) isDarwin; };
} ../hooks/qmake-hook.sh; } ../hooks/qmake-hook.sh;
wrapQtAppsHook = makeSetupHook {
deps =
[ self.qtbase.dev makeWrapper ]
++ optional stdenv.isLinux self.qtwayland.dev;
} ../hooks/wrap-qt-apps-hook.sh;
}; };
self = makeScope newScope addPackages; self = makeScope newScope addPackages;

View File

@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
{ {
newScope, newScope,
stdenv, fetchurl, fetchpatch, makeSetupHook, stdenv, fetchurl, fetchpatch, makeSetupHook, makeWrapper,
bison, cups ? null, harfbuzz, libGL, perl, bison, cups ? null, harfbuzz, libGL, perl,
gstreamer, gst-plugins-base, gtk3, dconf, gstreamer, gst-plugins-base, gtk3, dconf,
@ -67,14 +67,18 @@ let
}; };
mkDerivation =
import ../mkDerivation.nix
{ inherit stdenv; inherit (stdenv) lib; }
{ inherit debug; };
qtModule = qtModule =
import ../qtModule.nix import ../qtModule.nix
{ inherit mkDerivation perl; inherit (stdenv) lib; } {
inherit perl;
inherit (stdenv) lib;
# Use a variant of mkDerivation that does not include wrapQtApplications
# to avoid cyclic dependencies between Qt modules.
mkDerivation =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; wrapQtAppsHook = null; }
stdenv.mkDerivation;
}
{ inherit self srcs patches; }; { inherit self srcs patches; };
addPackages = self: with self; addPackages = self: with self;
@ -82,7 +86,11 @@ let
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; }; callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
in { in {
inherit mkDerivation; mkDerivationWith =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
mkDerivation = mkDerivationWith stdenv.mkDerivation;
qtbase = callPackage ../modules/qtbase.nix { qtbase = callPackage ../modules/qtbase.nix {
inherit (srcs.qtbase) src version; inherit (srcs.qtbase) src version;
@ -140,6 +148,12 @@ let
fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh; fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.sh;
}; };
} ../hooks/qmake-hook.sh; } ../hooks/qmake-hook.sh;
wrapQtAppsHook = makeSetupHook {
deps =
[ self.qtbase.dev makeWrapper ]
++ optional stdenv.isLinux self.qtwayland.dev;
} ../hooks/wrap-qt-apps-hook.sh;
}; };
self = makeScope newScope addPackages; self = makeScope newScope addPackages;

View File

@ -19,12 +19,14 @@ export QMAKEPATH
QMAKEMODULES= QMAKEMODULES=
export QMAKEMODULES export QMAKEMODULES
addToQMAKEPATH() { qmakePathHook() {
if [ -d "$1/mkspecs" ]; then if [ -d "$1/mkspecs" ]
then
QMAKEMODULES="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs" QMAKEMODULES="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs"
QMAKEPATH="${QMAKEPATH}${QMAKEPATH:+:}$1" QMAKEPATH="${QMAKEPATH}${QMAKEPATH:+:}$1"
fi fi
} }
envBuildHostHooks+=(qmakePathHook)
# Propagate any runtime dependency of the building package. # Propagate any runtime dependency of the building package.
# Each dependency is propagated to the user environment and as a build # Each dependency is propagated to the user environment and as a build
@ -32,18 +34,18 @@ addToQMAKEPATH() {
# package depending on the building package. (This is necessary in case # package depending on the building package. (This is necessary in case
# the building package does not provide runtime dependencies itself and so # the building package does not provide runtime dependencies itself and so
# would not be propagated to the user environment.) # would not be propagated to the user environment.)
qtEnvHook() { qtEnvHostTargetHook() {
addToQMAKEPATH "$1" if providesQtRuntime "$1" && [ "z${!outputBin}" != "z${!outputDev}" ]
if providesQtRuntime "$1"; then then
if [ "z${!outputBin}" != "z${!outputDev}" ]; then propagatedBuildInputs+=" $1"
propagatedBuildInputs+=" $1"
fi
propagatedUserEnvPkgs+=" $1"
fi fi
} }
envHostTargetHooks+=(qtEnvHook) envHostTargetHooks+=(qtEnvHostTargetHook)
postPatchMkspecs() { postPatchMkspecs() {
# Prevent this hook from running multiple times
dontPatchMkspecs=1
local bin="${!outputBin}" local bin="${!outputBin}"
local dev="${!outputDev}" local dev="${!outputDev}"
local doc="${!outputDoc}" local doc="${!outputDoc}"

View File

@ -0,0 +1,106 @@
# Inherit arguments given in mkDerivation
qtWrapperArgs=( $qtWrapperArgs )
qtHostPathSeen=()
qtUnseenHostPath() {
for pkg in "${qtHostPathSeen[@]}"
do
if [ "${pkg:?}" == "$1" ]
then
return 1
fi
done
qtHostPathSeen+=("$1")
return 0
}
qtHostPathHook() {
qtUnseenHostPath "$1" || return 0
local pluginDir="$1/${qtPluginPrefix:?}"
if [ -d "$pluginDir" ]
then
qtWrapperArgs+=(--prefix QT_PLUGIN_PATH : "$pluginDir")
fi
local qmlDir="$1/${qtQmlPrefix:?}"
if [ -d "$qmlDir" ]
then
qtWrapperArgs+=(--prefix QML2_IMPORT_PATH : "$qmlDir")
fi
}
addEnvHooks "$hostOffset" qtHostPathHook
makeQtWrapper() {
local original="$1"
local wrapper="$2"
shift 2
makeWrapper "$original" "$wrapper" "${qtWrapperArgs[@]}" "$@"
}
wrapQtApp() {
local program="$1"
shift 1
wrapProgram "$program" "${qtWrapperArgs[@]}" "$@"
}
qtOwnPathsHook() {
local xdgDataDir="${!outputBin}/share"
if [ -d "$xdgDataDir" ]
then
qtWrapperArgs+=(--prefix XDG_DATA_DIRS : "$xdgDataDir")
fi
local xdgConfigDir="${!outputBin}/etc/xdg"
if [ -d "$xdgConfigDir" ]
then
qtWrapperArgs+=(--prefix XDG_CONFIG_DIRS : "$xdgConfigDir")
fi
qtHostPathHook "${!outputBin}"
}
preFixupPhases+=" qtOwnPathsHook"
isQtApp () {
readelf -d "$1" 2>/dev/null | grep -q -F 'libQt5Core'
}
# Note: $qtWrapperArgs still gets defined even if $dontWrapQtApps is set.
wrapQtAppsHook() {
# skip this hook when requested
[ -z "$dontWrapQtApps" ] || return 0
# guard against running multiple times (e.g. due to propagation)
[ -z "$wrapQtAppsHookHasRun" ] || return 0
wrapQtAppsHookHasRun=1
local targetDirs=( "$prefix/bin" )
echo "wrapping Qt applications in ${targetDirs[@]}"
for targetDir in "${targetDirs[@]}"
do
[ -d "$targetDir" ] || continue
find "$targetDir" -executable -print0 | while IFS= read -r -d '' file
do
isQtApp "$file" || continue
if [ -f "$file" ]
then
echo "wrapping $file"
wrapQtApp "$file"
elif [ -h "$file" ]
then
target="$(readlink -e "$file")"
echo "wrapping $file -> $target"
rm "$file"
makeQtWrapper "$target" "$file"
fi
done
done
}
fixupOutputHooks+=(wrapQtAppsHook)

View File

@ -1,8 +1,8 @@
{ stdenv, lib }: { lib, debug, wrapQtAppsHook }:
let inherit (lib) optional; in let inherit (lib) optional; in
{ debug }: mkDerivation:
args: args:
@ -24,7 +24,9 @@ let
enableParallelBuilding = args.enableParallelBuilding or true; enableParallelBuilding = args.enableParallelBuilding or true;
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ wrapQtAppsHook ];
}; };
in in
stdenv.mkDerivation (args // args_) mkDerivation (args // args_)

View File

@ -3,5 +3,5 @@
qtModule { qtModule {
name = "qtspeech"; name = "qtspeech";
qtInputs = [ ]; qtInputs = [ ];
outputs = [ "out" "dev" "bin" ]; outputs = [ "out" "dev" ];
} }

View File

@ -1,4 +1,4 @@
{ lib, runCommand, R, rstudio, makeWrapper, recommendedPackages, packages, qtbase }: { lib, runCommand, R, rstudio, wrapQtAppsHook, recommendedPackages, packages, qtbase }:
let let
qtVersion = with lib.versions; "${major qtbase.version}.${minor qtbase.version}"; qtVersion = with lib.versions; "${major qtbase.version}.${minor qtbase.version}";
@ -7,7 +7,8 @@ runCommand (rstudio.name + "-wrapper") {
preferLocalBuild = true; preferLocalBuild = true;
allowSubstitutes = false; allowSubstitutes = false;
nativeBuildInputs = [makeWrapper]; nativeBuildInputs = [wrapQtAppsHook];
dontWrapQtApps = true;
buildInputs = [R rstudio] ++ recommendedPackages ++ packages; buildInputs = [R rstudio] ++ recommendedPackages ++ packages;
@ -29,6 +30,6 @@ echo -n ".libPaths(c(.libPaths(), \"" >> $out/$fixLibsR
echo -n $R_LIBS_SITE | sed -e 's/:/", "/g' >> $out/$fixLibsR echo -n $R_LIBS_SITE | sed -e 's/:/", "/g' >> $out/$fixLibsR
echo -n "\"))" >> $out/$fixLibsR echo -n "\"))" >> $out/$fixLibsR
echo >> $out/$fixLibsR echo >> $out/$fixLibsR
makeWrapper ${rstudio}/bin/rstudio $out/bin/rstudio --set R_PROFILE_USER $out/$fixLibsR \ makeQtWrapper ${rstudio}/bin/rstudio $out/bin/rstudio \
--prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins --set R_PROFILE_USER $out/$fixLibsR
'' ''

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, pkgs, makeWrapper, lib }: { stdenv, fetchurl, pkgs, lib }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "hopper"; pname = "hopper";
@ -16,22 +16,20 @@ stdenv.mkDerivation rec {
libbsd.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 libbsd.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
]; ];
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
qtWrapperArgs = [ ''--suffix LD_LIBRARY_PATH : ${ldLibraryPath}'' ];
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
mkdir -p $out/lib mkdir -p $out/lib
mkdir -p $out/share mkdir -p $out/share
cp $sourceRoot/opt/hopper-${rev}/bin/Hopper $out/bin/hopper cp $sourceRoot/opt/hopper-${rev}/bin/Hopper $out/bin/hopper
cp -r $sourceRoot/opt/hopper-${rev}/lib $out cp -r $sourceRoot/opt/hopper-${rev}/lib $out
cp -r $sourceRoot/usr/share $out/share cp -r $sourceRoot/usr/share $out/share
patchelf \ patchelf \
--set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \ --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \
$out/bin/hopper $out/bin/hopper
# Details: https://nixos.wiki/wiki/Qt
wrapProgram $out/bin/hopper \
--suffix LD_LIBRARY_PATH : ${ldLibraryPath} \
--suffix QT_PLUGIN_PATH : ${pkgs.qt5.qtbase}/lib/qt-${pkgs.qt5.qtbase.qtCompatVersion}/plugins
''; '';
meta = { meta = {

View File

@ -10,7 +10,7 @@ let
revision = "1"; revision = "1";
# Fetch clang from qt vendor, this contains submodules like this: # Fetch clang from qt vendor, this contains submodules like this:
# clang<-clang-tools-extra<-clazy. # clang<-clang-tools-extra<-clazy.
clang_qt_vendor = llvmPackages_8.clang-unwrapped.overrideAttrs (oldAttrs: rec { clang_qt_vendor = llvmPackages_8.clang-unwrapped.overrideAttrs (oldAttrs: rec {
src = fetchgit { src = fetchgit {
url = "https://code.qt.io/clang/clang.git"; url = "https://code.qt.io/clang/clang.git";
@ -32,15 +32,15 @@ stdenv.mkDerivation rec {
buildInputs = [ qtbase qtscript qtquickcontrols qtdeclarative llvmPackages_8.libclang clang_qt_vendor llvmPackages_8.llvm ]; buildInputs = [ qtbase qtscript qtquickcontrols qtdeclarative llvmPackages_8.libclang clang_qt_vendor llvmPackages_8.llvm ];
nativeBuildInputs = [ qmake makeWrapper ]; nativeBuildInputs = [ qmake ];
# 0001-Fix-clang-libcpp-regexp.patch is for fixing regexp that is used to # 0001-Fix-clang-libcpp-regexp.patch is for fixing regexp that is used to
# find clang libc++ library include paths. By default it's not covering paths # find clang libc++ library include paths. By default it's not covering paths
# like libc++-version, which is default name for libc++ folder in nixos. # like libc++-version, which is default name for libc++ folder in nixos.
patches = [ ./0001-Fix-clang-libcpp-regexp.patch patches = [ ./0001-Fix-clang-libcpp-regexp.patch
# Fix clazy plugin name. This plugin was renamed with clang8 # Fix clazy plugin name. This plugin was renamed with clang8
# release, and patch didn't make it into 4.9.1 release. Should be removed # release, and patch didn't make it into 4.9.1 release. Should be removed
# on qtcreator update, if this problem is fixed. # on qtcreator update, if this problem is fixed.
(fetchpatch { (fetchpatch {
url = "https://code.qt.io/cgit/qt-creator/qt-creator.git/patch/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp?id=53c407bc0c87e0b65b537bf26836ddd8e00ead82"; 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 {
url = "https://code.qt.io/cgit/qt-creator/qt-creator.git/patch/src/plugins/clangtools/clangtidyclazyrunner.cpp?id=53c407bc0c87e0b65b537bf26836ddd8e00ead82"; url = "https://code.qt.io/cgit/qt-creator/qt-creator.git/patch/src/plugins/clangtools/clangtidyclazyrunner.cpp?id=53c407bc0c87e0b65b537bf26836ddd8e00ead82";
sha256 = "1rl0rc2l297lpfhhawvkkmj77zb081hhp0bbi7nnykf3q9ch0clh"; sha256 = "1rl0rc2l297lpfhhawvkkmj77zb081hhp0bbi7nnykf3q9ch0clh";
}) })
]; ];
doCheck = true; doCheck = true;
@ -70,7 +70,7 @@ stdenv.mkDerivation rec {
--replace '$$clean_path($${LLVM_LIBDIR}/clang/$${LLVM_VERSION}/include)' '${clang_qt_vendor}/lib/clang/8.0.0/include' \ --replace '$$clean_path($${LLVM_LIBDIR}/clang/$${LLVM_VERSION}/include)' '${clang_qt_vendor}/lib/clang/8.0.0/include' \
--replace '$$clean_path($${LLVM_BINDIR})' '${clang_qt_vendor}/bin' --replace '$$clean_path($${LLVM_BINDIR})' '${clang_qt_vendor}/bin'
# Fix include path to find clang and clang-c include directories. # Fix include path to find clang and clang-c include directories.
substituteInPlace src/plugins/clangtools/clangtools.pro \ substituteInPlace src/plugins/clangtools/clangtools.pro \
--replace 'INCLUDEPATH += $$LLVM_INCLUDEPATH' 'INCLUDEPATH += $$LLVM_INCLUDEPATH ${clang_qt_vendor}' --replace 'INCLUDEPATH += $$LLVM_INCLUDEPATH' 'INCLUDEPATH += $$LLVM_INCLUDEPATH ${clang_qt_vendor}'

View File

@ -53,10 +53,9 @@ in mkDerivation rec {
NIX_CFLAGS_COMPILE = [ "-L${mysql.connector-c}/lib/mysql" "-I${mysql.connector-c}/include/mysql" ]; NIX_CFLAGS_COMPILE = [ "-L${mysql.connector-c}/lib/mysql" "-I${mysql.connector-c}/include/mysql" ];
postFixup = '' qtWrapperArgs = [
wrapProgram $out/bin/tora \ ''--prefix PATH : ${lib.getBin graphviz}/bin''
--prefix PATH : ${lib.getBin graphviz}/bin ];
'';
meta = with lib; { meta = with lib; {
description = "Tora SQL tool"; description = "Tora SQL tool";

View File

@ -32,9 +32,6 @@ stdenv.mkDerivation rec {
cp -pr release/chessx "$out/bin" cp -pr release/chessx "$out/bin"
cp -pr unix/chessx.desktop "$out/share/applications" cp -pr unix/chessx.desktop "$out/share/applications"
wrapProgram $out/bin/chessx \
--prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-5.${lib.versions.minor qtbase.version}/plugins
runHook postInstall runHook postInstall
''; '';

View File

@ -62,13 +62,12 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
mkdir -p "$out/share/applications/" mkdir -p "$out/share/applications/"
cp "${desktopItem}"/share/applications/* "$out/share/applications/" #*/ cp "${desktopItem}"/share/applications/* "$out/share/applications/" #*/
for f in $out/bin/* #*/
do
wrapProgram $f --set FG_ROOT "${data}/share/FlightGear"
done
''; '';
qtWrapperArgs = [
''--set FG_ROOT "${data}/share/FlightGear"''
];
enableParallelBuilding = true; enableParallelBuilding = true;
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -1,5 +1,5 @@
{ stdenv, lib, fetchurl, coreutils, ncurses, gzip, flex, bison { stdenv, lib, fetchurl, coreutils, ncurses, gzip, flex, bison
, less, makeWrapper , less
, buildPackages , buildPackages
, x11Mode ? false, qtMode ? false, libXaw, libXext, libXpm, bdftopcf, mkfontdir, pkgconfig, qt5 , x11Mode ? false, qtMode ? false, libXaw, libXext, libXpm, bdftopcf, mkfontdir, pkgconfig, qt5
}: }:
@ -37,7 +37,7 @@ in stdenv.mkDerivation rec {
++ lib.optionals x11Mode [ mkfontdir bdftopcf ] ++ lib.optionals x11Mode [ mkfontdir bdftopcf ]
++ lib.optionals qtMode [ ++ lib.optionals qtMode [
pkgconfig mkfontdir qt5.qtbase.dev pkgconfig mkfontdir qt5.qtbase.dev
qt5.qtmultimedia.dev makeWrapper qt5.qtmultimedia.dev qt5.wrapQtAppsHook
bdftopcf bdftopcf
]; ];
@ -97,6 +97,10 @@ in stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
preFixup = ''
wrapQtApp "$out/games/nethack"
'';
postInstall = '' postInstall = ''
mkdir -p $out/games/lib/nethackuserdir mkdir -p $out/games/lib/nethackuserdir
for i in xlogfile logfile perm record save; do for i in xlogfile logfile perm record save; do
@ -137,11 +141,6 @@ in stdenv.mkDerivation rec {
${lib.optionalString (!(x11Mode || qtMode)) "install -Dm 555 util/dlb -t $out/libexec/nethack/"} ${lib.optionalString (!(x11Mode || qtMode)) "install -Dm 555 util/dlb -t $out/libexec/nethack/"}
''; '';
postFixup = lib.optionalString qtMode ''
wrapProgram $out/bin/nethack-qt \
--prefix QT_PLUGIN_PATH : "${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}"
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Rogue-like game"; description = "Rogue-like game";
homepage = http://nethack.org/; homepage = http://nethack.org/;

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, makeDesktopItem, makeWrapper, pkgconfig { stdenv, fetchFromGitHub, makeDesktopItem, wrapQtAppsHook, pkgconfig
, cmake, epoxy, libzip, ffmpeg, imagemagick, SDL2, qtbase, qtmultimedia, libedit , cmake, epoxy, libzip, ffmpeg, imagemagick, SDL2, qtbase, qtmultimedia, libedit
, qttools, minizip }: , qttools, minizip }:
@ -25,7 +25,7 @@ in stdenv.mkDerivation rec {
}; };
enableParallelBuilding = true; enableParallelBuilding = true;
nativeBuildInputs = [ makeWrapper pkgconfig cmake ]; nativeBuildInputs = [ wrapQtAppsHook pkgconfig cmake ];
buildInputs = [ buildInputs = [
libzip epoxy ffmpeg imagemagick SDL2 qtbase qtmultimedia libedit minizip libzip epoxy ffmpeg imagemagick SDL2 qtbase qtmultimedia libedit minizip
@ -34,8 +34,6 @@ in stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
cp -r ${desktopItem}/share/applications $out/share cp -r ${desktopItem}/share/applications $out/share
wrapProgram $out/bin/mgba-qt --suffix QT_PLUGIN_PATH : \
${qtbase.bin}/${qtbase.qtPluginPrefix}
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, qmake, qtbase, qttools, substituteAll, libGLU, makeWrapper }: { stdenv, fetchFromGitHub, qmake, qtbase, qttools, substituteAll, libGLU, wrapQtAppsHook }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "nifskope-${version}"; name = "nifskope-${version}";
@ -20,8 +20,8 @@ stdenv.mkDerivation rec {
}) })
]; ];
buildInputs = [ qtbase qttools libGLU.dev makeWrapper ]; buildInputs = [ qtbase qttools libGLU.dev ];
nativeBuildInputs = [ qmake ]; nativeBuildInputs = [ qmake wrapQtAppsHook ];
preConfigure = '' preConfigure = ''
shopt -s globstar shopt -s globstar
@ -33,9 +33,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
# Inspired by install/linux-install/nifskope.spec.in. # Inspired by install/linux-install/nifskope.spec.in.
installPhase = let installPhase = ''
qtVersion = "5.${stdenv.lib.versions.minor qtbase.version}";
in ''
runHook preInstall runHook preInstall
d=$out/share/nifskope d=$out/share/nifskope
@ -53,8 +51,6 @@ stdenv.mkDerivation rec {
find $out/share -type f -exec chmod -x {} \; find $out/share -type f -exec chmod -x {} \;
wrapProgram $out/bin/NifSkope --prefix QT_PLUGIN_PATH : "${qtbase}/lib/qt-${qtVersion}/plugins"
runHook postInstall runHook postInstall
''; '';

View File

@ -1,7 +1,7 @@
{ mkDerivation, fetchurl, lib { mkDerivation, fetchurl, lib
, extra-cmake-modules, kdoctools, wrapGAppsHook , extra-cmake-modules, kdoctools, wrapGAppsHook, wrapQtAppsHook
, kconfig, kcrash, kinit, kpmcore , kconfig, kcrash, kinit, kpmcore
, eject, libatasmart , utillinux, makeWrapper, qtbase , eject, libatasmart , utillinux, qtbase
}: }:
let let
@ -17,16 +17,12 @@ in mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook makeWrapper ]; nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook wrapQtAppsHook ];
# refer to kpmcore for the use of eject # refer to kpmcore for the use of eject
buildInputs = [ eject libatasmart utillinux ]; buildInputs = [ eject libatasmart utillinux ];
propagatedBuildInputs = [ kconfig kcrash kinit kpmcore ]; propagatedBuildInputs = [ kconfig kcrash kinit kpmcore ];
postInstall = ''
wrapProgram "$out/bin/partitionmanager" --prefix QT_PLUGIN_PATH : "${kpmcore}/lib/qt-5.${lib.versions.minor qtbase.version}/plugins"
'';
meta = with lib; { meta = with lib; {
description = "KDE Partition Manager"; description = "KDE Partition Manager";
license = licenses.gpl2; license = licenses.gpl2;

View File

@ -1,6 +1,6 @@
{ stdenv { stdenv
, fetchurl , fetchurl
, makeWrapper , wrapQtAppsHook
, pcsclite , pcsclite
, pyotherside , pyotherside
, pythonPackages , pythonPackages
@ -16,16 +16,9 @@
, yubikey-personalization , yubikey-personalization
}: }:
let let inherit (stdenv) lib; in
qmlPath = qmlLib: "${qmlLib}/${qtbase.qtQmlPrefix}";
inherit (stdenv) lib; stdenv.mkDerivation rec {
qml2ImportPath = lib.concatMapStringsSep ":" qmlPath [
qtbase.bin qtdeclarative.bin pyotherside qtquickcontrols qtquickcontrols2.bin qtgraphicaleffects
];
in stdenv.mkDerivation rec {
pname = "yubikey-manager-qt"; pname = "yubikey-manager-qt";
version = "1.1.2"; version = "1.1.2";
@ -34,7 +27,7 @@ in stdenv.mkDerivation rec {
sha256 = "01ax8zjrahs2sjbgsys2ahh57sdcap0ij3y1r1bbvsgzr7xxm2q8"; sha256 = "01ax8zjrahs2sjbgsys2ahh57sdcap0ij3y1r1bbvsgzr7xxm2q8";
}; };
nativeBuildInputs = [ makeWrapper python3.pkgs.wrapPython qmake ]; nativeBuildInputs = [ wrapQtAppsHook python3.pkgs.wrapPython qmake ];
postPatch = '' postPatch = ''
substituteInPlace ykman-gui/deployment.pri --replace '/usr/bin' "$out/bin" substituteInPlace ykman-gui/deployment.pri --replace '/usr/bin' "$out/bin"
@ -46,22 +39,20 @@ in stdenv.mkDerivation rec {
pythonPath = [ yubikey-manager ]; pythonPath = [ yubikey-manager ];
dontWrapQtApps = true;
postInstall = '' postInstall = ''
buildPythonPath "$pythonPath" buildPythonPath "$pythonPath"
wrapProgram $out/bin/ykman-gui \ wrapQtApp $out/bin/ykman-gui \
--prefix LD_LIBRARY_PATH : "${stdenv.lib.getLib pcsclite}/lib:${yubikey-personalization}/lib" \ --prefix LD_LIBRARY_PATH : "${stdenv.lib.getLib pcsclite}/lib:${yubikey-personalization}/lib" \
--prefix PYTHONPATH : "$program_PYTHONPATH" \ --prefix PYTHONPATH : "$program_PYTHONPATH"
--set QML2_IMPORT_PATH "${qml2ImportPath}" \
--set QT_QPA_PLATFORM_PLUGIN_PATH ${qtbase.bin}/lib/qt-*/plugins/platforms \
--prefix QT_PLUGIN_PATH : "${qtsvg.bin}/${qtbase.qtPluginPrefix}"
mkdir -p $out/share/applications mkdir -p $out/share/applications
cp resources/ykman-gui.desktop $out/share/applications/ykman-gui.desktop cp resources/ykman-gui.desktop $out/share/applications/ykman-gui.desktop
mkdir -p $out/share/ykman-gui/icons mkdir -p $out/share/ykman-gui/icons
cp resources/icons/*.{icns,ico,png,xpm} $out/share/ykman-gui/icons cp resources/icons/*.{icns,ico,png,xpm} $out/share/ykman-gui/icons
substituteInPlace $out/share/applications/ykman-gui.desktop \ substituteInPlace $out/share/applications/ykman-gui.desktop \
--replace 'Exec=ykman-gui' "Exec=$out/bin/ykman-gui" \ --replace 'Exec=ykman-gui' "Exec=$out/bin/ykman-gui" \
''; '';
meta = with lib; { meta = with lib; {

View File

@ -1,5 +1,5 @@
{ stdenv, makeWrapper, bash-completion, cmake, fetchFromGitHub, hidapi, libusb1, pkgconfig { stdenv, bash-completion, cmake, fetchFromGitHub, hidapi, libusb1, pkgconfig
, qtbase, qttranslations, qtsvg }: , qtbase, qttranslations, qtsvg, wrapQtAppsHook }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "nitrokey-app-${version}"; name = "nitrokey-app-${version}";
@ -29,15 +29,10 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
pkgconfig pkgconfig
makeWrapper wrapQtAppsHook
]; ];
cmakeFlags = "-DCMAKE_BUILD_TYPE=Release"; cmakeFlags = "-DCMAKE_BUILD_TYPE=Release";
postFixup = ''
wrapProgram $out/bin/nitrokey-app \
--prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}"
'';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Provides extra functionality for the Nitrokey Pro and Storage"; description = "Provides extra functionality for the Nitrokey Pro and Storage";
longDescription = '' longDescription = ''

View File

@ -12777,7 +12777,7 @@ in
qt56 = recurseIntoAttrs (makeOverridable qt56 = recurseIntoAttrs (makeOverridable
(import ../development/libraries/qt-5/5.6) { (import ../development/libraries/qt-5/5.6) {
inherit newScope; inherit newScope;
inherit stdenv fetchurl fetchpatch makeSetupHook; inherit stdenv fetchurl fetchpatch makeSetupHook makeWrapper;
bison = bison2; # error: too few arguments to function 'int yylex(... bison = bison2; # error: too few arguments to function 'int yylex(...
inherit cups; inherit cups;
harfbuzz = harfbuzzFull; harfbuzz = harfbuzzFull;
@ -12791,7 +12791,7 @@ in
qt59 = recurseIntoAttrs (makeOverridable qt59 = recurseIntoAttrs (makeOverridable
(import ../development/libraries/qt-5/5.9) { (import ../development/libraries/qt-5/5.9) {
inherit newScope; inherit newScope;
inherit stdenv fetchurl fetchpatch makeSetupHook; inherit stdenv fetchurl fetchpatch makeSetupHook makeWrapper;
bison = bison2; # error: too few arguments to function 'int yylex(... bison = bison2; # error: too few arguments to function 'int yylex(...
inherit cups; inherit cups;
harfbuzz = harfbuzzFull; harfbuzz = harfbuzzFull;
@ -12807,7 +12807,7 @@ in
qt511 = recurseIntoAttrs (makeOverridable qt511 = recurseIntoAttrs (makeOverridable
(import ../development/libraries/qt-5/5.11) { (import ../development/libraries/qt-5/5.11) {
inherit newScope; inherit newScope;
inherit stdenv fetchurl fetchFromGitHub makeSetupHook; inherit stdenv fetchurl fetchFromGitHub makeSetupHook makeWrapper;
bison = bison2; # error: too few arguments to function 'int yylex(... bison = bison2; # error: too few arguments to function 'int yylex(...
inherit cups; inherit cups;
harfbuzz = harfbuzzFull; harfbuzz = harfbuzzFull;
@ -12824,7 +12824,7 @@ in
qt512 = recurseIntoAttrs (makeOverridable qt512 = recurseIntoAttrs (makeOverridable
(import ../development/libraries/qt-5/5.12) { (import ../development/libraries/qt-5/5.12) {
inherit newScope; inherit newScope;
inherit stdenv fetchurl fetchFromGitHub makeSetupHook; inherit stdenv fetchurl fetchFromGitHub makeSetupHook makeWrapper;
bison = bison2; # error: too few arguments to function 'int yylex(... bison = bison2; # error: too few arguments to function 'int yylex(...
inherit cups; inherit cups;
harfbuzz = harfbuzzFull; harfbuzz = harfbuzzFull;