nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 64 lines 1.4 kB view raw
1{ lib 2, aiohttp 3, buildPythonPackage 4, fetchFromGitHub 5, libopus 6, pynacl 7, pythonOlder 8, withVoice ? true 9, ffmpeg 10}: 11 12buildPythonPackage rec { 13 pname = "discord.py"; 14 version = "1.7.3"; 15 format = "setuptools"; 16 17 disabled = pythonOlder "3.8"; 18 19 src = fetchFromGitHub { 20 owner = "Rapptz"; 21 repo = pname; 22 rev = "v${version}"; 23 sha256 = "sha256-eKXCzGFSzxpdZed4/4G6uJ96s5yCm6ci8K8XYR1zQlE="; 24 }; 25 26 propagatedBuildInputs = [ 27 aiohttp 28 ] ++ lib.optionals withVoice [ 29 libopus 30 pynacl 31 ffmpeg 32 ]; 33 34 patchPhase = '' 35 substituteInPlace "discord/opus.py" \ 36 --replace "ctypes.util.find_library('opus')" "'${libopus}/lib/libopus.so.0'" 37 substituteInPlace requirements.txt \ 38 --replace "aiohttp>=3.6.0,<3.8.0" "aiohttp>=3.6.0,<4" 39 '' + lib.optionalString withVoice '' 40 substituteInPlace "discord/player.py" \ 41 --replace "executable='ffmpeg'" "executable='${ffmpeg}/bin/ffmpeg'" 42 ''; 43 44 # Only have integration tests with discord 45 doCheck = false; 46 47 pythonImportsCheck = [ 48 "discord" 49 "discord.file" 50 "discord.member" 51 "discord.user" 52 "discord.state" 53 "discord.guild" 54 "discord.webhook" 55 "discord.ext.commands.bot" 56 ]; 57 58 meta = with lib; { 59 description = "Python wrapper for the Discord API"; 60 homepage = "https://discordpy.rtfd.org/"; 61 license = licenses.mit; 62 maintainers = with maintainers; [ ivar ]; 63 }; 64}