nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 81 lines 1.8 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pytestCheckHook, 6 hatchling, 7 aiohttp, 8 async-timeout, 9 attrs, 10 multidict, 11 colorlog, 12 pynacl, 13 pytest-cov-stub, 14 pytest-randomly, 15 pytest-asyncio, 16 mock, 17}: 18buildPythonPackage (finalAttrs: { 19 pname = "hikari"; 20 version = "2.5.0"; 21 pyproject = true; 22 23 src = fetchFromGitHub { 24 owner = "hikari-py"; 25 repo = "hikari"; 26 tag = finalAttrs.version; 27 hash = "sha256-dOYaGWxhLefWIhaaIPM80cpYtcB/ywibFBzWDr3hKsw="; 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 async-timeout 62 ]; 63 64 pythonImportsCheck = [ "hikari" ]; 65 66 postPatch = '' 67 substituteInPlace hikari/_about.py \ 68 --replace-fail "__git_sha1__: typing.Final[str] = \"HEAD\"" "__git_sha1__: typing.Final[str] = \"$(cat $src/COMMIT)\"" 69 ''; 70 71 meta = { 72 description = "Discord API wrapper for Python written with asyncio"; 73 homepage = "https://www.hikari-py.dev/"; 74 changelog = "https://github.com/hikari-py/hikari/releases/tag/${finalAttrs.src.tag}"; 75 license = lib.licenses.mit; 76 maintainers = with lib.maintainers; [ 77 tomodachi94 78 sigmanificient 79 ]; 80 }; 81})