From 9e988b6cf1d8977178bf0b18bfb3083d10e19148 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sun, 14 Dec 2025 16:38:18 +0100 Subject: [PATCH] lomiri-qt6.lomiri-ui-toolkit: init at 1.3.5904 --- pkgs/desktops/lomiri/default.nix | 4 +- .../2002-Nixpkgs-versioned-QML-path.patch.in | 25 +-- .../lomiri/qml/lomiri-ui-toolkit/default.nix | 170 ++++++++++++------ 3 files changed, 126 insertions(+), 73 deletions(-) diff --git a/pkgs/desktops/lomiri/default.nix b/pkgs/desktops/lomiri/default.nix index 8b5b2933b22d..eb79ed55135c 100644 --- a/pkgs/desktops/lomiri/default.nix +++ b/pkgs/desktops/lomiri/default.nix @@ -25,6 +25,9 @@ let #### Development tools / libraries cmake-extras = callPackage ./development/cmake-extras { }; deviceinfo = callPackage ./development/deviceinfo { }; + + #### QML / QML-related + lomiri-ui-toolkit = callPackage ./qml/lomiri-ui-toolkit { }; } // lib.optionalAttrs (!useQt6) { #### Core Apps @@ -64,7 +67,6 @@ let lomiri-push-qml = callPackage ./qml/lomiri-push-qml { }; lomiri-settings-components = callPackage ./qml/lomiri-settings-components { }; lomiri-ui-extras = callPackage ./qml/lomiri-ui-extras { }; - lomiri-ui-toolkit = callPackage ./qml/lomiri-ui-toolkit { }; qqc2-suru-style = callPackage ./qml/qqc2-suru-style { }; #### Services diff --git a/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2002-Nixpkgs-versioned-QML-path.patch.in b/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2002-Nixpkgs-versioned-QML-path.patch.in index d2e83baf98ae..065b670f4b46 100644 --- a/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2002-Nixpkgs-versioned-QML-path.patch.in +++ b/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2002-Nixpkgs-versioned-QML-path.patch.in @@ -1,29 +1,20 @@ -From ca4c52a80532732243067eb00ec12b4ef84010a6 Mon Sep 17 00:00:00 2001 -From: OPNA2608 -Date: Tue, 30 Jan 2024 19:46:09 +0100 -Subject: [PATCH] Nixpkgs versioned QML path - ---- - src/LomiriToolkit/uctheme.cpp | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/LomiriToolkit/uctheme.cpp b/src/LomiriToolkit/uctheme.cpp -index a10c89344..4b0653589 100644 ---- a/src/LomiriToolkit/uctheme.cpp -+++ b/src/LomiriToolkit/uctheme.cpp -@@ -180,6 +180,12 @@ QStringList themeSearchPath() +diff '--color=auto' -ruN a/src/LomiriToolkit/uctheme.cpp b/src/LomiriToolkit/uctheme.cpp +--- a/src/LomiriToolkit/uctheme.cpp 2025-12-04 00:43:06.543074583 +0100 ++++ b/src/LomiriToolkit/uctheme.cpp 2025-12-04 00:45:35.424986792 +0100 +@@ -192,6 +192,16 @@ pathList << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); } + // append versioned QML import path from Nixpkgs + const QString nixpkgsQmlImportPath = QString::fromLocal8Bit(getenv("NIXPKGS_QT@qtVersion@_QML_IMPORT_PATH")); + if (!nixpkgsQmlImportPath.isEmpty()) { ++#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + pathList << nixpkgsQmlImportPath.split(':', QString::SkipEmptyParts); ++#else ++ pathList << nixpkgsQmlImportPath.split(':', Qt::SkipEmptyParts); ++#endif + } + // append QML import path(s); we must explicitly support env override here const QString qml2ImportPath = QString::fromLocal8Bit(getenv("QML2_IMPORT_PATH")); if (!qml2ImportPath.isEmpty()) { --- -2.42.0 - diff --git a/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/default.nix b/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/default.nix index e359a9f87689..6593044e6e60 100644 --- a/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/default.nix +++ b/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/default.nix @@ -5,10 +5,14 @@ gitUpdater, replaceVars, testers, + bluez, + cmake, dbus-test-runner, dpkg, gdb, glib, + kdePackages, + libevdev, lttng-ust, mesa, perl, @@ -17,13 +21,15 @@ qmake, qtbase, qtdeclarative, - qtfeedback, - qtgraphicaleffects, - qtpim, - qtquickcontrols2, + qtfeedback ? null, + qtgraphicaleffects ? null, + qtpim ? null, + qtquickcontrols2 ? null, qtsvg, - qtsystems, + qtsystems ? null, qttools, + qt5compat ? null, + spirv-tools, suru-icon-theme, validatePkgConfig, wrapQtAppsHook, @@ -31,17 +37,30 @@ }: let + withQt6 = lib.strings.versionAtLeast qtbase.version "6"; listToQtVar = suffix: lib.makeSearchPathOutput "bin" suffix; - qtPluginPaths = listToQtVar qtbase.qtPluginPrefix [ - qtbase - qtpim - qtsvg - ]; - qtQmlPaths = listToQtVar qtbase.qtQmlPrefix [ - qtdeclarative - qtfeedback - qtgraphicaleffects - ]; + qtPluginPaths = listToQtVar qtbase.qtPluginPrefix ( + [ + qtbase + qtsvg + ] + ++ lib.optionals (!withQt6) [ + # Will prolly want this in the future, but needs porting to Qt6 + qtpim + ] + ); + qtQmlPaths = listToQtVar qtbase.qtQmlPrefix ( + [ + qtdeclarative + ] + ++ lib.optionals (!withQt6) [ + # Deprecated in Qt6 + qtgraphicaleffects + + # Will prolly want this in the future, but needs porting to Qt6 + qtfeedback + ] + ); in stdenv.mkDerivation (finalAttrs: { pname = "lomiri-ui-toolkit"; @@ -57,6 +76,8 @@ stdenv.mkDerivation (finalAttrs: { outputs = [ "out" "dev" + ] + ++ lib.optionals (!withQt6) [ "doc" ]; @@ -71,23 +92,6 @@ stdenv.mkDerivation (finalAttrs: { postPatch = '' patchShebangs documentation/docs.sh tests/ - for subproject in po app-launch-profiler lomiri-ui-toolkit-launcher; do - substituteInPlace $subproject/$subproject.pro \ - --replace-fail "\''$\''$[QT_INSTALL_PREFIX]" "$out" \ - --replace-warn "\''$\''$[QT_INSTALL_LIBS]" "$out/lib" - done - - # Install apicheck tool into bin - substituteInPlace apicheck/apicheck.pro \ - --replace-fail "\''$\''$[QT_INSTALL_LIBS]/lomiri-ui-toolkit" "$out/bin" - - substituteInPlace documentation/documentation.pro \ - --replace-fail '/usr/share/doc' '$$PREFIX/share/doc' \ - --replace-fail '$$[QT_INSTALL_DOCS]' '$$PREFIX/share/doc/lomiri-ui-toolkit' - - # Causes redefinition error with our own fortify hardening - sed -i '/DEFINES += _FORTIFY_SOURCE/d' features/lomiri_common.prf - # Reverse dependencies (and their reverse dependencies too) access the function patched here to register their gettext catalogues, # so hardcoding any prefix here will make only catalogues in that prefix work. APP_DIR envvar will override this, but with domains from multiple derivations being # used in a single application (lomiri-system-settings), that's of not much use either. @@ -113,19 +117,50 @@ stdenv.mkDerivation (finalAttrs: { tests/unit/visual/tst_icon.{11,13}.qml \ tests/unit/visual/tst_imageprovider.11.qml \ --replace-fail '/usr/share' '${suru-icon-theme}/share' + '' + + lib.optionalString (!withQt6) '' + for subproject in po app-launch-profiler lomiri-ui-toolkit-launcher; do + substituteInPlace $subproject/$subproject.pro \ + --replace-fail "\''$\''$[QT_INSTALL_PREFIX]" "$out" \ + --replace-warn "\''$\''$[QT_INSTALL_LIBS]" "$out/lib" + done + + # Install apicheck tool into bin + substituteInPlace apicheck/apicheck.pro \ + --replace-fail "\''$\''$[QT_INSTALL_LIBS]/lomiri-ui-toolkit" "$out/bin" + + substituteInPlace documentation/documentation.pro \ + --replace-fail '/usr/share/doc' '$$PREFIX/share/doc' \ + --replace-fail '$$[QT_INSTALL_DOCS]' '$$PREFIX/share/doc/lomiri-ui-toolkit' + + # Causes redefinition error with our own fortify hardening + sed -i '/DEFINES += _FORTIFY_SOURCE/d' features/lomiri_common.prf + '' + + lib.optionalString withQt6 '' + substituteInPlace CMakeLists.txt \ + --replace-fail "\''${CMAKE_INSTALL_LIBDIR}/qt\''${QT_VERSION_MAJOR}/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}" \ + --replace-fail "\''${CMAKE_INSTALL_LIBDIR}/qt\''${QT_VERSION_MAJOR}/plugins" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtPluginPrefix}" ''; - # With strictDeps, QMake only picks up Qt dependencies from nativeBuildInputs + # With strictDeps + # - QMake only picks up Qt dependencies from nativeBuildInputs + # - Qt6's CMake module seems to struggle with picking up other Qt modules from buildInputs strictDeps = false; nativeBuildInputs = [ perl pkg-config python3 - qmake qttools # qdoc, qhelpgenerator validatePkgConfig wrapQtAppsHook + ] + ++ lib.optionals withQt6 [ + cmake + spirv-tools + ] + ++ lib.optionals (!withQt6) [ + qmake ]; buildInputs = [ @@ -133,15 +168,34 @@ stdenv.mkDerivation (finalAttrs: { lttng-ust qtbase qtdeclarative - qtpim + ] + ++ lib.optionals (!withQt6) [ + # Folded into qtdeclarative in Qt6 qtquickcontrols2 + + # Will prolly want this in the future, but needs porting to Qt6 + qtpim qtsystems + ] + ++ lib.optionals withQt6 [ + bluez + kdePackages.extra-cmake-modules + libevdev ]; propagatedBuildInputs = [ - qtfeedback - qtgraphicaleffects qtsvg + ] + ++ lib.optionals withQt6 [ + # Qt5Compat.GraphicalEffects + qt5compat + ] + ++ lib.optionals (!withQt6) [ + # Deprecated in Qt6 + qtgraphicaleffects + + # Will prolly want this in the future, but needs porting to Qt6 + qtfeedback ]; nativeCheckInputs = [ @@ -152,7 +206,7 @@ stdenv.mkDerivation (finalAttrs: { xvfb-run ]; - qmakeFlags = [ + qmakeFlags = lib.optionals (!withQt6) [ # Ubuntu UITK compatibility, for older / not-yet-migrated applications "CONFIG+=ubuntu-uitk-compat" "QMAKE_PKGCONFIG_PREFIX=${placeholder "out"}" @@ -180,12 +234,14 @@ stdenv.mkDerivation (finalAttrs: { export UITK_BUILD_ROOT=$PWD - tests/xvfb.sh make check ''${enableParallelChecking:+-j''${NIX_BUILD_CORES}} + ${lib.optionalString withQt6 "../"}tests/xvfb.sh make ${ + if withQt6 then "test" else "check" + } ''${enableParallelChecking:+-j''${NIX_BUILD_CORES}} runHook postCheck ''; - preInstall = '' + preInstall = lib.optionalString (!withQt6) '' # wrapper script calls qmlplugindump, crashes due to lack of minimal platform plugin # Could not find the Qt platform plugin "minimal" in "" # Available platform plugins are: wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx. @@ -198,20 +254,24 @@ stdenv.mkDerivation (finalAttrs: { done ''; - postInstall = '' - # Code loads Qt's qt_module.prf, which force-overrides all QMAKE_PKGCONFIG_* variables except PREFIX for QMake-generated pkg-config files - for pcFile in Lomiri{Gestures,Metrics,Toolkit}.pc; do - substituteInPlace $out/lib/pkgconfig/$pcFile \ - --replace-fail "${lib.getLib qtbase}/lib" "\''${prefix}/lib" \ - --replace-fail "${lib.getDev qtbase}/include" "\''${prefix}/include" - done - - # These are all dev-related tools, but declaring a bin output also moves around the QML modules - moveToOutput "bin" "$dev" - ''; + postInstall = + lib.optionalString (!withQt6) '' + # Code loads Qt's qt_module.prf, which force-overrides all QMAKE_PKGCONFIG_* variables except PREFIX for QMake-generated pkg-config files + for pcFile in Lomiri{Gestures,Metrics,Toolkit}${lib.optionalString withQt6 "-Qt6"}.pc; do + substituteInPlace $out/lib/pkgconfig/$pcFile \ + --replace-fail "${lib.getLib qtbase}/lib" "\''${prefix}/lib" \ + --replace-fail "${lib.getDev qtbase}/include" "\''${prefix}/include" + done + '' + + '' + # These are all dev-related tools, but declaring a bin output also moves around the QML modules + moveToOutput "bin" "$dev" + ''; postFixup = '' - for qtBin in $dev/bin/{apicheck,lomiri-ui-toolkit-launcher}; do + for qtBin in ${ + if withQt6 then "$out/libexec/lomiri-ui-toolkit/qt6" else "$dev/bin" + }/apicheck $dev/bin/lomiri-ui-toolkit-launcher${lib.optionalString withQt6 "-qt6"}; do wrapQtApp $qtBin done ''; @@ -246,9 +306,9 @@ stdenv.mkDerivation (finalAttrs: { teams = [ lib.teams.lomiri ]; platforms = lib.platforms.linux; pkgConfigModules = [ - "LomiriGestures" - "LomiriMetrics" - "LomiriToolkit" + "LomiriGestures${lib.optionalString withQt6 "-Qt6"}" + "LomiriMetrics${lib.optionalString withQt6 "-Qt6"}" + "LomiriToolkit${lib.optionalString withQt6 "-Qt6"}" ]; }; })