summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/nextcord/default.nix
blob: 2f3345ffc4eb028461c2aec429a6eb767b6b1578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
  lib,
  stdenv,
  buildPythonPackage,
  pythonAtLeast,
  pythonOlder,
  fetchFromGitHub,
  replaceVars,
  ffmpeg,
  libopus,
  aiohttp,
  aiodns,
  audioop-lts,
  brotli,
  orjson,
  poetry-core,
  poetry-dynamic-versioning,
  pynacl,
  typing-extensions,
}:

buildPythonPackage rec {
  pname = "nextcord";
  version = "3.1.1";
  pyproject = true;

  disabled = pythonOlder "3.12";

  src = fetchFromGitHub {
    owner = "nextcord";
    repo = "nextcord";
    tag = "v${version}";
    hash = "sha256-ex6amnB51Jla5ia2HVaMOZsDOEtgJ8RB1eNTLpXNzSY=";
  };

  patches = [
    (replaceVars ./paths.patch {
      ffmpeg = "${ffmpeg}/bin/ffmpeg";
      libopus = "${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}";
    })
  ];

  postPatch = ''
    # disable dynamic versioning
    substituteInPlace pyproject.toml \
      --replace-fail 'version = "0.0.0"' 'version = "${version}"' \
      --replace-fail 'enable = true' 'enable = false'
  '';

  build-system = [
    poetry-core
    poetry-dynamic-versioning
  ];

  dependencies = [
    aiodns
    aiohttp
    brotli
    orjson
    pynacl
    typing-extensions
  ]
  ++ lib.optionals (pythonAtLeast "3.13") [
    audioop-lts
  ];

  # upstream has no tests
  doCheck = false;

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

  meta = {
    changelog = "https://github.com/nextcord/nextcord/blob/${src.tag}/docs/whats_new.rst";
    description = "Python wrapper for the Discord API forked from discord.py";
    homepage = "https://github.com/nextcord/nextcord";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ dotlambda ];
  };
}