diff --git a/pkgs/desktops/lomiri/data/suru-icon-theme/default.nix b/pkgs/desktops/lomiri/data/suru-icon-theme/default.nix new file mode 100644 index 000000000000..796dc05d819a --- /dev/null +++ b/pkgs/desktops/lomiri/data/suru-icon-theme/default.nix @@ -0,0 +1,57 @@ +{ stdenvNoCC +, lib +, fetchFromGitLab +, gitUpdater +, gtk3 +, hicolor-icon-theme +, ubuntu-themes +}: + +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "suru-icon-theme"; + version = "20.05.1"; + + src = fetchFromGitLab { + owner = "ubports"; + repo = "development/core/suru-icon-theme"; + rev = finalAttrs.version; + hash = "sha256-jJ6J+SjSABZCgnCF9cIFBpeSXX2LMnV+nPLPpoXQv30="; + }; + + strictDeps = true; + + nativeBuildInputs = [ + gtk3 # gtk-update-icon-cache + hicolor-icon-theme # theme setup hook + ]; + + propagatedBuildInputs = [ + ubuntu-themes + ]; + + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/icons + cp -r suru $out/share/icons/ + + gtk-update-icon-cache $out/share/icons/suru + + runHook postInstall + ''; + + dontDropIconThemeCache = true; + + passthru.updateScript = gitUpdater { }; + + meta = with lib; { + description = "Suru Icon Theme for Lomiri Operating Environment"; + homepage = "https://gitlab.com/ubports/development/core/suru-icon-theme"; + license = licenses.cc-by-sa-30; + maintainers = teams.lomiri.members; + platforms = platforms.all; + }; +}) diff --git a/pkgs/desktops/lomiri/default.nix b/pkgs/desktops/lomiri/default.nix index 45c0043568df..a1f87820df02 100644 --- a/pkgs/desktops/lomiri/default.nix +++ b/pkgs/desktops/lomiri/default.nix @@ -9,6 +9,7 @@ let in { #### Data lomiri-schemas = callPackage ./data/lomiri-schemas { }; + suru-icon-theme = callPackage ./data/suru-icon-theme { }; #### Development tools / libraries cmake-extras = callPackage ./development/cmake-extras { }; @@ -21,6 +22,7 @@ let #### QML / QML-related lomiri-settings-components = callPackage ./qml/lomiri-settings-components { }; + lomiri-ui-toolkit = callPackage ./qml/lomiri-ui-toolkit { }; #### Services biometryd = callPackage ./services/biometryd { }; diff --git a/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2001-Mark-problematic-tests.patch b/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2001-Mark-problematic-tests.patch new file mode 100644 index 000000000000..1eac4fde58b4 --- /dev/null +++ b/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/2001-Mark-problematic-tests.patch @@ -0,0 +1,158 @@ +From 243477a2bd6e315c77ebaf5b2ed4a9c9c4e1e22a Mon Sep 17 00:00:00 2001 +From: OPNA2608 +Date: Sat, 25 Nov 2023 10:49:32 +0100 +Subject: [PATCH] Mark problematic tests + +- ShapeMaterial requires a Qt OpenGL context, doesn't work in our sandbox +- SignalSpy on QML shaders compilers don't see changes +- Scaling value from environment not picked up properly since Qt 5.15.11 + https://gitlab.com/ubports/development/core/lomiri-ui-toolkit/-/issues/34 +- TypeError on some properties with Qt 5.15 + https://gitlab.com/ubports/development/core/lomiri-ui-toolkit/-/issues/9 +--- + tests/checkresults.sh | 89 ++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 83 insertions(+), 6 deletions(-) + +diff --git a/tests/checkresults.sh b/tests/checkresults.sh +index fc498985e..730b9d406 100755 +--- a/tests/checkresults.sh ++++ b/tests/checkresults.sh +@@ -22,6 +22,7 @@ ERRORS_PATTERN=' 1.3.5011 + (fetchpatch { + name = "0003-lomiri-ui-toolkit-tests-Minor-fixes.patch"; + url = "https://gitlab.com/ubports/development/core/lomiri-ui-toolkit/-/commit/a8324d670b813a48ac7d48aa0bc013773047a01d.patch"; + hash = "sha256-W6q3LuQqWmUVSBzORcJsTPoLfbWwytABMDR6JITHrDI="; + }) + + # Fix Qt 5.15.11 compatibility + # Remove when version > 1.3.5011 + (fetchpatch { + name = "0004-lomiri-ui-toolkit-Fix-compilation-with-Qt-5.15.11.patch"; + url = "https://gitlab.com/ubports/development/core/lomiri-ui-toolkit/-/commit/4f999077dc6bc5591bdfede64fd21cb3acdcaac1.patch"; + hash = "sha256-5VCQFOykxgspNBxH94XYuBpdHsH9a3+8FwV6xQE55Xc="; + }) + + ./2001-Mark-problematic-tests.patch + ]; + + postPatch = '' + patchShebangs documentation/docs.sh tests/ + + substituteInPlace tests/tests.pro \ + --replace "\''$\''$PYTHONDIR" "$dev/${python3.sitePackages}" + + for subproject in po app-launch-profiler lomiri-ui-toolkit-launcher; do + substituteInPlace $subproject/$subproject.pro \ + --replace "\''$\''$[QT_INSTALL_PREFIX]" "$out" \ + --replace "\''$\''$[QT_INSTALL_LIBS]" "$out/lib" + done + + # Install apicheck tool into bin + substituteInPlace apicheck/apicheck.pro \ + --replace "\''$\''$[QT_INSTALL_LIBS]/lomiri-ui-toolkit" "$out/bin" + + # 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. + # https://gitlab.com/ubports/development/core/lomiri-ui-toolkit/-/blob/dcb3a523c56a400e5c3c163c2836cafca168767e/src/LomiriToolkit/i18n.cpp#L101-129 + # + # This could be solved with a reference to the prefix of whoever requests the domain, but the call happens via some automatic Qt / QML callback magic, + # I'm not sure what the best way of injecting that there would be. + # https://gitlab.com/ubports/development/core/lomiri-ui-toolkit/-/blob/dcb3a523c56a400e5c3c163c2836cafca168767e/src/LomiriToolkit/i18n_p.h#L34 + # + # Using /run/current-system/sw/share/locale instead of /usr/share/locale isn't a great + # solution, but at least it should get us working localisations + substituteInPlace src/LomiriToolkit/i18n.cpp \ + --replace "/usr" "/run/current-system/sw" + + # The code here overrides the regular QML import variables so the just-built modules are found & used in the tests + # But we need their QML dependencies too, so put them back in there + substituteInPlace export_qml_dir.sh \ + --replace '_IMPORT_PATH=$BUILD_DIR/qml' '_IMPORT_PATH=$BUILD_DIR/qml:${qtQmlPaths}' + + # These tests try to load Suru theme icons, but override XDG_DATA_DIRS / use full paths to load them + substituteInPlace \ + tests/unit/visual/tst_visual.cpp \ + tests/unit/visual/tst_icon.{11,13}.qml \ + tests/unit/visual/tst_imageprovider.11.qml \ + --replace '/usr/share' '${suru-icon-theme}/share' + ''; + + # With strictDeps, QMake only picks up Qt dependencies from nativeBuildInputs + strictDeps = false; + + nativeBuildInputs = [ + perl + pkg-config + python3 + qmake + wrapQtAppsHook + ]; + + buildInputs = [ + glib + lttng-ust + qtbase + qtdeclarative + qtpim + qtquickcontrols2 + qtsystems + ]; + + propagatedBuildInputs = [ + qtfeedback + qtgraphicaleffects + qtsvg + ]; + + nativeCheckInputs = [ + dbus-test-runner + dpkg # `dpkg-architecture -qDEB_HOST_ARCH` response decides how tests are run + gdb + xvfb-run + ]; + + qmakeFlags = [ + # docs require Qt5's qdoc, which we don't have before https://github.com/NixOS/nixpkgs/pull/245379 + "CONFIG+=no_docs" + # Ubuntu UITK compatibility, for older / not-yet-migrated applications + "CONFIG+=ubuntu-uitk-compat" + "QMAKE_PKGCONFIG_PREFIX=${placeholder "out"}" + ]; + + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; + + # Explicitly not parallel-safe, large parts are always run in series and at least qquick_image_extension fails with parallelism + enableParallelChecking = false; + + checkPhase = '' + runHook preCheck + + export HOME=$PWD + + # XDG_RUNTIME_DIR with wrong permissions causes warnings that are interpreted as errors in the test suite + export XDG_RUNTIME_DIR=$PWD/runtime-dir + mkdir -p $XDG_RUNTIME_DIR + chmod -R 700 $XDG_RUNTIME_DIR + + # Tests need some Qt plugins + # Many tests try to load Suru theme icons via XDG_DATA_DIRS + export QT_PLUGIN_PATH=${qtPluginPaths} + export XDG_DATA_DIRS=${suru-icon-theme}/share + + tests/xvfb.sh make check ''${enableParallelChecking:+-j''${NIX_BUILD_CORES}} + + runHook postCheck + ''; + + preInstall = '' + # 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. + export QT_PLUGIN_PATH=${qtPluginPaths} + + # Qt-generated wrapper script lacks QML paths to dependencies + for qmlModule in Components PerformanceMetrics Test; do + substituteInPlace src/imports/$qmlModule/wrapper.sh \ + --replace 'QML2_IMPORT_PATH=' 'QML2_IMPORT_PATH=${qtQmlPaths}:' + 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 "${lib.getLib qtbase}/lib" "\''${prefix}/lib" \ + --replace "${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 + wrapQtApp $qtBin + done + ''; + + passthru = { + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + updateScript = gitUpdater { }; + }; + + meta = with lib; { + description = "QML components to ease the creation of beautiful applications in QML"; + longDescription = '' + This project consists of a set of QML components to ease the creation of beautiful applications in QML for Lomiri. + + QML alone lacks built-in components for basic widgets like Button, Slider, Scrollbar, etc, meaning a developer has + to build them from scratch. + This toolkit aims to stop this duplication of work, supplying beautiful components ready-made and with a clear and + consistent API. + + These components are fully themeable so the look and feel can be easily customized. Resolution independence + technology is built in so UIs are scaled to best suit the display. + + Other features: + - localisation through gettext + ''; + homepage = "https://gitlab.com/ubports/development/core/lomiri-ui-toolkit"; + license = with licenses; [ gpl3Only cc-by-sa-30 ]; + maintainers = teams.lomiri.members; + platforms = platforms.linux; + pkgConfigModules = [ + "LomiriGestures" + "LomiriMetrics" + "LomiriToolkit" + ]; + }; +})