From c97bff9a73ffc624e4d7d47c6e7ab52b0fb3180a Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Sat, 25 Nov 2023 22:42:45 -0500 Subject: [PATCH] qt6.qtbase: derive plugin load path from PATH --- pkgs/development/libraries/qt-6/default.nix | 1 + .../libraries/qt-6/modules/qtbase.nix | 13 ++++---- ...se-derive-plugin-load-path-from-PATH.patch | 33 +++++++++++++++++++ 3 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 pkgs/development/libraries/qt-6/patches/0012-qtbase-derive-plugin-load-path-from-PATH.patch diff --git a/pkgs/development/libraries/qt-6/default.nix b/pkgs/development/libraries/qt-6/default.nix index d18678b9f5cde..927d0733a2e85 100644 --- a/pkgs/development/libraries/qt-6/default.nix +++ b/pkgs/development/libraries/qt-6/default.nix @@ -59,6 +59,7 @@ let ./patches/0009-qtbase-allow-translations-outside-prefix.patch ./patches/0010-qtbase-find-qmlimportscanner-in-macdeployqt-via-envi.patch ./patches/0011-qtbase-check-in-the-QML-folder-of-this-library-does-.patch + ./patches/0012-qtbase-derive-plugin-load-path-from-PATH.patch ]; }; env = callPackage ./qt-env.nix { }; diff --git a/pkgs/development/libraries/qt-6/modules/qtbase.nix b/pkgs/development/libraries/qt-6/modules/qtbase.nix index c0a20503e64c0..9febb2564179c 100644 --- a/pkgs/development/libraries/qt-6/modules/qtbase.nix +++ b/pkgs/development/libraries/qt-6/modules/qtbase.nix @@ -11,11 +11,9 @@ , lndir , perl , pkg-config -, python3 , which , cmake , ninja -, ccache , xmlstarlet , libproxy , xorg @@ -236,10 +234,13 @@ stdenv.mkDerivation rec { "-DQT_FEATURE_cxx17_filesystem=OFF" ] ++ lib.optional (qttranslations != null) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations"; - NIX_LDFLAGS = toString (lib.optionals stdenv.isDarwin [ - # Undefined symbols for architecture arm64: "___gss_c_nt_hostbased_service_oid_desc" - "-framework GSS" - ]); + env = { + NIX_CFLAGS_COMPILE = "-DNIXPKGS_QT_PLUGIN_PREFIX=\"${qtPluginPrefix}\""; + NIX_LDFLAGS = toString (lib.optionals stdenv.isDarwin [ + # Undefined symbols for architecture arm64: "___gss_c_nt_hostbased_service_oid_desc" + "-framework GSS" + ]); + }; outputs = [ "out" "dev" ]; diff --git a/pkgs/development/libraries/qt-6/patches/0012-qtbase-derive-plugin-load-path-from-PATH.patch b/pkgs/development/libraries/qt-6/patches/0012-qtbase-derive-plugin-load-path-from-PATH.patch new file mode 100644 index 0000000000000..9f69017543261 --- /dev/null +++ b/pkgs/development/libraries/qt-6/patches/0012-qtbase-derive-plugin-load-path-from-PATH.patch @@ -0,0 +1,33 @@ +From 989697dc8cdcefca1abecfec1316fdce7dc3bf10 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Milan=20P=C3=A4ssler?= +Date: Sun, 10 May 2020 12:47:28 +0200 +Subject: [PATCH 12/12] qtbase: derive plugin load path from PATH + +--- + src/corelib/kernel/qcoreapplication.cpp | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp +index cf773a2328e..44f539390fb 100644 +--- a/src/corelib/kernel/qcoreapplication.cpp ++++ b/src/corelib/kernel/qcoreapplication.cpp +@@ -2988,6 +2988,16 @@ QStringList QCoreApplication::libraryPathsLocked() + QStringList *app_libpaths = new QStringList; + coreappdata()->app_libpaths.reset(app_libpaths); + ++ // Add library paths derived from PATH ++ const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(QStringLiteral(":")); ++ const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX); ++ for (const QString &path: paths) { ++ if (!path.isEmpty()) { ++ app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir)); ++ } ++ } ++ ++ + auto setPathsFromEnv = [&](QString libPathEnv) { + if (!libPathEnv.isEmpty()) { + QStringList paths = libPathEnv.split(QDir::listSeparator(), Qt::SkipEmptyParts); +-- +2.42.0 +