forked from mirrors/nixpkgs
qt58: determine plugin and import paths from PATH
Plugin and QML import paths were previously determined by NIX_PROFILES. Using PATH instead allows Qt applications to work under nix-shell without further modification.
This commit is contained in:
parent
ce28d8947d
commit
dab7700f6c
nixos/modules/services/x11/display-managers
pkgs
applications/display-managers/sddm
development/libraries/qt-5/5.8
|
@ -197,8 +197,10 @@ in
|
|||
logsXsession = true;
|
||||
|
||||
environment = {
|
||||
# Take themes system environment
|
||||
NIX_PROFILES = "/run/current-system/sw";
|
||||
# Load themes from system environment
|
||||
QT_PLUGIN_PATH = "/run/current-system/sw/" + pkgs.qt5.qtbase.qtPluginPrefix;
|
||||
QML2_IMPORT_PATH = "/run/current-system/sw/" + pkgs.qt5.qtbase.qtQmlPrefix;
|
||||
|
||||
XDG_DATA_DIRS = "/run/current-system/sw/share";
|
||||
};
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
Index: sddm-0.14.0/src/daemon/Greeter.cpp
|
||||
===================================================================
|
||||
--- sddm-0.14.0.orig/src/daemon/Greeter.cpp
|
||||
+++ sddm-0.14.0/src/daemon/Greeter.cpp
|
||||
@@ -157,18 +157,7 @@ namespace SDDM {
|
||||
<< args;
|
||||
|
||||
// greeter environment
|
||||
- QProcessEnvironment env;
|
||||
- QProcessEnvironment sysenv = QProcessEnvironment::systemEnvironment();
|
||||
-
|
||||
- insertEnvironmentList({QStringLiteral("LANG"), QStringLiteral("LANGUAGE"),
|
||||
- QStringLiteral("LC_CTYPE"), QStringLiteral("LC_NUMERIC"), QStringLiteral("LC_TIME"), QStringLiteral("LC_COLLATE"),
|
||||
- QStringLiteral("LC_MONETARY"), QStringLiteral("LC_MESSAGES"), QStringLiteral("LC_PAPER"), QStringLiteral("LC_NAME"),
|
||||
- QStringLiteral("LC_ADDRESS"), QStringLiteral("LC_TELEPHONE"), QStringLiteral("LC_MEASUREMENT"), QStringLiteral("LC_IDENTIFICATION"),
|
||||
- QStringLiteral("LD_LIBRARY_PATH"),
|
||||
- QStringLiteral("QML2_IMPORT_PATH"),
|
||||
- QStringLiteral("QT_PLUGIN_PATH"),
|
||||
- QStringLiteral("XDG_DATA_DIRS")
|
||||
- }, sysenv, env);
|
||||
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
||||
|
||||
env.insert(QStringLiteral("PATH"), mainConfig.Users.DefaultPath.get());
|
||||
env.insert(QStringLiteral("DISPLAY"), m_display->name());
|
|
@ -1,2 +1 @@
|
|||
sddm-ignore-config-mtime.patch
|
||||
sddm-nix-profiles.patch
|
||||
sddm-ignore-config-mtime.patch
|
|
@ -132,7 +132,6 @@ stdenv.mkDerivation {
|
|||
-docdir $out/$qtDocPrefix"
|
||||
|
||||
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
|
||||
NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/$qtPluginPrefix/platforms\""
|
||||
'';
|
||||
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ Index: qtbase-opensource-src-5.8.0/src/corelib/kernel/qcoreapplication.cpp
|
|||
QStringList *app_libpaths = new QStringList;
|
||||
coreappdata()->app_libpaths.reset(app_libpaths);
|
||||
|
||||
+ // Add library paths derived from NIX_PROFILES.
|
||||
+ const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
|
||||
+ const QString plugindir = QStringLiteral(NIXPKGS_QT_PLUGIN_PREFIX);
|
||||
+ for (const QString &profile: profiles) {
|
||||
+ if (!profile.isEmpty()) {
|
||||
+ app_libpaths->append(profile + QDir::separator() + plugindir);
|
||||
+ // Add library paths derived from PATH
|
||||
+ const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
|
||||
+ 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));
|
||||
+ }
|
||||
+ }
|
||||
+
|
|
@ -1,43 +0,0 @@
|
|||
Index: qtbase-opensource-src-5.8.0/src/gui/kernel/qplatformintegrationfactory.cpp
|
||||
===================================================================
|
||||
--- qtbase-opensource-src-5.8.0.orig/src/gui/kernel/qplatformintegrationfactory.cpp
|
||||
+++ qtbase-opensource-src-5.8.0/src/gui/kernel/qplatformintegrationfactory.cpp
|
||||
@@ -62,9 +62,10 @@ QPlatformIntegration *QPlatformIntegrati
|
||||
// Try loading the plugin from platformPluginPath first:
|
||||
if (!platformPluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(platformPluginPath);
|
||||
- if (QPlatformIntegration *ret = qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(directLoader(), platform, paramList, argc, argv))
|
||||
- return ret;
|
||||
}
|
||||
+ QCoreApplication::addLibraryPath(QLatin1String(NIXPKGS_QPA_PLATFORM_PLUGIN_PATH));
|
||||
+ if (QPlatformIntegration *ret = qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(directLoader(), platform, paramList, argc, argv))
|
||||
+ return ret;
|
||||
#else
|
||||
Q_UNUSED(platformPluginPath);
|
||||
#endif
|
||||
@@ -84,15 +85,16 @@ QStringList QPlatformIntegrationFactory:
|
||||
#ifndef QT_NO_LIBRARY
|
||||
if (!platformPluginPath.isEmpty()) {
|
||||
QCoreApplication::addLibraryPath(platformPluginPath);
|
||||
- list = directLoader()->keyMap().values();
|
||||
- if (!list.isEmpty()) {
|
||||
- const QString postFix = QLatin1String(" (from ")
|
||||
- + QDir::toNativeSeparators(platformPluginPath)
|
||||
- + QLatin1Char(')');
|
||||
- const QStringList::iterator end = list.end();
|
||||
- for (QStringList::iterator it = list.begin(); it != end; ++it)
|
||||
- (*it).append(postFix);
|
||||
- }
|
||||
+ }
|
||||
+ QCoreApplication::addLibraryPath(QLatin1String(NIXPKGS_QPA_PLATFORM_PLUGIN_PATH));
|
||||
+ list = directLoader()->keyMap().values();
|
||||
+ if (!list.isEmpty()) {
|
||||
+ const QString postFix = QLatin1String(" (from ")
|
||||
+ + QDir::toNativeSeparators(platformPluginPath)
|
||||
+ + QLatin1Char(')');
|
||||
+ const QStringList::iterator end = list.end();
|
||||
+ for (QStringList::iterator it = list.begin(); it != end; ++it)
|
||||
+ (*it).append(postFix);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(platformPluginPath);
|
|
@ -2,9 +2,8 @@ dlopen-resolv.patch
|
|||
tzdir.patch
|
||||
dlopen-libXcursor.patch
|
||||
xdg-config-dirs.patch
|
||||
nix-profiles-library-paths.patch
|
||||
library-paths.patch
|
||||
libressl.patch
|
||||
qpa-platform-plugin-path.patch
|
||||
dlopen-gl.patch
|
||||
compose-search-path.patch
|
||||
cmake-paths.patch
|
||||
|
|
|
@ -6,12 +6,12 @@ Index: qtdeclarative-opensource-src-5.8.0/src/qml/qml/qqmlimport.cpp
|
|||
QString installImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
|
||||
addImportPath(installImportsPath);
|
||||
|
||||
+ // Add library paths derived from NIX_PROFILES.
|
||||
+ const QStringList profiles = QFile::decodeName(qgetenv("NIX_PROFILES")).split(' ');
|
||||
+ const QString qmldir = QStringLiteral(NIXPKGS_QML2_IMPORT_PREFIX);
|
||||
+ for (const QString &profile: profiles) {
|
||||
+ if (!profile.isEmpty()) {
|
||||
+ addImportPath(profile + QDir::separator() + qmldir);
|
||||
+ // Add import paths derived from PATH
|
||||
+ const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
|
||||
+ const QString qmldir = QStringLiteral("../" NIXPKGS_QML2_IMPORT_PREFIX);
|
||||
+ for (const QString &path: paths) {
|
||||
+ if (!path.isEmpty()) {
|
||||
+ addImportPath(QDir::cleanPath(path + QDir::separator() + qmldir));
|
||||
+ }
|
||||
+ }
|
||||
+
|
|
@ -1 +1 @@
|
|||
nix-profiles-import-paths.patch
|
||||
import-paths.patch
|
||||
|
|
Loading…
Reference in a new issue