1{ stdenv, buildPythonPackage, fetchpatch, fetchFromGitHub,
2 python, cmake, git, swig, boost, udev,
3 setuptools, enum34, wrapt, future }:
4
5buildPythonPackage rec {
6 pname = "pc-ble-driver-py";
7 version = "0.11.4";
8 disabled = python.isPy3k;
9
10 src = fetchFromGitHub {
11 owner = "NordicSemiconductor";
12 repo = "pc-ble-driver-py";
13 rev = "v${version}";
14 fetchSubmodules = true;
15 sha256 = "0lgmcnrlcivmawmlcwnn4pdp6afdbnf3fyfgq22xzs6v72m9gp81";
16 };
17
18 nativeBuildInputs = [ cmake swig git setuptools ];
19 buildInputs = [ boost udev ];
20 propagatedBuildInputs = [ enum34 wrapt future ];
21
22 patches = [
23 # build system expects case-insensitive file system
24 (fetchpatch {
25 url = "https://patch-diff.githubusercontent.com/raw/NordicSemiconductor/pc-ble-driver-py/pull/84.patch";
26 sha256 = "0ibx5g2bndr5h9sfnx51bk9b62q4jvpdwhxadbnj3da8kvcz13cy";
27 })
28 ];
29
30 postPatch = ''
31 # do not force static linking of boost
32 sed -i /Boost_USE_STATIC_LIBS/d pc-ble-driver/cmake/*.cmake
33
34 cd python
35 '';
36
37 preBuild = ''
38 pushd ../build
39 cmake ..
40 make -j $NIX_BUILD_CORES
41 popd
42 '';
43
44 meta = with stdenv.lib; {
45 description = "Bluetooth Low Energy nRF5 SoftDevice serialization";
46 homepage = "https://github.com/NordicSemiconductor/pc-ble-driver-py";
47 license = licenses.unfreeRedistributable;
48 platforms = platforms.unix;
49 maintainers = with maintainers; [ gebner ];
50 };
51}