nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 133 lines 3.3 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitLab, 5 fetchpatch, 6 gitUpdater, 7 testers, 8 cmake, 9 cmake-extras, 10 dbus, 11 doxygen, 12 glibcLocales, 13 gsettings-qt, 14 gtest, 15 intltool, 16 json-glib, 17 libapparmor, 18 libqtdbustest, 19 pkg-config, 20 qdjango, 21 qtbase, 22 qtdeclarative, 23 qtxmlpatterns, 24 ubports-click, 25 validatePkgConfig, 26 wrapQtAppsHook, 27}: 28 29stdenv.mkDerivation (finalAttrs: { 30 pname = "libusermetrics"; 31 version = "1.3.3"; 32 33 src = fetchFromGitLab { 34 owner = "ubports"; 35 repo = "development/core/libusermetrics"; 36 rev = finalAttrs.version; 37 hash = "sha256-V4vxNyHMs2YYBILkpco79FN9xnooULgB+z2Kf3V0790="; 38 }; 39 40 outputs = [ 41 "out" 42 "dev" 43 "doc" 44 ]; 45 46 patches = [ 47 # Remove when https://gitlab.com/ubports/development/core/libusermetrics/-/merge_requests/17 merged & in release 48 (fetchpatch { 49 name = "0001-libusermetrics-BUILD_TESTING.patch"; 50 url = "https://gitlab.com/ubports/development/core/libusermetrics/-/commit/c1e4847601cc4522034a766755ce491d48132d77.patch"; 51 hash = "sha256-UWc9/ngpuiSm0Rd6eBK/R3N/NwDRtMxie78seN3+y/8="; 52 }) 53 ]; 54 55 postPatch = '' 56 # Tries to query QMake for QT_INSTALL_QML variable, would return broken paths into /build/qtbase-<commit> even if qmake was available 57 substituteInPlace src/modules/UserMetrics/CMakeLists.txt \ 58 --replace-fail 'query_qmake(QT_INSTALL_QML QT_IMPORTS_DIR)' 'set(QT_IMPORTS_DIR "''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}")' 59 60 substituteInPlace doc/CMakeLists.txt \ 61 --replace-fail "\''${CMAKE_INSTALL_FULL_DATAROOTDIR}/doc/libusermetrics-doc" "\''${CMAKE_INSTALL_DOCDIR}" 62 ''; 63 64 strictDeps = true; 65 66 nativeBuildInputs = [ 67 cmake 68 doxygen 69 intltool 70 pkg-config 71 validatePkgConfig 72 wrapQtAppsHook 73 ]; 74 75 buildInputs = [ 76 cmake-extras 77 gsettings-qt 78 json-glib 79 libapparmor 80 qdjango 81 qtxmlpatterns 82 ubports-click 83 84 # Plugin 85 qtbase 86 ]; 87 88 # Tests need to be able to check locale 89 LC_ALL = lib.optionalString finalAttrs.finalPackage.doCheck "en_US.UTF-8"; 90 91 nativeCheckInputs = [ 92 dbus 93 glibcLocales 94 ]; 95 96 checkInputs = [ 97 gtest 98 libqtdbustest 99 qtdeclarative 100 ]; 101 102 cmakeFlags = [ 103 (lib.cmakeBool "GSETTINGS_LOCALINSTALL" true) 104 (lib.cmakeBool "GSETTINGS_COMPILE" true) 105 (lib.cmakeBool "ENABLE_CLICK" true) 106 ]; 107 108 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; 109 110 preCheck = '' 111 export QT_PLUGIN_PATH=${lib.getBin qtbase}/lib/qt-${qtbase.version}/plugins/ 112 export QML2_IMPORT_PATH=${lib.getBin qtdeclarative}/lib/qt-${qtbase.version}/qml/ 113 ''; 114 115 passthru = { 116 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 117 updateScript = gitUpdater { }; 118 }; 119 120 meta = { 121 description = "Enables apps to locally store interesting numerical data for later presentation"; 122 homepage = "https://gitlab.com/ubports/development/core/libusermetrics"; 123 changelog = "https://gitlab.com/ubports/development/core/libusermetrics/-/blob/${finalAttrs.version}/ChangeLog"; 124 license = lib.licenses.lgpl3Only; 125 teams = [ lib.teams.lomiri ]; 126 platforms = lib.platforms.linux; 127 mainProgram = "usermetricsinput"; 128 pkgConfigModules = [ 129 "libusermetricsinput-1" 130 "libusermetricsoutput-1" 131 ]; 132 }; 133})