about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/qmenumodel/default.nix
blob: 7d1384df364bc8e739507db3867c09bcc8ad90fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{ stdenv
, lib
, fetchFromGitHub
, gitUpdater
, testers
, cmake
, cmake-extras
, dbus
, dbus-test-runner
, glib
, pkg-config
, python3
, qtbase
, qtdeclarative
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "qmenumodel";
  version = "0.9.2";

  src = fetchFromGitHub {
    owner = "AyatanaIndicators";
    repo = "qmenumodel";
    rev = finalAttrs.version;
    hash = "sha256-zbKAfq9R5fD2IqVYOAhy903QX1TDom9m6Ib2qpkFMak=";
  };

  outputs = [ "out" "dev" ];

  postPatch = ''
    substituteInPlace libqmenumodel/src/qmenumodel.pc.in \
      --replace "\''${exec_prefix}/@CMAKE_INSTALL_LIBDIR@" "\''${prefix}/lib" \
      --replace "\''${prefix}/@CMAKE_INSTALL_INCLUDEDIR@" "\''${prefix}/include"

    substituteInPlace libqmenumodel/QMenuModel/CMakeLists.txt \
      --replace "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
  '' + lib.optionalString finalAttrs.finalPackage.doCheck ''
    patchShebangs tests/{client,script}/*.py
  '';

  strictDeps = true;

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    cmake-extras
    glib
    qtbase
    qtdeclarative
  ];

  nativeCheckInputs = [
    dbus
    dbus-test-runner
    (python3.withPackages (ps: with ps; [
      dbus-python
      pygobject3
    ]))
  ];

  dontWrapQtApps = true;

  cmakeFlags = [
    "-DENABLE_TESTS=${lib.boolToString finalAttrs.finalPackage.doCheck}"
  ];

  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

  # Tests have been flaky sometimes, hoping that not running in parallel helps
  enableParallelChecking = false;

  preCheck = ''
    # Tests all need some Qt stuff
    export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
  '';

  passthru = {
    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
    updateScript = gitUpdater { };
  };

  meta = with lib; {
    description = "Qt5 renderer for Ayatana Indicators";
    longDescription = ''
      QMenuModel - a Qt/QML binding for GMenuModel
      (see http://developer.gnome.org/gio/unstable/GMenuModel.html)
    '';
    homepage = "https://github.com/AyatanaIndicators/qmenumodel";
    license = licenses.lgpl3Only;
    maintainers = teams.lomiri.members;
    platforms = platforms.linux;
    pkgConfigModules = [
      "qmenumodel"
    ];
  };
})