at master 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 pythonAtLeast, 6 pythonOlder, 7 fetchFromGitHub, 8 replaceVars, 9 ffmpeg, 10 libopus, 11 aiohttp, 12 aiodns, 13 audioop-lts, 14 brotli, 15 orjson, 16 poetry-core, 17 poetry-dynamic-versioning, 18 pynacl, 19 typing-extensions, 20}: 21 22buildPythonPackage rec { 23 pname = "nextcord"; 24 version = "3.1.1"; 25 pyproject = true; 26 27 disabled = pythonOlder "3.12"; 28 29 src = fetchFromGitHub { 30 owner = "nextcord"; 31 repo = "nextcord"; 32 tag = "v${version}"; 33 hash = "sha256-ex6amnB51Jla5ia2HVaMOZsDOEtgJ8RB1eNTLpXNzSY="; 34 }; 35 36 patches = [ 37 (replaceVars ./paths.patch { 38 ffmpeg = "${ffmpeg}/bin/ffmpeg"; 39 libopus = "${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}"; 40 }) 41 ]; 42 43 postPatch = '' 44 # disable dynamic versioning 45 substituteInPlace pyproject.toml \ 46 --replace-fail 'version = "0.0.0"' 'version = "${version}"' \ 47 --replace-fail 'enable = true' 'enable = false' 48 ''; 49 50 build-system = [ 51 poetry-core 52 poetry-dynamic-versioning 53 ]; 54 55 dependencies = [ 56 aiodns 57 aiohttp 58 brotli 59 orjson 60 pynacl 61 typing-extensions 62 ] 63 ++ lib.optionals (pythonAtLeast "3.13") [ 64 audioop-lts 65 ]; 66 67 # upstream has no tests 68 doCheck = false; 69 70 pythonImportsCheck = [ 71 "nextcord" 72 "nextcord.ext.commands" 73 "nextcord.ext.tasks" 74 ]; 75 76 meta = with lib; { 77 changelog = "https://github.com/nextcord/nextcord/blob/${src.tag}/docs/whats_new.rst"; 78 description = "Python wrapper for the Discord API forked from discord.py"; 79 homepage = "https://github.com/nextcord/nextcord"; 80 license = licenses.mit; 81 maintainers = with maintainers; [ dotlambda ]; 82 }; 83}