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
|
{
lib,
stdenv,
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
substituteAll,
alsa-utils,
libnotify,
which,
poetry-core,
jeepney,
loguru,
pytest,
dbus,
coreutils,
}:
buildPythonPackage rec {
pname = "notify-py";
version = "0.3.43";
format = "pyproject";
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "ms7m";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-4PJ/0dLG3bWDuF1G/qUmvNaIUFXgPP2S/0uhZz86WRA=";
};
patches =
lib.optionals stdenv.hostPlatform.isLinux [
# hardcode paths to aplay and notify-send
(substituteAll {
src = ./linux-paths.patch;
aplay = "${alsa-utils}/bin/aplay";
notifysend = "${libnotify}/bin/notify-send";
})
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# hardcode path to which
(substituteAll {
src = ./darwin-paths.patch;
which = "${which}/bin/which";
})
];
nativeBuildInputs = [
poetry-core
];
pythonRelaxDeps = [ "loguru" ];
propagatedBuildInputs = [ loguru ] ++ lib.optionals stdenv.hostPlatform.isLinux [ jeepney ];
nativeCheckInputs = [ pytest ] ++ lib.optionals stdenv.hostPlatform.isLinux [ dbus ];
checkPhase =
if stdenv.hostPlatform.isDarwin then
''
# Tests search for "afplay" binary which is built in to macOS and not available in nixpkgs
mkdir $TMP/bin
ln -s ${coreutils}/bin/true $TMP/bin/afplay
PATH="$TMP/bin:$PATH" pytest
''
else if stdenv.hostPlatform.isLinux then
''
dbus-run-session \
--config-file=${dbus}/share/dbus-1/session.conf \
pytest
''
else
''
pytest
'';
# GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name
# org.freedesktop.Notifications was not provided by any .service files
doCheck = false;
pythonImportsCheck = [ "notifypy" ];
meta = with lib; {
description = "Cross-platform desktop notification library for Python";
mainProgram = "notifypy";
homepage = "https://github.com/ms7m/notify-py";
changelog = "https://github.com/ms7m/notify-py/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [
austinbutler
dotlambda
];
};
}
|