about summary refs log tree commit diff
path: root/pkgs/development/python-modules/gattlib/default.nix
blob: c7450d6b6b5b839231f03a736ea30bfffcb63747 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ lib
, buildPythonPackage
, fetchFromGitHub
, substituteAll

# build
, pkg-config
, glibc
, python

# runtime
, bluez
, boost
, glib

}:

let
  pname = "gattlib";
  version = "unstable-2021-06-16";
in
buildPythonPackage {
  inherit pname version;
  format = "setuptools";


  src = fetchFromGitHub {
    owner = "oscaracena";
    repo = "pygattlib";
    rev = "7bdb229124fe7d9f4a2cc090277b0fdef82e2a56";
    hash = "sha256-PS5DIH1JuH2HweyebLLM+UNFGY/XsjKIrsD9x7g7yMI=";
  };

  patches = [
    (substituteAll {
      src = ./setup.patch;
      boost_version = let
        pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
      in
        "boost_python${pythonVersion}";
    })
  ];

  nativeBuildInputs = [
    pkg-config
    glibc
  ];

  buildInputs = [
    bluez
    boost
    glib
  ];

  # has no tests
  doCheck = false;

  pythonImportsCheck = [
    "gattlib"
  ];

  meta = with lib; {
    description = "Python library to use the GATT Protocol for Bluetooth LE devices";
    homepage = "https://github.com/oscaracena/pygattlib";
    license = licenses.asl20;
    maintainers = with maintainers; [ hexa ];
  };
}