diff --git a/pkgs/development/python-modules/disnake/default.nix b/pkgs/development/python-modules/disnake/default.nix new file mode 100644 index 000000000000..6aa8bfc4d851 --- /dev/null +++ b/pkgs/development/python-modules/disnake/default.nix @@ -0,0 +1,68 @@ +{ + lib, + setuptools, + aiohttp, + buildPythonPackage, + fetchFromGitHub, + libopus, + pynacl, + pythonOlder, + withVoice ? true, + ffmpeg, +}: + +buildPythonPackage rec { + pname = "disnake"; + version = "2.10.1"; + pyproject = true; + + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "DisnakeDev"; + repo = "disnake"; + tag = "v${version}"; + hash = "sha256-MQxYkUA3uclmY2cKBr4DsBg79ovsH1EsMOjiVPGaLVE="; + }; + + build-system = [ setuptools ]; + + dependencies = + [ + aiohttp + ] + ++ lib.optionals withVoice [ + libopus + pynacl + ffmpeg + ]; + + postPatch = lib.optionalString withVoice '' + substituteInPlace "disnake/opus.py" \ + --replace-fail 'ctypes.util.find_library("opus")' "'${libopus}/lib/libopus.so.0'" + substituteInPlace "disnake/player.py" \ + --replace-fail 'executable: str = "ffmpeg"' 'executable: str="${ffmpeg}/bin/ffmpeg"' + ''; + + # Only have integration tests with discord + doCheck = false; + + pythonImportsCheck = [ + "disnake" + "disnake.file" + "disnake.member" + "disnake.user" + "disnake.state" + "disnake.guild" + "disnake.webhook" + "disnake.ext.commands.bot" + ]; + + meta = { + description = "API wrapper for Discord written in Python"; + homepage = "https://disnake.dev/"; + changelog = "https://github.com/DisnakeDev/disnake/blob/v${version}/docs/whats_new.rst"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ infinidoge ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2dcf414795ba..6955244ed897 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3307,6 +3307,8 @@ self: super: with self; { diskcache = callPackage ../development/python-modules/diskcache { }; + disnake = callPackage ../development/python-modules/disnake { }; + dissect = callPackage ../development/python-modules/dissect { }; dissect-archive = callPackage ../development/python-modules/dissect-archive { };