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>
<para>
Qt is a comprehensive desktop and mobile application development toolkit for
C++. Legacy support is available for Qt 3 and Qt 4, but all current
development uses Qt 5. The Qt 5 packages in Nixpkgs are updated frequently to
take advantage of new features, but older versions are typically retained
until their support window ends. The most important consideration in
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.
This section describes the differences between Nix expressions for Qt
libraries and applications and Nix expressions for other C++ software. Some
knowledge of the latter is assumed. There are primarily two problems which
the Qt infrastructure is designed to address: ensuring consistent versioning
of all dependencies and finding dependencies at runtime.
</para>
<section xml:id="ssec-qt-libraries">
<title>Packaging Libraries for Nixpkgs</title>
<example xml:id='qt-default-nix'>
<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>
Whenever possible, libraries that use Qt 5 should be built with each
available version. Packages providing libraries should be added to the
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>
mkDerivation { <co xml:id='qt-default-nix-co-2' />
pname = "myapp";
version = "1.0";
<para>
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
package may be marked broken for certain versions by testing the
<literal>qtbase.version</literal> attribute, which will always give the
current Qt 5 version.
</para>
</section>
buildInputs = [ qtbase ]; <co xml:id='qt-default-nix-co-3' />
}
</programlisting>
</example>
<section xml:id="ssec-qt-applications">
<title>Packaging Applications for Nixpkgs</title>
<calloutlist>
<callout arearefs='qt-default-nix-co-1'>
<para>
Import <literal>mkDerivation</literal> and Qt (such as
<literal>qtbase</literal> modules directly. <emphasis>Do not</emphasis>
import Qt package sets; the Qt versions of dependencies may not be
coherent, causing build and runtime failures.
</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>
Call your application expression using
<literal>libsForQt5.callPackage</literal> instead of
<literal>callPackage</literal>. 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>
<formalpara xml:id='qt-runtime-dependencies'>
<title>Locating runtime dependencies</title>
<para>
Qt applications need to be wrapped to find runtime dependencies. If you
cannot use <literal>mkDerivation</literal> or
<literal>mkDerivationWith</literal> above, include
<literal>wrapQtAppsHook</literal> in <literal>nativeBuildInputs</literal>:
<programlisting>
stdenv.mkDerivation {
# ...
<para>
Qt 5 maintains strict backward compatibility, so it is generally best to
build an application package against the latest version using the
<varname>libsForQt5</varname> library set. In case a package does not build
with the latest Qt version, it is possible to pick a set pinned to a
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
an older Qt version, be sure to file a bug upstream; because Qt is strictly
backwards-compatible, any incompatibility is by definition a bug in the
application.
</para>
nativeBuildInputs = [ wrapQtAppsHook ];
}
</programlisting>
</para>
</formalpara>
<para>
Entries added to <literal>qtWrapperArgs</literal> are used to modify the
wrappers created by <literal>wrapQtAppsHook</literal>. The entries are
passed as arguments to <xref linkend='fun-wrapProgram' />.
<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>

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
, chromaprint, docbook_xml_dtd_45, docbook_xsl, libxslt
, id3lib, taglib, mp4v2, flac, libogg, libvorbis
, zlib, readline , qtbase, qttools, qtmultimedia, qtquickcontrols
, makeWrapper
, wrapQtAppsHook
}:
stdenv.mkDerivation rec {
@ -16,11 +16,12 @@ stdenv.mkDerivation rec {
sha256 = "0xkrsjrbr3z8cn8hjf623l28r3b755gr11i0clv8d8i3s10vhbd8";
};
nativeBuildInputs = [ wrapQtAppsHook ];
buildInputs = with stdenv.lib;
[ pkgconfig cmake python ffmpeg phonon automoc4
chromaprint docbook_xml_dtd_45 docbook_xsl libxslt
id3lib taglib mp4v2 flac libogg libvorbis zlib readline
qtbase qttools qtmultimedia qtquickcontrols makeWrapper ];
qtbase qttools qtmultimedia qtquickcontrols ];
cmakeFlags = [ "-DWITH_APPS=Qt;CLI" ];
NIX_LDFLAGS = "-lm -lpthread";
@ -29,10 +30,6 @@ stdenv.mkDerivation rec {
export DOCBOOKDIR="${docbook_xsl}/xml/xsl/docbook/"
'';
postInstall = ''
wrapProgram $out/bin/kid3-qt --prefix QT_PLUGIN_PATH : $out/lib/qt5/plugins
'';
enableParallelBuilding = true;
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"
];
dontWrapQtApps = true;
postPatch = ''
# FIXME: temporary until https://invent.kde.org/kde/kdevelop/merge_requests/8 is merged
substituteInPlace kdevplatform/language/backgroundparser/parsejob.cpp --replace \
@ -55,8 +57,7 @@ mkDerivation rec {
wrapProgram "$out/bin/kdevelop!" \
--prefix PATH ":" "${lib.makeBinPath [ qttools kde-cli-tools ]}"
wrapProgram "$out/bin/kdevelop" \
--prefix QT_PLUGIN_PATH : $out/lib/qt-${qtVersion}/plugins
wrapQtApp "$out/bin/kdevelop"
# Fix the (now wrapped) kdevelop! to find things in right places:
# - 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
, qtlocation, qtsensors, doxygen, cups, makeWrapper, qtimageformats
, qtlocation, qtsensors, doxygen, cups, wrapQtAppsHook, qtimageformats
}:
stdenv.mkDerivation rec {
@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
buildInputs = [ gdal qtbase qttools qtlocation qtimageformats
qtsensors clipper zlib proj doxygen cups];
nativeBuildInputs = [ cmake makeWrapper ninja ];
nativeBuildInputs = [ cmake wrapQtAppsHook ninja ];
src = fetchFromGitHub {
owner = "OpenOrienteering";
@ -48,9 +48,7 @@ stdenv.mkDerivation rec {
stdenv.lib.optionalString stdenv.isDarwin ''
# Fixes "This application failed to start because it could not find or load the Qt
# platform plugin "cocoa"."
wrapProgram $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}
wrapQtApp $out/Mapper.app/Contents/MacOS/Mapper
mkdir -p $out/bin
ln -s $out/Mapper.app/Contents/MacOS/Mapper $out/bin/mapper
'';

View File

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

View File

@ -1,37 +1,39 @@
{
mkDerivation, lib, makeWrapper,
mkDerivation, lib, config,
extra-cmake-modules, kdoctools,
karchive, kconfig, kcrash, kdbusaddons, ki18n, kiconthemes, kitemmodels,
khtml, kio, kparts, kpty, kservice, kwidgetsaddons, libarchive,
breeze-icons, karchive, kconfig, kcrash, kdbusaddons, ki18n,
kiconthemes, kitemmodels, khtml, kio, kparts, kpty, kservice, kwidgetsaddons,
libarchive, libzip,
# Archive tools
p7zip, unzip, zip,
p7zip, lrzip,
# Unfree tools
unfreeEnableUnrar ? false, unrar,
}:
let
extraTools = [ p7zip lrzip ] ++ lib.optional unfreeEnableUnrar unrar;
in
mkDerivation {
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 = {
license = with lib.licenses;
[ gpl2 lgpl3 ] ++ lib.optional unfreeEnableUnrar unfree;
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,
extra-cmake-modules, kdoctools,
chmlib ? null, discount, djvulibre, ebook_tools, kactivities, karchive, kbookmarks,
kcompletion, kconfig, kconfigwidgets, kcoreaddons, kdbusaddons,
kdegraphics-mobipocket, kiconthemes, kjs, khtml, kio, kparts, kpty, kwallet,
kwindowsystem, libkexiv2, libspectre, libzip, phonon, poppler, qca-qt5,
qtdeclarative, qtsvg, threadweaver, kcrash
breeze-icons, chmlib ? null, discount, djvulibre, ebook_tools, kactivities,
karchive, kbookmarks, kcompletion, kconfig, kconfigwidgets, kcoreaddons,
kdbusaddons, kdegraphics-mobipocket, kiconthemes, kjs, khtml, kio, kparts,
kpty, kwallet, kwindowsystem, libkexiv2, libspectre, libzip, phonon, poppler,
qca-qt5, qtdeclarative, qtsvg, threadweaver, kcrash
}:
mkDerivation {
name = "okular";
nativeBuildInputs = [ extra-cmake-modules kdoctools ];
buildInputs = [
discount djvulibre ebook_tools kactivities karchive kbookmarks
breeze-icons discount djvulibre ebook_tools kactivities karchive kbookmarks
kcompletion kconfig kconfigwidgets kcoreaddons kdbusaddons
kdegraphics-mobipocket kiconthemes kjs khtml kio kparts kpty kwallet
kwindowsystem libkexiv2 libspectre libzip phonon poppler qca-qt5

View File

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

View File

@ -1,4 +1,4 @@
{ lib, fetchurl, python3Packages, qtbase, makeWrapper }:
{ lib, fetchurl, python3Packages, qtbase, wrapQtAppsHook }:
python3Packages.buildPythonApplication rec {
pname = "electron-cash";
@ -32,7 +32,7 @@ python3Packages.buildPythonApplication rec {
btchip
];
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [ wrapQtAppsHook ];
postPatch = ''
substituteInPlace contrib/requirements/requirements.txt \
@ -54,10 +54,6 @@ python3Packages.buildPythonApplication rec {
postInstall = ''
substituteInPlace $out/share/applications/electron-cash.desktop \
--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;

View File

@ -17,6 +17,7 @@
, qtsvg
, qtx11extras
, quazip
, wrapQtAppsHook
, yubikey-personalization
, zlib
@ -73,12 +74,11 @@ stdenv.mkDerivation rec {
doCheck = true;
checkPhase = ''
export LC_ALL="en_US.UTF-8"
export QT_PLUGIN_PATH="${qtbase.bin}/${qtbase.qtPluginPrefix}"
export QT_QPA_PLATFORM=offscreen
make test ARGS+="-E testgui --output-on-failure"
'';
nativeBuildInputs = [ cmake makeWrapper qttools ];
nativeBuildInputs = [ cmake wrapQtAppsHook qttools ];
buildInputs = [
curl
@ -102,10 +102,9 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional withKeePassKeeShareSecure quazip
++ stdenv.lib.optional stdenv.isDarwin qtmacextras;
postInstall = optionalString stdenv.isDarwin ''
preFixup = optionalString stdenv.isDarwin ''
# Make it work without Qt in PATH.
wrapProgram $out/Applications/KeePassXC.app/Contents/MacOS/KeePassXC \
--set QT_PLUGIN_PATH ${qtbase.bin}/${qtbase.qtPluginPrefix}
wrapQtApp $out/Applications/KeePassXC.app/Contents/MacOS/KeePassXC
'';
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
version = "5.4.10";
@ -11,17 +11,12 @@ in stdenv.mkDerivation {
sha256 = "1902ahb2g9xanrip1n0ihr31az8sv9fsvzddnzf70kbwlfclnqf7";
};
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
nativeBuildInputs = [ autoPatchelfHook wrapQtAppsHook ];
buildInputs = [ nss qtbase qtsvg sane-backends stdenv.cc.cc ];
dontStrip = true;
# Please remove this when #44047 is fixed
postInstall = ''
wrapProgram $out/bin/masterpdfeditor5 --prefix QT_PLUGIN_PATH : ${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
'';
installPhase = ''
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
, qtbase, qtconnectivity, qtlocation, qtsvg, qttools, qtwebkit, libXcomposite
}:
@ -79,18 +79,13 @@ in stdenv.mkDerivation rec {
qtbase qtconnectivity qtsvg qttools qtwebkit
];
nativeBuildInputs = [ cmake makeWrapper pkgconfig ];
nativeBuildInputs = [ cmake wrapQtAppsHook pkgconfig ];
cmakeFlags = [
"-DLIBDC_FROM_PKGCONFIG=ON"
"-DNO_PRINTING=OFF"
];
postInstall = ''
wrapProgram $out/bin/subsurface \
--prefix QT_PLUGIN_PATH : "${googlemaps}/${googlemaps.pluginsSubdir}"
'';
enableParallelBuilding = true;
passthru = { inherit version libdc googlemaps; };

View File

@ -1,6 +1,6 @@
{ enableGUI ? true, enablePDFtoPPM ? true, useT1Lib ? false
, 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;
@ -22,7 +22,9 @@ stdenv.mkDerivation {
# https://cmake.org/cmake/help/v3.10/command/cmake_minimum_required.html
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"];
@ -36,11 +38,6 @@ stdenv.mkDerivation {
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; {
homepage = https://www.xpdfreader.com;
description = "Viewer for Portable Document Format (PDF) files";

View File

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

View File

@ -1,7 +1,7 @@
{ stable, version, sha256Hash, archPatchesRevision, archPatchesHash }:
{ mkDerivation, lib, fetchFromGitHub, fetchsvn
, pkgconfig, pythonPackages, cmake, wrapGAppsHook, gcc8
, pkgconfig, pythonPackages, cmake, wrapGAppsHook, wrapQtAppsHook, gcc8
, qtbase, qtimageformats, gtk3, libappindicator-gtk3, libnotify, xdg_utils
, dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3
}:
@ -39,7 +39,7 @@ mkDerivation rec {
--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)
dontWrapGApps = true;
@ -129,12 +129,13 @@ mkDerivation rec {
done
'';
dontWrapQtApps = true;
postFixup = ''
# This is necessary to run Telegram in a pure environment.
# We also use gappsWrapperArgs from wrapGAppsHook.
wrapProgram $out/bin/telegram-desktop \
"''${gappsWrapperArgs[@]}" \
--prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}" \
"''${qtWrapperArgs[@]}" \
--prefix PATH : ${xdg_utils}/bin \
--set XDG_RUNTIME_DIR "XDG-RUNTIME-DIR"
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 {
name = "linssid-${version}";
@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
sha256 = "13d35rlcjncd8lx3khkgn9x8is2xjd5fp6ns5xsn3w6l4xj9b4gl";
};
nativeBuildInputs = [ pkgconfig qmake makeWrapper ];
nativeBuildInputs = [ pkgconfig qmake wrapQtAppsHook ];
buildInputs = [ qtbase qtsvg boost qwt ];
patches = [ ./0001-unbundled-qwt.patch ];
@ -26,11 +26,8 @@ stdenv.mkDerivation rec {
rm -fr qwt-lib
'';
postInstall = ''
wrapProgram $out/bin/linssid \
--prefix QT_PLUGIN_PATH : ${qtbase}/${qtbase.qtPluginPrefix} \
--prefix PATH : ${stdenv.lib.makeBinPath [ wirelesstools iw ]}
'';
qtWrapperArgs =
[ ''--prefix PATH : ${stdenv.lib.makeBinPath [ wirelesstools iw ]}'' ];
meta = with stdenv.lib; {
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
, alsaLib, python
, jackSupport ? false, libjack2 ? null
@ -158,11 +158,6 @@ in {
murmur_git = (server gitSource).overrideAttrs (old: {
meta = old.meta // { broken = iceSupport; };
nativeBuildInputs = old.nativeBuildInputs or [] ++ [ makeWrapper ];
installPhase = old.installPhase or "" + ''
wrapProgram $out/bin/murmurd --suffix QT_PLUGIN_PATH : \
${getBin qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}
'';
nativeBuildInputs = old.nativeBuildInputs or [] ++ [ qt5.wrapQtAppsHook ];
});
}

View File

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

View File

@ -1,5 +1,5 @@
{ 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
}:
@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
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 ];
@ -31,13 +31,13 @@ stdenv.mkDerivation rec {
"-DINOTIFY_INCLUDE_DIR=${inotify-tools}/include"
];
qtWrapperArgs = [
''--prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ libsecret ]}''
];
postInstall = ''
sed -i 's/\(Icon.*\)=nextcloud/\1=Nextcloud/g' \
$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; {

View File

@ -1,5 +1,5 @@
{ stdenv, fetchurl, lib, qtbase, qtmultimedia, qtsvg, qtdeclarative, qttools, full,
libsecret, libGL, libpulseaudio, glib, makeWrapper, makeDesktopItem }:
{ stdenv, fetchurl, lib, qtbase, qtmultimedia, qtsvg, qtdeclarative, qttools, full
, libsecret, libGL, libpulseaudio, glib, wrapQtAppsHook, makeDesktopItem }:
let
version = "1.1.5-1";
@ -28,7 +28,7 @@ in stdenv.mkDerivation rec {
sha256 = "1y5mphrs60zd6km9z64vskk70q9zzw4g6js7qvgl572wv81w2l75";
};
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [ wrapQtAppsHook ];
sourceRoot = ".";
@ -60,18 +60,11 @@ in stdenv.mkDerivation rec {
libpulseaudio
glib
];
qtPath = prefix: "${full}/${prefix}";
in ''
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${rpath}" \
$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; {

View File

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

View File

@ -1,4 +1,5 @@
{ stdenv, lib, fetchurl, doxygen, extra-cmake-modules, graphviz, kdoctools
, wrapQtAppsHook
, akonadi, alkimia, aqbanking, gmp, gwenhywfar, kactivities, karchive
, kcmutils, kcontacts, kdewebkit, kdiagram, kholidays, kidentitymanagement
@ -29,6 +30,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [
doxygen extra-cmake-modules graphviz kdoctools python2Packages.wrapPython
wrapQtAppsHook
];
buildInputs = [
@ -57,13 +59,11 @@ stdenv.mkDerivation rec {
doInstallCheck = stdenv.hostPlatform == stdenv.buildPlatform;
installCheckInputs = [ xvfb_run ];
installCheckPhase = let
pluginPath = "${qtbase.bin}/${qtbase.qtPluginPrefix}";
in lib.optionalString doInstallCheck ''
QT_PLUGIN_PATH=${lib.escapeShellArg pluginPath} \
installCheckPhase =
lib.optionalString doInstallCheck ''
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 = {
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,
podofo, poppler, poppler_data, python2, harfbuzz, qtimageformats, qttools }:
let
pythonEnv = python2.withPackages(ps: [ps.tkinter ps.pillow]);
revision = "22806";
in
in
stdenv.mkDerivation rec {
name = "scribus-unstable-${version}";
version = "2019-01-16";
@ -18,17 +18,13 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
nativeBuildInputs = [ wrapQtAppsHook ];
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
poppler_data pythonEnv harfbuzz qtimageformats qttools
];
postFixup = ''
wrapProgram $out/bin/scribus \
--prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}"
'';
meta = {
maintainers = [ stdenv.lib.maintainers.erictapen ];
platforms = stdenv.lib.platforms.linux;

View File

@ -1,7 +1,7 @@
{ mkDerivation, lib, fetchFromGitHub
, cmake, freetype, libpng, libGLU_combined, openssl, perl, libiconv
, qtscript, qtserialport, qttools
, qtmultimedia, qtlocation, makeWrapper, qtbase
, qtmultimedia, qtlocation, qtbase, wrapQtAppsHook
}:
mkDerivation rec {
@ -15,18 +15,13 @@ mkDerivation rec {
sha256 = "0hf1wv2bb5j7ny2xh29mj9m4hjblhn02zylay8gl85w7xlqs7s5r";
};
nativeBuildInputs = [ cmake perl ];
nativeBuildInputs = [ cmake perl wrapQtAppsHook ];
buildInputs = [
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; {
description = "Free open-source planetarium";
homepage = http://stellarium.org/;

View File

@ -1,6 +1,6 @@
{ stdenv, fetchFromGitHub, pkgconfig, cmake,
libzip, boost, fftw, qtbase,
libusb, makeWrapper, libsigrok4dsl, libsigrokdecode4dsl
libusb, wrapQtAppsHook, libsigrok4dsl, libsigrokdecode4dsl
}:
stdenv.mkDerivation rec {
@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
./install.patch
];
nativeBuildInputs = [ cmake pkgconfig makeWrapper ];
nativeBuildInputs = [ cmake pkgconfig wrapQtAppsHook ];
buildInputs = [
boost fftw qtbase libusb libzip libsigrokdecode4dsl libsigrok4dsl
@ -32,11 +32,6 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
postFixup = ''
wrapProgram $out/bin/DSView --suffix QT_PLUGIN_PATH : \
${qtbase.bin}/${qtbase.qtPluginPrefix}
'';
meta = with stdenv.lib; {
description = "A GUI program for supporting various instruments from DreamSourceLab, including logic analyzer, oscilloscope, etc";
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 {
name = "p4v-${version}";
@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
};
dontBuild = true;
nativeBuildInputs = [makeWrapper];
nativeBuildInputs = [ wrapQtAppsHook ];
ldLibraryPath = lib.makeLibraryPath [
stdenv.cc.cc.lib
@ -22,6 +22,7 @@ stdenv.mkDerivation rec {
openssl
];
dontWrapQtApps = true;
installPhase = ''
mkdir $out
cp -r bin $out
@ -31,10 +32,9 @@ stdenv.mkDerivation rec {
for f in $out/bin/*.bin ; do
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $f
wrapProgram $f \
wrapQtApp $f \
--suffix LD_LIBRARY_PATH : ${ldLibraryPath} \
--suffix QT_XKB_CONFIG_ROOT : ${xkeyboard_config}/share/X11/xkb \
--suffix QT_PLUGIN_PATH : ${qtbase.bin}/${qtbase.qtPluginPrefix}
--suffix QT_XKB_CONFIG_ROOT : ${xkeyboard_config}/share/X11/xkb
done
'';

View File

@ -1,7 +1,7 @@
{ stdenv, lib, fetchurl, cmake, pkgconfig
, zlib, gettext, libvdpau, libva, libXv, sqlite
, yasm, freetype, fontconfig, fribidi
, makeWrapper, libXext, libGLU, qttools, qtbase
, makeWrapper, libXext, libGLU, qttools, qtbase, wrapQtAppsHook
, alsaLib
, withX265 ? true, x265
, withX264 ? true, x264
@ -37,7 +37,9 @@ stdenv.mkDerivation rec {
./bootstrap_logging.patch
];
nativeBuildInputs = [ yasm cmake pkgconfig ];
nativeBuildInputs =
[ yasm cmake pkgconfig ]
++ lib.optional withQT wrapQtAppsHook;
buildInputs = [
zlib gettext libvdpau libva libXv sqlite fribidi fontconfig
freetype alsaLib libXext libGLU makeWrapper
@ -55,7 +57,10 @@ stdenv.mkDerivation rec {
buildCommand = let
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 ''
unpackPhase
cd "$sourceRoot"
@ -74,8 +79,8 @@ stdenv.mkDerivation rec {
${wrapProgram "$out/bin/avidemux3_cli"}
${stdenv.lib.optionalString withQT ''
${wrapProgram "$out/bin/avidemux3_qt5"} --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins
${wrapProgram "$out/bin/avidemux3_jobs_qt5"} --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins
${wrapQtApp "$out/bin/avidemux3_qt5"}
${wrapQtApp "$out/bin/avidemux3_jobs_qt5"}
''}
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
# "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 ];
nativeBuildInputs = [ makeWrapper qmake ];
nativeBuildInputs = [ wrapQtAppsHook qmake ];
qmakeFlags = [ "DEFINES+=APP_GOOGLE_API_KEY=${withAPIKey}" ];
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; {
description = "Stand-alone YouTube video player";
longDescription = ''

View File

@ -34,7 +34,8 @@ mkDerivation {
qtgraphicaleffects qtquickcontrols qtquickcontrols2 qtscript qtwayland qtx11extras
];
outputs = [ "bin" "dev" "out" ];
propagatedUserEnvPkgs = [ qtgraphicaleffects ];
outputs = [ "out" "dev" ];
cmakeFlags = [
"-DNIXPKGS_XMESSAGE=${getBin xmessage}/bin/xmessage"
@ -45,7 +46,7 @@ mkDerivation {
"-DNIXPKGS_XPROP=${getBin xprop}/bin/xprop"
"-DNIXPKGS_ID=${getBin coreutils}/bin/id"
"-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_KWRAPPER5=${getBin kinit}/bin/kwrapper5"
"-DNIXPKGS_KREADCONFIG5=${getBin kconfig}/bin/kreadconfig5"
@ -72,10 +73,6 @@ mkDerivation {
preConfigure = ''
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_KDOSTARTUPCONFIG5=\"''${!outputBin}/bin/kdostartupconfig5\""
cmakeFlags+=" -DNIXPKGS_STARTPLASMA=''${!outputBin}/lib/libexec/startplasma"
'';
postInstall = ''
moveToOutput lib/libexec/startplasma ''${!outputBin}
cmakeFlags+=" -DNIXPKGS_STARTPLASMA=''${!outputBin}/libexec/startplasma"
'';
}

View File

@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake, makeWrapper
{ stdenv, fetchFromGitHub, cmake
, boost, python3, eigen
, icestorm, trellis
@ -6,7 +6,7 @@
# laptop (and over a remote X server on my server...), so mark it broken for
# now, with intent to fix later.
, enableGui ? false
, qtbase
, qtbase, wrapQtAppsHook
}:
let
@ -36,7 +36,9 @@ stdenv.mkDerivation rec {
sha256 = "1y14jpa948cwk0i19bsfqh7yxsxkgskm4xym4z179sjcvcdvrn3a";
};
nativeBuildInputs = [ cmake makeWrapper ];
nativeBuildInputs
= [ cmake ]
++ (stdenv.lib.optional enableGui wrapQtAppsHook);
buildInputs
= [ boostPython python3 eigen ]
++ (stdenv.lib.optional enableGui qtbase);
@ -56,13 +58,6 @@ stdenv.mkDerivation rec {
--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; {
description = "Place and route tool for FPGAs";
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
}:
@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
sha256 = "09cgfpr2k1jp98h1ahxqm5lmv3qbk0bcxpqpill6n5wmq2c8kl8b";
};
nativeBuildInputs = [ cmake pkgconfig makeWrapper ];
nativeBuildInputs = [ cmake pkgconfig wrapQtAppsHook ];
buildInputs = [ qtbase libuuid libcap uwsgi grantlee pcre ];
cmakeFlags = [
@ -31,12 +31,6 @@ stdenv.mkDerivation rec {
unset LD_LIBRARY_PATH
'';
postInstall = ''
for prog in $out/bin/*; do
wrapProgram "$prog" --set QT_PLUGIN_PATH '${qtbase}/${qtbase.qtPluginPrefix}'
done
'';
meta = with lib; {
description = "C++ Web Framework built on top of Qt";
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 {
name = "gsettings-qt-${version}";
@ -14,6 +17,7 @@ stdenv.mkDerivation rec {
pkgconfig
qmake
gobject-introspection
wrapQtAppsHook
];
buildInputs = [

View File

@ -45,17 +45,9 @@ let
if [ "$hookName" != postHook ]; then
postHooks+=("source @dev@/nix-support/setup-hook")
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
# But only if there is a separate $dev output
if [ "$outputDev" != out ]; then
if [ "''${outputDev:?}" != out ]; then
propagatedBuildInputs="$propagatedBuildInputs @dev@"
fi
fi
@ -75,10 +67,9 @@ let
inherit (srcs."${name}") src version;
outputs = args.outputs or [ "bin" "dev" "out" ];
hasBin = lib.elem "bin" outputs;
hasDev = lib.elem "dev" outputs;
hasSeparateDev = lib.elem "dev" outputs;
defaultSetupHook = if hasBin && hasDev then propagateBin else null;
defaultSetupHook = if hasSeparateDev then propagateBin else null;
setupHook = args.setupHook or defaultSetupHook;
meta = {

View File

@ -1,16 +1,16 @@
_ecmEnvHook() {
ecmEnvHook() {
addToSearchPath XDG_DATA_DIRS "$1/share"
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.
cmakeFlags+=" -DKDE_INSTALL_EXECROOTDIR=${!outputBin}"
cmakeFlags+=" -DKDE_INSTALL_BINDIR=${!outputBin}/bin"
cmakeFlags+=" -DKDE_INSTALL_SBINDIR=${!outputBin}/sbin"
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_INCLUDEDIR=${!outputInclude}/include"
cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var"
@ -51,4 +51,58 @@ _ecmPreConfigureHook() {
cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix"
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 {
name = "kinit";
meta = { maintainers = [ lib.maintainers.ttuegel ]; };
outputs = [ "out" "dev" ];
nativeBuildInputs = [ extra-cmake-modules kdoctools ];
buildInputs = [
kconfig kcrash ki18n kio kservice kwindowsystem
@ -19,9 +20,6 @@ mkDerivation {
''-DNIXPKGS_KF5_PARTS=\"${getLib kparts}/lib/libKF5Parts.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" ''
kinitFixupOutputHook() {
if [ $prefix != ''${!outputBin} ] && [ -d $prefix/lib ]; then

View File

@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
{
newScope,
stdenv, fetchurl, fetchFromGitHub, makeSetupHook,
stdenv, fetchurl, fetchFromGitHub, makeSetupHook, makeWrapper,
bison, cups ? null, harfbuzz, libGL, perl,
gstreamer, gst-plugins-base, gtk3, dconf,
llvmPackages_5,
@ -34,6 +34,8 @@ let
qtCompatVersion = "5.11";
stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
mirror = "https://download.qt.io";
srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
# Community port of the now unmaintained upstream qtwebkit.
@ -64,16 +66,18 @@ let
qtwebkit = [ ./qtwebkit.patch ];
};
mkDerivation =
import ../mkDerivation.nix {
inherit (stdenv) lib;
stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
}
{ inherit debug; };
qtModule =
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; };
addPackages = self: with self;
@ -81,7 +85,11 @@ let
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
in {
inherit mkDerivation;
mkDerivationWith =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
qtbase = callPackage ../modules/qtbase.nix {
inherit (srcs.qtbase) src version;
@ -142,6 +150,12 @@ let
fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.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;

View File

@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
{
newScope,
stdenv, fetchurl, fetchFromGitHub, makeSetupHook,
stdenv, fetchurl, fetchFromGitHub, makeSetupHook, makeWrapper,
bison, cups ? null, harfbuzz, libGL, perl,
gstreamer, gst-plugins-base, gtk3, dconf,
llvmPackages_5,
@ -34,6 +34,8 @@ let
qtCompatVersion = "5.12";
stdenvActual = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
mirror = "https://download.qt.io";
srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; } // {
# Community port of the now unmaintained upstream qtwebkit.
@ -69,16 +71,18 @@ let
qttools = [ ./qttools.patch ];
};
mkDerivation =
import ../mkDerivation.nix {
inherit (stdenv) lib;
stdenv = if stdenv.cc.isClang then llvmPackages_5.stdenv else stdenv;
}
{ inherit debug; };
qtModule =
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; };
addPackages = self: with self;
@ -86,7 +90,11 @@ let
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
in {
inherit mkDerivation;
mkDerivationWith =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
mkDerivation = mkDerivationWith stdenvActual.mkDerivation;
qtbase = callPackage ../modules/qtbase.nix {
inherit (srcs.qtbase) src version;
@ -147,6 +155,12 @@ let
fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.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;

View File

@ -26,7 +26,7 @@ existing packages here and modify it as necessary.
{
newScope,
stdenv, fetchurl, fetchpatch, makeSetupHook,
stdenv, fetchurl, fetchpatch, makeSetupHook, makeWrapper,
bison, cups ? null, harfbuzz, libGL, perl,
gstreamer, gst-plugins-base,
@ -104,14 +104,18 @@ let
];
};
mkDerivation =
import ../mkDerivation.nix
{ inherit stdenv; inherit (stdenv) lib; }
{ inherit debug; };
qtModule =
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; };
addPackages = self: with self;
@ -119,7 +123,11 @@ let
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
in {
inherit mkDerivation;
mkDerivationWith =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
mkDerivation = mkDerivationWith stdenv.mkDerivation;
qtbase = callPackage ../modules/qtbase.nix {
inherit bison cups harfbuzz libGL;
@ -173,6 +181,12 @@ let
deps = [ self.qtbase.dev ];
substitutions = { inherit (stdenv) isDarwin; };
} ../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;

View File

@ -17,7 +17,7 @@ top-level attribute to `top-level/all-packages.nix`.
{
newScope,
stdenv, fetchurl, fetchpatch, makeSetupHook,
stdenv, fetchurl, fetchpatch, makeSetupHook, makeWrapper,
bison, cups ? null, harfbuzz, libGL, perl,
gstreamer, gst-plugins-base, gtk3, dconf,
@ -67,14 +67,18 @@ let
};
mkDerivation =
import ../mkDerivation.nix
{ inherit stdenv; inherit (stdenv) lib; }
{ inherit debug; };
qtModule =
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; };
addPackages = self: with self;
@ -82,7 +86,11 @@ let
callPackage = self.newScope { inherit qtCompatVersion qtModule srcs; };
in {
inherit mkDerivation;
mkDerivationWith =
import ../mkDerivation.nix
{ inherit (stdenv) lib; inherit debug; inherit (self) wrapQtAppsHook; };
mkDerivation = mkDerivationWith stdenv.mkDerivation;
qtbase = callPackage ../modules/qtbase.nix {
inherit (srcs.qtbase) src version;
@ -140,6 +148,12 @@ let
fix_qt_builtin_paths = ../hooks/fix-qt-builtin-paths.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;

View File

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

View File

@ -3,5 +3,5 @@
qtModule {
name = "qtspeech";
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
qtVersion = with lib.versions; "${major qtbase.version}.${minor qtbase.version}";
@ -7,7 +7,8 @@ runCommand (rstudio.name + "-wrapper") {
preferLocalBuild = true;
allowSubstitutes = false;
nativeBuildInputs = [makeWrapper];
nativeBuildInputs = [wrapQtAppsHook];
dontWrapQtApps = true;
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 "\"))" >> $out/$fixLibsR
echo >> $out/$fixLibsR
makeWrapper ${rstudio}/bin/rstudio $out/bin/rstudio --set R_PROFILE_USER $out/$fixLibsR \
--prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-${qtVersion}/plugins
makeQtWrapper ${rstudio}/bin/rstudio $out/bin/rstudio \
--set R_PROFILE_USER $out/$fixLibsR
''

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, pkgs, makeWrapper, lib }:
{ stdenv, fetchurl, pkgs, lib }:
stdenv.mkDerivation rec {
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
];
nativeBuildInputs = [ makeWrapper ];
nativeBuildInputs = [ pkgs.qt5.wrapQtAppsHook ];
qtWrapperArgs = [ ''--suffix LD_LIBRARY_PATH : ${ldLibraryPath}'' ];
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/lib
mkdir -p $out/share
cp $sourceRoot/opt/hopper-${rev}/bin/Hopper $out/bin/hopper
cp -r $sourceRoot/opt/hopper-${rev}/lib $out
cp -r $sourceRoot/usr/share $out/share
mkdir -p $out/bin
mkdir -p $out/lib
mkdir -p $out/share
cp $sourceRoot/opt/hopper-${rev}/bin/Hopper $out/bin/hopper
cp -r $sourceRoot/opt/hopper-${rev}/lib $out
cp -r $sourceRoot/usr/share $out/share
patchelf \
--set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \
$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
--set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 \
$out/bin/hopper
'';
meta = {

View File

@ -10,7 +10,7 @@ let
revision = "1";
# 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 {
src = fetchgit {
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 ];
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
# 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
# release, and patch didn't make it into 4.9.1 release. Should be removed
# 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
# on qtcreator update, if this problem is fixed.
(fetchpatch {
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";
sha256 = "1rl0rc2l297lpfhhawvkkmj77zb081hhp0bbi7nnykf3q9ch0clh";
})
];
];
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_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 \
--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" ];
postFixup = ''
wrapProgram $out/bin/tora \
--prefix PATH : ${lib.getBin graphviz}/bin
'';
qtWrapperArgs = [
''--prefix PATH : ${lib.getBin graphviz}/bin''
];
meta = with lib; {
description = "Tora SQL tool";

View File

@ -32,9 +32,6 @@ stdenv.mkDerivation rec {
cp -pr release/chessx "$out/bin"
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
'';

View File

@ -62,13 +62,12 @@ stdenv.mkDerivation rec {
postInstall = ''
mkdir -p "$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;
meta = with stdenv.lib; {

View File

@ -1,5 +1,5 @@
{ stdenv, lib, fetchurl, coreutils, ncurses, gzip, flex, bison
, less, makeWrapper
, less
, buildPackages
, 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 qtMode [
pkgconfig mkfontdir qt5.qtbase.dev
qt5.qtmultimedia.dev makeWrapper
qt5.qtmultimedia.dev qt5.wrapQtAppsHook
bdftopcf
];
@ -97,6 +97,10 @@ in stdenv.mkDerivation rec {
enableParallelBuilding = true;
preFixup = ''
wrapQtApp "$out/games/nethack"
'';
postInstall = ''
mkdir -p $out/games/lib/nethackuserdir
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/"}
'';
postFixup = lib.optionalString qtMode ''
wrapProgram $out/bin/nethack-qt \
--prefix QT_PLUGIN_PATH : "${qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}"
'';
meta = with stdenv.lib; {
description = "Rogue-like game";
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
, qttools, minizip }:
@ -25,7 +25,7 @@ in stdenv.mkDerivation rec {
};
enableParallelBuilding = true;
nativeBuildInputs = [ makeWrapper pkgconfig cmake ];
nativeBuildInputs = [ wrapQtAppsHook pkgconfig cmake ];
buildInputs = [
libzip epoxy ffmpeg imagemagick SDL2 qtbase qtmultimedia libedit minizip
@ -34,8 +34,6 @@ in stdenv.mkDerivation rec {
postInstall = ''
cp -r ${desktopItem}/share/applications $out/share
wrapProgram $out/bin/mgba-qt --suffix QT_PLUGIN_PATH : \
${qtbase.bin}/${qtbase.qtPluginPrefix}
'';
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 {
name = "nifskope-${version}";
@ -20,8 +20,8 @@ stdenv.mkDerivation rec {
})
];
buildInputs = [ qtbase qttools libGLU.dev makeWrapper ];
nativeBuildInputs = [ qmake ];
buildInputs = [ qtbase qttools libGLU.dev ];
nativeBuildInputs = [ qmake wrapQtAppsHook ];
preConfigure = ''
shopt -s globstar
@ -33,9 +33,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
# Inspired by install/linux-install/nifskope.spec.in.
installPhase = let
qtVersion = "5.${stdenv.lib.versions.minor qtbase.version}";
in ''
installPhase = ''
runHook preInstall
d=$out/share/nifskope
@ -53,8 +51,6 @@ stdenv.mkDerivation rec {
find $out/share -type f -exec chmod -x {} \;
wrapProgram $out/bin/NifSkope --prefix QT_PLUGIN_PATH : "${qtbase}/lib/qt-${qtVersion}/plugins"
runHook postInstall
'';

View File

@ -1,7 +1,7 @@
{ mkDerivation, fetchurl, lib
, extra-cmake-modules, kdoctools, wrapGAppsHook
, extra-cmake-modules, kdoctools, wrapGAppsHook, wrapQtAppsHook
, kconfig, kcrash, kinit, kpmcore
, eject, libatasmart , utillinux, makeWrapper, qtbase
, eject, libatasmart , utillinux, qtbase
}:
let
@ -17,16 +17,12 @@ in mkDerivation rec {
enableParallelBuilding = true;
nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook makeWrapper ];
nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook wrapQtAppsHook ];
# refer to kpmcore for the use of eject
buildInputs = [ eject libatasmart utillinux ];
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; {
description = "KDE Partition Manager";
license = licenses.gpl2;

View File

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

View File

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

View File

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