at master 2.0 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pytestCheckHook, 6 pythonOlder, 7 hatchling, 8 aiohttp, 9 attrs, 10 multidict, 11 colorlog, 12 pynacl, 13 pytest-cov-stub, 14 pytest-randomly, 15 pytest-asyncio, 16 mock, 17}: 18buildPythonPackage rec { 19 pname = "hikari"; 20 version = "2.4.1"; 21 pyproject = true; 22 23 src = fetchFromGitHub { 24 owner = "hikari-py"; 25 repo = "hikari"; 26 tag = version; 27 hash = "sha256-lkJICN5uXFIKUZwxZI82FSYZLWFa7Cb6tDs6wV9DsY0="; 28 # The git commit is part of the `hikari.__git_sha1__` original output; 29 # leave that output the same in nixpkgs. Use the `.git` directory 30 # to retrieve the commit SHA, and remove the directory afterwards, 31 # since it is not needed after that. 32 leaveDotGit = true; 33 postFetch = '' 34 cd "$out" 35 git rev-parse HEAD > $out/COMMIT 36 find "$out" -name .git -print0 | xargs -0 rm -rf 37 ''; 38 }; 39 40 build-system = [ hatchling ]; 41 42 propagatedBuildInputs = [ 43 aiohttp 44 attrs 45 multidict 46 colorlog 47 ]; 48 49 pythonRelaxDeps = true; 50 51 optional-dependencies = { 52 server = [ pynacl ]; 53 }; 54 55 nativeCheckInputs = [ 56 pytestCheckHook 57 pytest-asyncio 58 pytest-cov-stub 59 pytest-randomly 60 mock 61 ]; 62 63 pythonImportsCheck = [ "hikari" ]; 64 65 disabled = pythonOlder "3.7"; 66 67 postPatch = '' 68 substituteInPlace hikari/_about.py \ 69 --replace-fail "__git_sha1__: typing.Final[str] = \"HEAD\"" "__git_sha1__: typing.Final[str] = \"$(cat $src/COMMIT)\"" 70 # XXX: Remove once pytest-asyncio is updated to 0.24+ 71 substituteInPlace pyproject.toml \ 72 --replace-fail "asyncio_default_fixture_loop_scope = \"func\"" "" 73 ''; 74 75 meta = { 76 description = "Discord API wrapper for Python written with asyncio"; 77 homepage = "https://www.hikari-py.dev/"; 78 changelog = "https://github.com/hikari-py/hikari/releases/tag/${src.tag}"; 79 license = lib.licenses.mit; 80 maintainers = with lib.maintainers; [ 81 tomodachi94 82 sigmanificient 83 ]; 84 }; 85}