at master 1.5 kB view raw
1{ 2 lib, 3 stdenv, 4 aiohttp, 5 audioop-lts, 6 buildPythonPackage, 7 fetchFromGitHub, 8 ffmpeg, 9 libopus, 10 pynacl, 11 setuptools, 12 withVoice ? true, 13}: 14 15let 16 pname = "discord.py"; 17 version = "2.6.3"; 18in 19buildPythonPackage { 20 inherit pname version; 21 pyproject = true; 22 23 src = fetchFromGitHub { 24 owner = "Rapptz"; 25 repo = "discord.py"; 26 tag = "v${version}"; 27 hash = "sha256-OEU09pdV2H/RxhvxWNIrg8mPh7yiv6ItKNwvhMKKhco="; 28 }; 29 30 build-system = [ setuptools ]; 31 32 dependencies = [ 33 aiohttp 34 audioop-lts 35 ] 36 ++ lib.optionals withVoice [ pynacl ]; 37 38 patchPhase = lib.optionalString withVoice '' 39 substituteInPlace "discord/opus.py" \ 40 --replace-fail "ctypes.util.find_library('opus')" "'${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}'" 41 42 substituteInPlace "discord/player.py" \ 43 --replace-fail "executable: str = 'ffmpeg'" "executable: str = '${lib.getExe ffmpeg}'" 44 ''; 45 46 # Only have integration tests with discord 47 doCheck = false; 48 49 pythonImportsCheck = [ 50 "discord" 51 "discord.types" 52 "discord.ui" 53 "discord.webhook" 54 "discord.app_commands" 55 "discord.ext.commands" 56 "discord.ext.tasks" 57 ]; 58 59 meta = { 60 description = "Python wrapper for the Discord API"; 61 homepage = "https://discordpy.rtfd.org/"; 62 changelog = "https://github.com/Rapptz/discord.py/blob/v${version}/docs/whats_new.rst"; 63 license = lib.licenses.mit; 64 maintainers = with lib.maintainers; [ getpsyched ]; 65 }; 66}