1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 xcbuild,
7 cython_0,
8 udev,
9 darwin,
10}:
11
12buildPythonPackage rec {
13 pname = "hidapi";
14 version = "0.14.0.post2";
15 format = "setuptools";
16
17 src = fetchPypi {
18 inherit pname version;
19 sha256 = "sha256-bA6XumsFmjCdUbSVqPDV77zqh1a2QNmLb2u5/e8kWKw=";
20 };
21
22 nativeBuildInputs = [ cython_0 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcbuild ];
23
24 propagatedBuildInputs =
25 lib.optionals stdenv.hostPlatform.isLinux [ udev ]
26 ++ lib.optionals stdenv.hostPlatform.isDarwin (
27 with darwin.apple_sdk.frameworks;
28 [
29 AppKit
30 CoreFoundation
31 IOKit
32 ]
33 );
34
35 pythonImportsCheck = [ "hid" ];
36
37 meta = with lib; {
38 description = "Cython interface to the hidapi from https://github.com/libusb/hidapi";
39 homepage = "https://github.com/trezor/cython-hidapi";
40 # license can actually be either bsd3 or gpl3
41 # see https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt
42 license = with licenses; [
43 bsd3
44 gpl3Only
45 ];
46 maintainers = with maintainers; [
47 np
48 prusnak
49 ];
50 };
51}