summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/metawear/default.nix
blob: a9f4e429ccabe87c97dcf79f33d0e08ddff8a382 (plain)
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
{
  lib,
  buildPythonPackage,
  fetchPypi,
  cython,
  boost,
  bluez,
  nlohmann_json,
  pyserial,
  requests,
  warble,
}:

buildPythonPackage rec {
  pname = "metawear";
  version = "1.0.8";
  format = "setuptools";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-gNEI6P6GslNd1DzFwCFndVIfUvSTPYollGdqkZhQ4Y8=";
  };

  nativeBuildInputs = [ cython ];

  buildInputs = [
    boost
    bluez
    nlohmann_json
  ];

  postPatch = ''
    # remove vendored nlohmann_json
    rm MetaWear-SDK-Cpp/src/metawear/dfu/cpp/json.hpp
    substituteInPlace MetaWear-SDK-Cpp/src/metawear/dfu/cpp/file_operations.cpp \
        --replace '#include "json.hpp"' '#include <nlohmann/json.hpp>'
  '';

  propagatedBuildInputs = [
    pyserial
    requests
    warble
  ];

  enableParallelBuilding = true;

  pythonImportsCheck = [
    "mbientlab"
    "mbientlab.metawear"
  ];

  meta = {
    description = "Python bindings for the MetaWear C++ SDK by MbientLab";
    homepage = "https://github.com/mbientlab/metawear-sdk-python";
    license = with lib.licenses; [ unfree ];
    maintainers = with lib.maintainers; [ stepbrobd ];
    platforms = lib.platforms.linux;
  };
}