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