Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.09-beta 32 lines 1.2 kB view raw
1{ stdenv, libusb1, udev, darwin, fetchPypi, buildPythonPackage, cython }: 2 3buildPythonPackage rec { 4 pname = "hidapi"; 5 version = "0.9.0.post3"; 6 7 src = fetchPypi { 8 inherit pname version; 9 sha256 = "5a2442928f17ba742d9c53073f48b152051c5747d758d2fefd937543da5ab2e5"; 10 }; 11 12 propagatedBuildInputs = 13 stdenv.lib.optionals stdenv.isLinux [ libusb1 udev ] ++ 14 stdenv.lib.optionals stdenv.isDarwin [ darwin.IOKit darwin.apple_sdk.frameworks.CoreFoundation ] ++ 15 [ cython ]; 16 17 # Fix the USB backend library lookup 18 postPatch = stdenv.lib.optionalString stdenv.isLinux '' 19 libusb=${libusb1.dev}/include/libusb-1.0 20 test -d $libusb || { echo "ERROR: $libusb doesn't exist, please update/fix this build expression."; exit 1; } 21 sed -i -e "s|/usr/include/libusb-1.0|$libusb|" setup.py 22 ''; 23 24 meta = with stdenv.lib; { 25 description = "A Cython interface to the hidapi from https://github.com/signal11/hidapi"; 26 homepage = "https://github.com/trezor/cython-hidapi"; 27 # license can actually be either bsd3 or gpl3 28 # see https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt 29 license = licenses.bsd3; 30 maintainers = with maintainers; [ np ]; 31 }; 32}