summary refs log tree commit diff
path: root/pkgs/development/python-modules/streamdeck
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/streamdeck')
-rw-r--r--pkgs/development/python-modules/streamdeck/default.nix36
-rw-r--r--pkgs/development/python-modules/streamdeck/hardcode-libusb.patch13
2 files changed, 49 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/streamdeck/default.nix b/pkgs/development/python-modules/streamdeck/default.nix
new file mode 100644
index 00000000000..7d7f0071037
--- /dev/null
+++ b/pkgs/development/python-modules/streamdeck/default.nix
@@ -0,0 +1,36 @@
+{ lib
+, stdenv
+, buildPythonPackage
+, fetchPypi
+, substituteAll
+, pkgs
+}:
+
+buildPythonPackage rec {
+  pname = "streamdeck";
+  version = "0.9.1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0116a376afc18f3abbf79cc1a4409f81472e19197d5641b9e97e697d105cbdc0";
+  };
+
+  patches = [
+    # substitute libusb path
+    (substituteAll {
+      src = ./hardcode-libusb.patch;
+      libusb = "${pkgs.hidapi}/lib/libhidapi-libusb${stdenv.hostPlatform.extensions.sharedLibrary}";
+    })
+  ];
+
+  pythonImportsCheck = [ "StreamDeck" ];
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Python library to control the Elgato Stream Deck";
+    homepage = "https://github.com/abcminiuser/python-elgato-streamdeck";
+    license = licenses.mit;
+    maintainers = with maintainers; [ majiir ];
+    broken = stdenv.isDarwin;
+  };
+}
diff --git a/pkgs/development/python-modules/streamdeck/hardcode-libusb.patch b/pkgs/development/python-modules/streamdeck/hardcode-libusb.patch
new file mode 100644
index 00000000000..acef15b5405
--- /dev/null
+++ b/pkgs/development/python-modules/streamdeck/hardcode-libusb.patch
@@ -0,0 +1,13 @@
+diff --git a/src/StreamDeck/Transport/LibUSBHIDAPI.py b/src/StreamDeck/Transport/LibUSBHIDAPI.py
+index 824c59c..f13754e 100644
+--- a/src/StreamDeck/Transport/LibUSBHIDAPI.py
++++ b/src/StreamDeck/Transport/LibUSBHIDAPI.py
+@@ -110,7 +110,7 @@ class LibUSBHIDAPI(Transport):
+ 

+             search_library_names = {

+                 "Windows": ["hidapi.dll", "libhidapi-0.dll"],

+-                "Linux": ["libhidapi-libusb.so", "libhidapi-libusb.so.0"],

++                "Linux": ["@libusb@"],

+                 "Darwin": ["libhidapi.dylib"],

+             }

+