nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pdm-backend,
7 loguru,
8 platformdirs,
9 requests,
10 setuptools,
11 toml,
12 websocket-client,
13 asciimatics,
14 pyperclip,
15 aria2,
16 fastapi,
17 psutil,
18 pytest-xdist,
19 pytestCheckHook,
20 responses,
21 uvicorn,
22
23 withTui ? true,
24}:
25
26buildPythonPackage rec {
27 pname = "aria2p";
28 version = "0.12.1";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "pawamoy";
33 repo = "aria2p";
34 tag = version;
35 hash = "sha256-JEXTCDfFjxI1hooiEQq0KIGGoS2F7fyzOM0GMl+Jr7w=";
36 };
37
38 build-system = [ pdm-backend ];
39
40 dependencies = [
41 loguru
42 platformdirs
43 requests
44 setuptools # for pkg_resources
45 toml
46 websocket-client
47 ]
48 ++ lib.optionals withTui optional-dependencies.tui;
49
50 optional-dependencies = {
51 tui = [
52 asciimatics
53 pyperclip
54 ];
55 };
56
57 preCheck = ''
58 export HOME=$TMPDIR
59 '';
60
61 nativeCheckInputs = [
62 aria2
63 fastapi
64 pytest-xdist
65 pytestCheckHook
66 responses
67 psutil
68 uvicorn
69 ]
70 ++ optional-dependencies.tui;
71
72 disabledTests = [
73 # require a running display server
74 "test_add_downloads_torrents_and_metalinks"
75 "test_add_downloads_uris"
76 # require a running aria2 server
77 "test_cli_autoclear_commands"
78 "test_get_files_method"
79 "test_pause_subcommand"
80 "test_resume_method"
81 ];
82
83 pythonImportsCheck = [ "aria2p" ];
84
85 meta = {
86 homepage = "https://github.com/pawamoy/aria2p";
87 changelog = "https://github.com/pawamoy/aria2p/blob/${src.tag}/CHANGELOG.md";
88 description = "Command-line tool and library to interact with an aria2c daemon process with JSON-RPC";
89 mainProgram = "aria2p";
90 license = lib.licenses.isc;
91 maintainers = with lib.maintainers; [ koral ];
92 badPlatforms = [
93 lib.systems.inspect.patterns.isDarwin
94 ];
95 };
96}