about summary refs log tree commit diff
path: root/pkgs/development/python-modules/openant/default.nix
blob: a4a54e9a879dcc9e880ecfcec42e694eac5bc44c (plain) (blame)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,
  setuptools,
  pyusb,
  influxdb-client,
  pyserial,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "openant-unstable";
  version = "1.3.1";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "Tigge";
    repo = "openant";
    rev = "refs/tags/v${version}";
    hash = "sha256-wDtHlkVyD7mMDXZ4LGMgatr9sSlQKVbgkYsKvHGr9Pc=";
  };

  nativeBuildInputs = [ setuptools ];

  postInstall = ''
    install -dm755 "$out/etc/udev/rules.d"
    install -m644 resources/42-ant-usb-sticks.rules "$out/etc/udev/rules.d/99-ant-usb-sticks.rules"
  '';

  propagatedBuildInputs = [ pyusb ];

  passthru.optional-dependencies = {
    serial = [ pyserial ];
    influx = [ influxdb-client ];
  };

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "openant" ];

  meta = with lib; {
    homepage = "https://github.com/Tigge/openant";
    description = "ANT and ANT-FS Python Library";
    mainProgram = "openant";
    license = licenses.mit;
  };
}