1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 flit-core,
7 nix-update-script,
8 httpx,
9 websockets,
10 pytestCheckHook,
11 pytest-asyncio,
12 typeguard,
13 gotify-server,
14}:
15
16buildPythonPackage rec {
17 pname = "gotify";
18 version = "0.6.0";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "d-k-bo";
23 repo = "python-gotify";
24 tag = "v${version}";
25 hash = "sha256-epm8m2W+ChOvWHZi2ruAD+HJGj+V7NfhmFLKeeqcpoI=";
26 };
27
28 build-system = [ flit-core ];
29
30 dependencies = [
31 httpx
32 websockets
33 ];
34
35 # tests raise an exception if the system is not Linux or Windows
36 doCheck = !stdenv.buildPlatform.isDarwin;
37
38 # tests require gotify-server to be located in ./tests/test-server/gotify-linux-{arch}
39 postPatch = ''
40 ln -s "${gotify-server}/bin/server" ./tests/test-server/gotify-linux-386
41 ln -s "${gotify-server}/bin/server" ./tests/test-server/gotify-linux-amd64
42 ln -s "${gotify-server}/bin/server" ./tests/test-server/gotify-linux-arm-7
43 ln -s "${gotify-server}/bin/server" ./tests/test-server/gotify-linux-arm64
44 '';
45
46 nativeCheckInputs = [
47 pytestCheckHook
48 pytest-asyncio
49 typeguard
50 gotify-server
51 ];
52
53 pythonImportsCheck = [
54 "gotify"
55 ];
56
57 passthru.updateScript = nix-update-script { };
58
59 meta = {
60 changelog = "https://github.com/d-k-bo/python-gotify/releases/tag/v${version}";
61 description = "Python library to access your gotify server";
62 homepage = "https://github.com/d-k-bo/python-gotify";
63 license = lib.licenses.mit;
64 maintainers = [
65 lib.maintainers.joblade
66 ];
67 };
68}