1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, substituteAll
5
6# build
7, pkg-config
8, glibc
9, python
10
11# runtime
12, bluez
13, boost
14, glib
15
16}:
17
18let
19 pname = "gattlib";
20 version = "unstable-2021-06-16";
21in
22buildPythonPackage {
23 inherit pname version;
24 format = "setuptools";
25
26
27 src = fetchFromGitHub {
28 owner = "oscaracena";
29 repo = "pygattlib";
30 rev = "7bdb229124fe7d9f4a2cc090277b0fdef82e2a56";
31 hash = "sha256-PS5DIH1JuH2HweyebLLM+UNFGY/XsjKIrsD9x7g7yMI=";
32 };
33
34 patches = [
35 (substituteAll {
36 src = ./setup.patch;
37 boost_version = let
38 pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
39 in
40 "boost_python${pythonVersion}";
41 })
42 ];
43
44 nativeBuildInputs = [
45 pkg-config
46 glibc
47 ];
48
49 buildInputs = [
50 bluez
51 boost
52 glib
53 ];
54
55 # has no tests
56 doCheck = false;
57
58 pythonImportsCheck = [
59 "gattlib"
60 ];
61
62 meta = with lib; {
63 description = "Python library to use the GATT Protocol for Bluetooth LE devices";
64 homepage = "https://github.com/oscaracena/pygattlib";
65 license = licenses.asl20;
66 maintainers = with maintainers; [ hexa ];
67 };
68}