1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 pillow,
7 xlib,
8 six,
9 xvfb-run,
10 setuptools,
11 gobject-introspection,
12 pygobject3,
13 gtk3,
14 libayatana-appindicator,
15 pytest,
16}:
17
18buildPythonPackage rec {
19 pname = "pystray";
20 version = "0.19.5";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "moses-palmer";
25 repo = "pystray";
26 rev = "v${version}";
27 hash = "sha256-CZhbaXwKFrRBEomzfFPMQdMkTOl5lbgI64etfDRiRu4=";
28 };
29
30 patches = [
31 # fix test_menu_construct_from_none test case
32 # https://github.com/moses-palmer/pystray/pull/133
33 (fetchpatch {
34 url = "https://github.com/moses-palmer/pystray/commit/813007e3034d950d93a2f3e5b029611c3c9c98ad.patch";
35 hash = "sha256-m2LfZcWXSfgxb73dac21VDdMDVz3evzcCz5QjdnfM1U=";
36 })
37 ];
38
39 postPatch = ''
40 substituteInPlace setup.py \
41 --replace-fail "'sphinx >=1.3.1'" ""
42 '';
43
44 nativeBuildInputs = [
45 gobject-introspection
46 setuptools
47 ];
48
49 propagatedBuildInputs = [
50 pillow
51 xlib
52 six
53 pygobject3
54 gtk3
55 libayatana-appindicator
56 ];
57
58 nativeCheckInputs = [
59 pytest
60 xvfb-run
61 ];
62
63 checkPhase = ''
64 runHook preCheck
65
66 xvfb-run -s '-screen 0 800x600x24' pytest tests/menu_descriptor_tests.py
67
68 runHook postCheck
69 '';
70
71 meta = with lib; {
72 homepage = "https://github.com/moses-palmer/pystray";
73 description = "This library allows you to create a system tray icon";
74 license = with licenses; [
75 gpl3Plus
76 lgpl3Plus
77 ];
78 platforms = platforms.linux;
79 maintainers = with maintainers; [ jojosch ];
80 };
81}