about summary refs log tree commit diff
path: root/pkgs/desktops
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-07-23 18:01:33 +0000
committerGitHub <noreply@github.com>2023-07-23 18:01:33 +0000
commit6afe543aecbc7fc472cebb0e3303398ba230caa0 (patch)
treede4c09719200e6254984b276ce51cabd2b9a233d /pkgs/desktops
parent16b32782b4a31a2f49a474d9ddc6eaa6ffd31739 (diff)
parent8c7af7b7c4fbba9e8974cfadf18bb7fe2528ca62 (diff)
downloadnixlib-6afe543aecbc7fc472cebb0e3303398ba230caa0.tar
nixlib-6afe543aecbc7fc472cebb0e3303398ba230caa0.tar.gz
nixlib-6afe543aecbc7fc472cebb0e3303398ba230caa0.tar.bz2
nixlib-6afe543aecbc7fc472cebb0e3303398ba230caa0.tar.lz
nixlib-6afe543aecbc7fc472cebb0e3303398ba230caa0.tar.xz
nixlib-6afe543aecbc7fc472cebb0e3303398ba230caa0.tar.zst
nixlib-6afe543aecbc7fc472cebb0e3303398ba230caa0.zip
Merge master into staging-next
Diffstat (limited to 'pkgs/desktops')
-rw-r--r--pkgs/desktops/lomiri/default.nix1
-rw-r--r--pkgs/desktops/lomiri/development/libusermetrics/default.nix129
2 files changed, 130 insertions, 0 deletions
diff --git a/pkgs/desktops/lomiri/default.nix b/pkgs/desktops/lomiri/default.nix
index ba4c6446d4c0..4aa91bae9f9c 100644
--- a/pkgs/desktops/lomiri/default.nix
+++ b/pkgs/desktops/lomiri/default.nix
@@ -12,6 +12,7 @@ let
     deviceinfo = callPackage ./development/deviceinfo { };
     geonames = callPackage ./development/geonames { };
     gmenuharness = callPackage ./development/gmenuharness { };
+    libusermetrics = callPackage ./development/libusermetrics { };
     lomiri-api = callPackage ./development/lomiri-api { };
   };
 in
diff --git a/pkgs/desktops/lomiri/development/libusermetrics/default.nix b/pkgs/desktops/lomiri/development/libusermetrics/default.nix
new file mode 100644
index 000000000000..7ccaccfa395e
--- /dev/null
+++ b/pkgs/desktops/lomiri/development/libusermetrics/default.nix
@@ -0,0 +1,129 @@
+{ stdenv
+, lib
+, fetchFromGitLab
+, gitUpdater
+, testers
+, cmake
+, cmake-extras
+, dbus
+, doxygen
+, gsettings-qt
+, gtest
+, intltool
+, json-glib
+, libapparmor
+, libqtdbustest
+, pkg-config
+, qdjango
+, qtbase
+, qtdeclarative
+, qtxmlpatterns
+, ubports-click
+, wrapQtAppsHook
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "libusermetrics";
+  version = "1.3.0";
+
+  src = fetchFromGitLab {
+    owner = "ubports";
+    repo = "development/core/libusermetrics";
+    rev = finalAttrs.version;
+    hash = "sha256-yO9wZcXJBKt1HZ1GKoQ1flqYuwW9PlXiWLE3bl21PSQ=";
+  };
+
+  outputs = [
+    "out"
+    "dev"
+    "doc"
+  ];
+
+  postPatch = ''
+    substituteInPlace data/CMakeLists.txt \
+      --replace '/etc' "$out/etc"
+
+    # Tries to query QMake for QT_INSTALL_QML variable, would return broken paths into /build/qtbase-<commit> even if qmake was available
+    substituteInPlace src/modules/UserMetrics/CMakeLists.txt \
+      --replace "\''${QT_IMPORTS_DIR}/UserMetrics" '${placeholder "out"}/${qtbase.qtQmlPrefix}/UserMetrics'
+
+    substituteInPlace src/libusermetricsinput/CMakeLists.txt \
+      --replace 'RUNTIME DESTINATION bin' 'RUNTIME DESTINATION ''${CMAKE_INSTALL_BINDIR}'
+
+    substituteInPlace doc/CMakeLists.txt \
+      --replace "\''${CMAKE_INSTALL_DATAROOTDIR}/doc/libusermetrics-doc" "\''${CMAKE_INSTALL_DOCDIR}"
+  '' + lib.optionalString (!finalAttrs.doCheck) ''
+    # Only needed by tests
+    sed -i -e '/QTDBUSTEST/d' CMakeLists.txt
+  '';
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    cmake
+    doxygen
+    intltool
+    pkg-config
+    wrapQtAppsHook
+  ];
+
+  buildInputs = [
+    cmake-extras
+    gsettings-qt
+    json-glib
+    libapparmor
+    qdjango
+    qtxmlpatterns
+    ubports-click
+
+    # Plugin
+    qtbase
+  ];
+
+  nativeCheckInputs = [
+    dbus
+  ];
+
+  checkInputs = [
+    gtest
+    libqtdbustest
+    qtdeclarative
+  ];
+
+  cmakeFlags = [
+    "-DGSETTINGS_LOCALINSTALL=ON"
+    "-DGSETTINGS_COMPILE=ON"
+    "-DENABLE_TESTS=${lib.boolToString finalAttrs.doCheck}"
+  ];
+
+  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
+
+  checkPhase = ''
+    runHook preCheck
+
+    export QT_PLUGIN_PATH=${lib.getBin qtbase}/lib/qt-${qtbase.version}/plugins/
+    export QML2_IMPORT_PATH=${lib.getBin qtdeclarative}/lib/qt-${qtbase.version}/qml/
+    dbus-run-session --config-file=${dbus}/share/dbus-1/session.conf -- \
+      make test "''${enableParallelChecking:+-j $NIX_BUILD_CORES}"
+
+    runHook postCheck
+  '';
+
+  passthru = {
+    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
+    updateScript = gitUpdater { };
+  };
+
+  meta = with lib; {
+    description = "Enables apps to locally store interesting numerical data for later presentation";
+    homepage = "https://gitlab.com/ubports/development/core/libusermetrics";
+    license = licenses.lgpl3Only;
+    maintainers = teams.lomiri.members;
+    platforms = platforms.linux;
+    mainProgram = "usermetricsinput";
+    pkgConfigModules = [
+      "libusermetricsinput-1"
+      "libusermetricsoutput-1"
+    ];
+  };
+})