1{ stdenv, libusb1, udev, fetchPypi, buildPythonPackage, cython }:
2
3buildPythonPackage rec {
4 pname = "hidapi";
5 version = "0.7.99.post21";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "e0be1aa6566979266a8fc845ab0e18613f4918cf2c977fe67050f5dc7e2a9a97";
10 };
11
12 propagatedBuildInputs = [ libusb1 udev cython ];
13
14 # Fix the USB backend library lookup
15 postPatch = ''
16 libusb=${libusb1.dev}/include/libusb-1.0
17 test -d $libusb || { echo "ERROR: $libusb doesn't exist, please update/fix this build expression."; exit 1; }
18 sed -i -e "s|/usr/include/libusb-1.0|$libusb|" setup.py
19 '';
20
21 meta = with stdenv.lib; {
22 description = "A Cython interface to the hidapi from https://github.com/signal11/hidapi";
23 homepage = https://github.com/trezor/cython-hidapi;
24 # license can actually be either bsd3 or gpl3
25 # see https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt
26 license = licenses.bsd3;
27 maintainers = with maintainers; [ np ];
28 };
29}