summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/gotify/default.nix
blob: ff964c5b4e30197b0ff65fd4c99ebfe6f3799933 (plain)
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
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  pythonAtLeast,
  flit-core,
  nix-update-script,
  httpx,
  websockets,
  pytestCheckHook,
  pytest-asyncio,
  typeguard,
  gotify-server,
}:

buildPythonPackage rec {
  pname = "gotify";
  version = "0.6.0";
  pyproject = true;
  disabled = pythonAtLeast "3.14";

  src = fetchFromGitHub {
    owner = "d-k-bo";
    repo = "python-gotify";
    tag = "v${version}";
    hash = "sha256-epm8m2W+ChOvWHZi2ruAD+HJGj+V7NfhmFLKeeqcpoI=";
  };

  build-system = [ flit-core ];

  dependencies = [
    httpx
    websockets
  ];

  # tests raise an exception if the system is not Linux or Windows
  doCheck = !stdenv.buildPlatform.isDarwin;

  # tests require gotify-server to be located in ./tests/test-server/gotify-linux-{arch}
  postPatch = ''
    ln -s "${gotify-server}/bin/server" ./tests/test-server/gotify-linux-386
    ln -s "${gotify-server}/bin/server" ./tests/test-server/gotify-linux-amd64
    ln -s "${gotify-server}/bin/server" ./tests/test-server/gotify-linux-arm-7
    ln -s "${gotify-server}/bin/server" ./tests/test-server/gotify-linux-arm64
  '';

  nativeCheckInputs = [
    pytestCheckHook
    pytest-asyncio
    typeguard
    gotify-server
  ];

  pythonImportsCheck = [
    "gotify"
  ];

  passthru.updateScript = nix-update-script { };

  meta = {
    changelog = "https://github.com/d-k-bo/python-gotify/releases/tag/v${version}";
    description = "Python library to access your gotify server";
    homepage = "https://github.com/d-k-bo/python-gotify";
    license = lib.licenses.mit;
    maintainers = [
      lib.maintainers.joblade
    ];
  };
}