12 buildPythonPackage rec {
14 version = "0.12.0.post2";
17 inherit pname version;
18 sha256 = "8ebb2117be8b27af5c780936030148e1971b6b7fda06e0581ff0bfb15e94ed76";
21 nativeBuildInputs = lib.optionals stdenv.isDarwin [ xcbuild ];
23 propagatedBuildInputs = [ cython ]
24 ++ lib.optionals stdenv.isLinux [ libusb1 udev ]
25 ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ AppKit CoreFoundation IOKit ]);
27 # Fix the USB backend library lookup
28 postPatch = lib.optionalString stdenv.isLinux ''
29 libusb=${libusb1.dev}/include/libusb-1.0
30 test -d $libusb || { echo "ERROR: $libusb doesn't exist, please update/fix this build expression."; exit 1; }
31 sed -i -e "s|/usr/include/libusb-1.0|$libusb|" setup.py
34 pythonImportsCheck = [ "hid" ];
37 description = "A Cython interface to the hidapi from https://github.com/libusb/hidapi";
38 homepage = "https://github.com/trezor/cython-hidapi";
39 # license can actually be either bsd3 or gpl3
40 # see https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt
41 license = with licenses; [ bsd3 gpl3Only ];
42 maintainers = with maintainers; [ np prusnak ];