1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 gitUpdater,
6 testers,
7 cmake,
8 cmake-extras,
9 dbus,
10 dbus-test-runner,
11 glib,
12 pkg-config,
13 python3,
14 qtbase,
15 qtdeclarative,
16 gobject-introspection,
17}:
18
19stdenv.mkDerivation (finalAttrs: {
20 pname = "qmenumodel";
21 version = "0.9.2";
22
23 src = fetchFromGitHub {
24 owner = "AyatanaIndicators";
25 repo = "qmenumodel";
26 rev = finalAttrs.version;
27 hash = "sha256-zbKAfq9R5fD2IqVYOAhy903QX1TDom9m6Ib2qpkFMak=";
28 };
29
30 outputs = [
31 "out"
32 "dev"
33 ];
34
35 postPatch = ''
36 substituteInPlace libqmenumodel/src/qmenumodel.pc.in \
37 --replace "\''${exec_prefix}/@CMAKE_INSTALL_LIBDIR@" "\''${prefix}/lib" \
38 --replace "\''${prefix}/@CMAKE_INSTALL_INCLUDEDIR@" "\''${prefix}/include"
39
40 substituteInPlace libqmenumodel/QMenuModel/CMakeLists.txt \
41 --replace "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
42 ''
43 + lib.optionalString finalAttrs.finalPackage.doCheck ''
44 patchShebangs tests/{client,script}/*.py
45 '';
46
47 strictDeps = true;
48
49 nativeBuildInputs = [
50 cmake
51 pkg-config
52 ];
53
54 buildInputs = [
55 cmake-extras
56 glib
57 qtbase
58 qtdeclarative
59 ];
60
61 nativeCheckInputs = [
62 dbus
63 dbus-test-runner
64 gobject-introspection
65 (python3.withPackages (
66 ps: with ps; [
67 dbus-python
68 pygobject3
69 ]
70 ))
71 ];
72
73 dontWrapQtApps = true;
74
75 cmakeFlags = [
76 "-DENABLE_TESTS=${lib.boolToString finalAttrs.finalPackage.doCheck}"
77 ];
78
79 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
80
81 # Tests have been flaky sometimes, hoping that not running in parallel helps
82 enableParallelChecking = false;
83
84 preCheck = ''
85 # Tests all need some Qt stuff
86 export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
87 '';
88
89 passthru = {
90 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
91 updateScript = gitUpdater { };
92 };
93
94 meta = with lib; {
95 description = "Qt5 renderer for Ayatana Indicators";
96 longDescription = ''
97 QMenuModel - a Qt/QML binding for GMenuModel
98 (see http://developer.gnome.org/gio/unstable/GMenuModel.html)
99 '';
100 homepage = "https://github.com/AyatanaIndicators/qmenumodel";
101 license = licenses.lgpl3Only;
102 teams = [ teams.lomiri ];
103 platforms = platforms.linux;
104 pkgConfigModules = [
105 "qmenumodel"
106 ];
107 };
108})