Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.09 1.4 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 '' + stdenv.lib.optionalString stdenv.isDarwin '' 23 substituteInPlace setup.py --replace 'macos_sdk_path =' 'macos_sdk_path = "" #' 24 ''; 25 26 pythonImportsCheck = [ "hid" ]; 27 28 meta = with stdenv.lib; { 29 description = "A Cython interface to the hidapi from https://github.com/signal11/hidapi"; 30 homepage = "https://github.com/trezor/cython-hidapi"; 31 # license can actually be either bsd3 or gpl3 32 # see https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt 33 license = licenses.bsd3; 34 maintainers = with maintainers; [ np ]; 35 }; 36}