1{ stdenv, libdiscid, buildPythonPackage, fetchPypi }: 2 3buildPythonPackage rec { 4 pname = "discid"; 5 version = "1.1.1"; 6 7 src = fetchPypi { 8 inherit pname version; 9 sha256 = "78a3bf6c8377fdbe3d85e914a209ff97aa43e35605779639847b510ced31f7b9"; 10 }; 11 12 patchPhase = 13 let extension = stdenv.hostPlatform.extensions.sharedLibrary; in 14 '' 15 substituteInPlace discid/libdiscid.py \ 16 --replace "_open_library(_LIB_NAME)" \ 17 "_open_library('${libdiscid}/lib/libdiscid${extension}')" 18 ''; 19 20 meta = with stdenv.lib; { 21 description = "Python binding of libdiscid"; 22 homepage = "https://python-discid.readthedocs.org/"; 23 license = licenses.lgpl3Plus; 24 }; 25}