NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.37k stars 14.32k forks source link

Python Package Request: Disnake #178427

Open DJStompZone opened 2 years ago

DJStompZone commented 2 years ago

disnake banner

Project description

Disnake is an intuitive API wrapper for Discord written in Python. See the readme for more detailed info.

Metadata

Platforms:

dotlambda commented 2 years ago

You should be able to copy the expression for nextcord.

DJStompZone commented 2 years ago

You should be able to copy the expression for nextcord.

Well, I've never done one of these before so I'm still a bit fuzzy. Disnake doesn't depend on libopus or ffmpeg, I think the only external dependency is aiohttp. So I mean, would it just be something like... ?

{ lib
, stdenv
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, substituteAll
, aiohttp
, aiodns
, brotli
, cchardet
, orjson
, pynacl
}:

buildPythonPackage rec {
  pname = "disnake";
  version = "2.5.1";

  format = "setuptools";

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "DisnakeDev";
    repo = "disnake";
    rev = version;
    hash = "sha256-e6eb72352b446621d65ff2923792f04a2bb3ad3d1d5ad137082a941e53bf8a53";
  }; # idk if I did this part right, I downloaded the tar.gz for the latest version and did `shasum -a 256`

# Not really sure on this one, do I leave it blank? Delete it?
  patches = [ ];

# Honestly have no idea what this is for exactly
  propagatedBuildInputs = [
    aiodns
    aiohttp
    brotli
    cchardet
    orjson
    pynacl
  ];

  # upstream has no tests
  doCheck = false;

  pythonImportsCheck = [
    "disnake"
    "disnake.ext.commands"
    "disnake.ext.tasks"
  ];

  meta = with lib; {
    description = "Disnake is an intuitive API wrapper for Discord written in Python";
    homepage = "https://github.com/DisnakeDev/disnake";
    license = licenses.mit;
    maintainers = with maintainers; [ djstompzone ];
  };
}
dotlambda commented 2 years ago

Disnake does use Ffmpeg: https://github.com/DisnakeDev/disnake/blob/9b1758d785d3a415775a4cad5bf8a9325ffa9b42/disnake/player.py#L152 Your expression could also specify passthru.optional-dependencies. I suggest you open a PR with what you have and I'll walk you through it. Make sure to ping me in the PR.