nixpkgs/pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch
Thomas Tuegel 3f3d33a078
qt5: use distinct lib/qt-5.x prefix for each minor version
Using a distinct prefix for plugins and QML libraries allows multiple Qt 5 minor
versions to coexist in the same environment.
2017-06-18 08:41:57 -05:00

21 lines
1020 B
Diff

Index: qtdeclarative-opensource-src-5.6.2/src/qml/qml/qqmlimport.cpp
===================================================================
--- qtdeclarative-opensource-src-5.6.2.orig/src/qml/qml/qqmlimport.cpp
+++ qtdeclarative-opensource-src-5.6.2/src/qml/qml/qqmlimport.cpp
@@ -1568,6 +1568,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
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);
+ }
+ }
+
// env import paths
if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");