1{ stdenv, lib, buildPythonPackage, fetchPypi, libusb1 }: 2 3buildPythonPackage rec { 4 pname = "libusb1"; 5 version = "1.6.4"; 6 7 src = fetchPypi { 8 inherit pname version; 9 sha256 = "03b7xrz8vqg8w0za5r503jhcmbd1ls5610jcja1rqz833nf0v4wc"; 10 }; 11 12 postPatch = lib.optionalString stdenv.isLinux '' 13 substituteInPlace usb1/libusb1.py --replace \ 14 "ctypes.util.find_library(base_name)" \ 15 "'${libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}'" 16 ''; 17 18 buildInputs = [ libusb1 ]; 19 20 meta = with stdenv.lib; { 21 homepage = https://github.com/vpelletier/python-libusb1; 22 description = "Python ctype-based wrapper around libusb1"; 23 license = licenses.lgpl2Plus; 24 maintainers = with maintainers; [ rnhmjoj ]; 25 }; 26}