From b781682c33d8fcbef1b470f4f0344d7f997f0130 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 20 Jan 2024 17:28:51 +0100 Subject: [PATCH] lomiri.qtmir: init at 0.7.2-unstable-2024-01-08 --- pkgs/desktops/lomiri/default.nix | 1 + .../lomiri/development/qtmir/default.nix | 160 ++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 pkgs/desktops/lomiri/development/qtmir/default.nix diff --git a/pkgs/desktops/lomiri/default.nix b/pkgs/desktops/lomiri/default.nix index f90895cca706..d319d192c6a9 100644 --- a/pkgs/desktops/lomiri/default.nix +++ b/pkgs/desktops/lomiri/default.nix @@ -22,6 +22,7 @@ let libusermetrics = callPackage ./development/libusermetrics { }; lomiri-api = callPackage ./development/lomiri-api { }; lomiri-app-launch = callPackage ./development/lomiri-app-launch { }; + qtmir = callPackage ./development/qtmir { }; trust-store = callPackage ./development/trust-store { }; u1db-qt = callPackage ./development/u1db-qt { }; diff --git a/pkgs/desktops/lomiri/development/qtmir/default.nix b/pkgs/desktops/lomiri/development/qtmir/default.nix new file mode 100644 index 000000000000..ba49507f3d36 --- /dev/null +++ b/pkgs/desktops/lomiri/development/qtmir/default.nix @@ -0,0 +1,160 @@ +{ stdenv +, lib +, fetchFromGitLab +, fetchpatch +, testers +, cmake +, cmake-extras +, pkg-config +, wrapQtAppsHook +, gsettings-qt +, gtest +, libqtdbustest +, libqtdbusmock +, libuuid +, lomiri-api +, lomiri-app-launch +, lomiri-url-dispatcher +, lttng-ust +, mir +, process-cpp +, qtbase +, qtdeclarative +, qtsensors +, valgrind +, protobuf +, glm +, boost +, properties-cpp +, glib +, validatePkgConfig +, wayland +, xwayland +}: + +stdenv.mkDerivation (finalAttrs: { + # Not regular qtmir, experimental support for Mir 2.x + # Currently following https://gitlab.com/ubports/development/core/qtmir/-/tree/personal/mariogrip/desktop-development + pname = "qtmir-mir2"; + version = "0.7.2-unstable-2024-01-08"; + + src = fetchFromGitLab { + owner = "ubports"; + repo = "development/core/qtmir"; + rev = "ae0d87415d5c9ed2c4fd2284ba0807d23d564bb0"; + hash = "sha256-fE8ttCC0FNavs91pASGGG7k7nKVg2lD3JK0WTmCA3gM="; + }; + + outputs = [ + "out" + "dev" + ]; + + patches = [ + # Mir 2.15 compatibility patch + # Remove when https://gitlab.com/ubports/development/core/qtmir/-/merge_requests/70 merged into branch + (fetchpatch { + name = "0001-qtmir-Update-for-Mir-2.15-removals.patch"; + url = "https://gitlab.com/ubports/development/core/qtmir/-/commit/ead5cacd4d69094ab956627f4dd94ecaff1fd69e.patch"; + hash = "sha256-hUUUnYwhNH3gm76J21M8gA5okaRd/Go03ZFJ4qn0JUo="; + }) + + # Remove when https://gitlab.com/ubports/development/core/qtmir/-/merge_requests/72 merged in branch + (fetchpatch { + name = "0002-qtmir-Add-more-better-GNUInstallDirs-variables-usage.patch"; + url = "https://gitlab.com/ubports/development/core/qtmir/-/commit/87e2cd31052ce15e9625c1327807a320ee5d12af.patch"; + hash = "sha256-MTE9tHw+xJhraEO1up7dLg0UIcmfHXgWOeuyYrVu2wc="; + }) + + # Remove when https://gitlab.com/ubports/development/core/qtmir/-/merge_requests/73 merged in branch + (fetchpatch { + name = "0003-qtmir-CMakeLists-Only-require-test-dependencies-when-building-tests.patch"; + url = "https://gitlab.com/ubports/development/core/qtmir/-/commit/b7144e67bcbb4cfbd2283d5d05146fb22b7d8cd4.patch"; + hash = "sha256-Afbj40MopztchDnk6fphTYk86YrQkiK8L1e/oXiL1Mw="; + }) + + # Remove when https://gitlab.com/ubports/development/core/qtmir/-/merge_requests/74 merged in branch + (fetchpatch { + name = "0004-qtmir-CMakeLists-Drop-call-of-Qt-internal-macro.patch"; + url = "https://gitlab.com/ubports/development/core/qtmir/-/commit/8f9c599a4dbc4cf35e289157fd0c82df55b9f8d9.patch"; + hash = "sha256-SMAErXnlMtVleWRPgO4xuUI7gAAy6W18LxtgXgetRA4="; + }) + ]; + + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace "\''${CMAKE_INSTALL_FULL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}" \ + --replace "\''${CMAKE_INSTALL_FULL_LIBDIR}/qt5/plugins/platforms" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtPluginPrefix}/platforms" \ + + substituteInPlace data/xwayland.qtmir.desktop \ + --replace '/usr/bin/Xwayland' 'Xwayland' + ''; + + strictDeps = true; + + nativeBuildInputs = [ + cmake + glib # glib-compile-schemas + pkg-config + validatePkgConfig + wrapQtAppsHook + ]; + + buildInputs = [ + cmake-extras + boost + gsettings-qt + libuuid + lomiri-api + lomiri-app-launch + lomiri-url-dispatcher + lttng-ust + mir + process-cpp + protobuf + qtbase + qtdeclarative + qtsensors + valgrind + + glm # included by mir header + wayland # mirwayland asks for this + properties-cpp # included by l-a-l header + ]; + + propagatedBuildInputs = [ + # Needs Xwayland on PATH for desktop file, else launching X11 applications crashes qtmir + xwayland + ]; + + checkInputs = [ + gtest + libqtdbustest + libqtdbusmock + ]; + + cmakeFlags = [ + (lib.cmakeBool "NO_TESTS" (!finalAttrs.finalPackage.doCheck)) + (lib.cmakeBool "WITH_MIR2" true) + ]; + + postInstall = '' + glib-compile-schemas $out/share/glib-2.0/schemas + ''; + + # Tests currently unavailable when building with Mir2 + doCheck = false; + + passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + + meta = with lib; { + description = "QPA plugin to make Qt a Mir server"; + homepage = "https://gitlab.com/ubports/development/core/qtmir"; + license = licenses.lgpl3Only; + maintainers = teams.lomiri.members; + platforms = platforms.linux; + pkgConfigModules = [ + "qtmirserver" + ]; + }; +})