1{ lib 2, fetchurl 3, buildPythonPackage 4, pythonOlder 5, withVoice ? true, libopus 6, asyncio 7, aiohttp 8, websockets 9, pynacl 10}: 11 12let 13 pname = "discord.py"; 14 version = "0.16.10"; 15in buildPythonPackage rec { 16 name = "${pname}-${version}"; 17 18 src = fetchurl { 19 url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${name}.tar.gz"; 20 sha256 = "cb0b9ad5f5edf2d5afd5f5ce07381a0a089eb036004938126a5582fc8fa0cc88"; 21 }; 22 23 propagatedBuildInputs = [ asyncio aiohttp websockets pynacl ]; 24 patchPhase = '' 25 substituteInPlace "requirements.txt" \ 26 --replace "aiohttp>=1.0.0,<1.1.0" "aiohttp" 27 '' + lib.optionalString withVoice '' 28 substituteInPlace "discord/opus.py" \ 29 --replace "ctypes.util.find_library('opus')" "'${libopus}/lib/libopus.so.0'" 30 ''; 31 32 disabled = pythonOlder "3.5"; 33 34 meta = { 35 description = "A python wrapper for the Discord API"; 36 homepage = "https://discordpy.rtfd.org/"; 37 license = lib.licenses.mit; 38 }; 39}