31 listToQtVar = suffix: lib.makeSearchPathOutput "bin" suffix;
32 qtPluginPaths = listToQtVar qtbase.qtPluginPrefix [ qtbase qtpim qtsvg ];
33 qtQmlPaths = listToQtVar qtbase.qtQmlPrefix [ qtdeclarative qtfeedback qtgraphicaleffects ];
35 stdenv.mkDerivation (finalAttrs: {
36 pname = "lomiri-ui-toolkit";
39 src = fetchFromGitLab {
41 repo = "development/core/lomiri-ui-toolkit";
42 rev = finalAttrs.version;
43 hash = "sha256-r+wUCl+ywFcgFYo7BjBoXiulQptd1Zd3LJchXiMtx4I=";
46 outputs = [ "out" "dev" ];
49 ./2001-Mark-problematic-tests.patch
51 src = ./2002-Nixpkgs-versioned-QML-path.patch.in;
52 name = "2002-Nixpkgs-versioned-QML-path.patch";
53 qtVersion = lib.versions.major qtbase.version;
58 patchShebangs documentation/docs.sh tests/
60 for subproject in po app-launch-profiler lomiri-ui-toolkit-launcher; do
61 substituteInPlace $subproject/$subproject.pro \
62 --replace-fail "\''$\''$[QT_INSTALL_PREFIX]" "$out" \
63 --replace-warn "\''$\''$[QT_INSTALL_LIBS]" "$out/lib"
66 # Install apicheck tool into bin
67 substituteInPlace apicheck/apicheck.pro \
68 --replace-fail "\''$\''$[QT_INSTALL_LIBS]/lomiri-ui-toolkit" "$out/bin"
70 # Causes redefinition error with our own fortify hardening
71 sed -i '/DEFINES += _FORTIFY_SOURCE/d' features/lomiri_common.prf
73 # Reverse dependencies (and their reverse dependencies too) access the function patched here to register their gettext catalogues,
74 # 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
75 # used in a single application (lomiri-system-settings), that's of not much use either.
76 # https://gitlab.com/ubports/development/core/lomiri-ui-toolkit/-/blob/dcb3a523c56a400e5c3c163c2836cafca168767e/src/LomiriToolkit/i18n.cpp#L101-129
78 # 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,
79 # I'm not sure what the best way of injecting that there would be.
80 # https://gitlab.com/ubports/development/core/lomiri-ui-toolkit/-/blob/dcb3a523c56a400e5c3c163c2836cafca168767e/src/LomiriToolkit/i18n_p.h#L34
82 # Using /run/current-system/sw/share/locale instead of /usr/share/locale isn't a great
83 # solution, but at least it should get us working localisations
84 substituteInPlace src/LomiriToolkit/i18n.cpp \
85 --replace-fail "/usr" "/run/current-system/sw"
87 # The code here overrides the regular QML import variables so the just-built modules are found & used in the tests
88 # But we need their QML dependencies too, so put them back in there
89 substituteInPlace export_qml_dir.sh \
90 --replace-fail '_IMPORT_PATH=$BUILD_DIR/qml' '_IMPORT_PATH=$BUILD_DIR/qml:${qtQmlPaths}'
92 # These tests try to load Suru theme icons, but override XDG_DATA_DIRS / use full paths to load them
94 tests/unit/visual/tst_visual.cpp \
95 tests/unit/visual/tst_icon.{11,13}.qml \
96 tests/unit/visual/tst_imageprovider.11.qml \
97 --replace-fail '/usr/share' '${suru-icon-theme}/share'
100 # With strictDeps, QMake only picks up Qt dependencies from nativeBuildInputs
103 nativeBuildInputs = [
122 propagatedBuildInputs = [
128 nativeCheckInputs = [
130 dpkg # `dpkg-architecture -qDEB_HOST_ARCH` response decides how tests are run
136 # docs require Qt5's qdoc, which we don't have before https://github.com/NixOS/nixpkgs/pull/245379
138 # Ubuntu UITK compatibility, for older / not-yet-migrated applications
139 "CONFIG+=ubuntu-uitk-compat"
140 "QMAKE_PKGCONFIG_PREFIX=${placeholder "out"}"
143 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
145 # Explicitly not parallel-safe, large parts are always run in series and at least qquick_image_extension fails with parallelism
146 enableParallelChecking = false;
153 # XDG_RUNTIME_DIR with wrong permissions causes warnings that are interpreted as errors in the test suite
154 export XDG_RUNTIME_DIR=$PWD/runtime-dir
155 mkdir -p $XDG_RUNTIME_DIR
156 chmod -R 700 $XDG_RUNTIME_DIR
158 # Tests need some Qt plugins
159 # Many tests try to load Suru theme icons via XDG_DATA_DIRS
160 export QT_PLUGIN_PATH=${qtPluginPaths}
161 export XDG_DATA_DIRS=${suru-icon-theme}/share
163 tests/xvfb.sh make check ''${enableParallelChecking:+-j''${NIX_BUILD_CORES}}
169 # wrapper script calls qmlplugindump, crashes due to lack of minimal platform plugin
170 # Could not find the Qt platform plugin "minimal" in ""
171 # Available platform plugins are: wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx.
172 export QT_PLUGIN_PATH=${qtPluginPaths}
174 # Qt-generated wrapper script lacks QML paths to dependencies
175 for qmlModule in Components PerformanceMetrics Test; do
176 substituteInPlace src/imports/$qmlModule/wrapper.sh \
177 --replace-fail 'QML2_IMPORT_PATH=' 'QML2_IMPORT_PATH=${qtQmlPaths}:'
182 # Code loads Qt's qt_module.prf, which force-overrides all QMAKE_PKGCONFIG_* variables except PREFIX for QMake-generated pkg-config files
183 for pcFile in Lomiri{Gestures,Metrics,Toolkit}.pc; do
184 substituteInPlace $out/lib/pkgconfig/$pcFile \
185 --replace-fail "${lib.getLib qtbase}/lib" "\''${prefix}/lib" \
186 --replace-fail "${lib.getDev qtbase}/include" "\''${prefix}/include"
189 # These are all dev-related tools, but declaring a bin output also moves around the QML modules
190 moveToOutput "bin" "$dev"
194 for qtBin in $dev/bin/{apicheck,lomiri-ui-toolkit-launcher}; do
200 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
201 updateScript = gitUpdater { };
205 description = "QML components to ease the creation of beautiful applications in QML";
207 This project consists of a set of QML components to ease the creation of beautiful applications in QML for Lomiri.
209 QML alone lacks built-in components for basic widgets like Button, Slider, Scrollbar, etc, meaning a developer has
210 to build them from scratch.
211 This toolkit aims to stop this duplication of work, supplying beautiful components ready-made and with a clear and
214 These components are fully themeable so the look and feel can be easily customized. Resolution independence
215 technology is built in so UIs are scaled to best suit the display.
218 - localisation through gettext
220 homepage = "https://gitlab.com/ubports/development/core/lomiri-ui-toolkit";
221 changelog = "https://gitlab.com/ubports/development/core/lomiri-ui-toolkit/-/blob/${finalAttrs.version}/ChangeLog";
222 license = with licenses; [ gpl3Only cc-by-sa-30 ];
223 maintainers = teams.lomiri.members;
224 platforms = platforms.linux;