Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 19.09 32 lines 1.2 kB view raw
1{ stdenv, libusb1, udev, darwin, 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 = 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}