summary refs log tree commit diff
path: root/pkgs/development/python-modules/pc-ble-driver-py/default.nix
blob: d21d9d07150def7c6f6fc0f1330c0cc7310b3b09 (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
{ stdenv, buildPythonPackage, fetchpatch, fetchFromGitHub,
  python, cmake, git, swig, boost, udev,
  setuptools, enum34, wrapt, future }:

buildPythonPackage rec {
  pname = "pc-ble-driver-py";
  version = "0.11.4";
  disabled = python.isPy3k;

  src = fetchFromGitHub {
    owner = "NordicSemiconductor";
    repo = "pc-ble-driver-py";
    rev = "v${version}";
    fetchSubmodules = true;
    sha256 = "0lgmcnrlcivmawmlcwnn4pdp6afdbnf3fyfgq22xzs6v72m9gp81";
  };

  nativeBuildInputs = [ cmake swig git setuptools ];
  buildInputs = [ boost udev ];
  propagatedBuildInputs = [ enum34 wrapt future ];

  patches = [
    # build system expects case-insensitive file system
    (fetchpatch {
      url = "https://patch-diff.githubusercontent.com/raw/NordicSemiconductor/pc-ble-driver-py/pull/84.patch";
      sha256 = "0ibx5g2bndr5h9sfnx51bk9b62q4jvpdwhxadbnj3da8kvcz13cy";
    })
  ];

  postPatch = ''
    # do not force static linking of boost
    sed -i /Boost_USE_STATIC_LIBS/d pc-ble-driver/cmake/*.cmake

    cd python
  '';

  preBuild = ''
    pushd ../build
    cmake ..
    make -j $NIX_BUILD_CORES
    popd
  '';

  meta = with stdenv.lib; {
    description = "Bluetooth Low Energy nRF5 SoftDevice serialization";
    homepage = "https://github.com/NordicSemiconductor/pc-ble-driver-py";
    license = licenses.unfreeRedistributable;
    platforms = platforms.unix;
    maintainers = with maintainers; [ gebner ];
  };
}