summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/python-modules/metawear/default.nix60
-rw-r--r--pkgs/top-level/python-packages.nix2
2 files changed, 62 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/metawear/default.nix b/pkgs/development/python-modules/metawear/default.nix
new file mode 100644
index 00000000000..96f8c943450
--- /dev/null
+++ b/pkgs/development/python-modules/metawear/default.nix
@@ -0,0 +1,60 @@
+{ lib
+, stdenv
+, buildPythonPackage
+, fetchPypi
+, gcc
+, 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 = with lib; {
+    description = "Python bindings for the MetaWear C++ SDK by MbientLab";
+    homepage = "https://github.com/mbientlab/metawear-sdk-python";
+    license = with licenses; [ unfree ];
+    maintainers = with maintainers; [ stepbrobd ];
+    platforms = platforms.linux;
+  };
+}
+
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 2f5fc88ad16..ecd895b2d7d 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -6343,6 +6343,8 @@ self: super: with self; {
 
   metar = callPackage ../development/python-modules/metar { };
 
+  metawear = callPackage ../development/python-modules/metawear { };
+
   meteoalertapi = callPackage ../development/python-modules/meteoalertapi { };
 
   meteocalc = callPackage ../development/python-modules/meteocalc { };