1{
2 lib,
3 buildPythonPackage,
4 distro,
5 fetchFromGitHub,
6 pyasyncore,
7 pysnmp,
8 pysnmplib,
9 pytestCheckHook,
10 python-gnupg,
11 pythonAtLeast,
12 pythonOlder,
13 qrcode,
14 requests,
15 setuptools,
16}:
17
18buildPythonPackage rec {
19 pname = "blocksat-cli";
20 version = "2.5.1";
21 pyproject = true;
22
23 disabled = pythonOlder "3.8";
24
25 src = fetchFromGitHub {
26 owner = "Blockstream";
27 repo = "satellite";
28 tag = "v${version}";
29 hash = "sha256-SH1MZx/ZkhhWhxhREqFCGoob58J2XMZSpe+q7UgiyF4=";
30 };
31
32 # Upstream setup.py installs both the CLI and GUI versions.
33 # To pull only the required dependencyes, either setup_cli.py or setup_gui.py should be used.
34 postPatch = ''
35 mv setup_cli.py setup.py
36 '';
37
38 pythonRelaxDeps = [ "pyasyncore" ];
39
40 build-system = [ setuptools ];
41
42 dependencies = [
43 distro
44 pysnmp
45 pysnmplib
46 python-gnupg
47 qrcode
48 requests
49 ]
50 ++ lib.optionals (pythonAtLeast "3.12") [ pyasyncore ];
51
52 nativeCheckInputs = [ pytestCheckHook ];
53
54 disabledTests = [
55 "test_monitor_get_stats"
56 "test_monitor_update_with_reporting_enabled"
57 "test_erasure_recovery"
58 # Non-NixOS package managers are not present in the build environment.
59 "test_parse_upgradable_list_apt"
60 "test_parse_upgradable_list_dnf"
61 # Fails due to GPG clearsign output lacking trailing newline in some setups.
62 "test_clearsign_verification"
63 ];
64
65 disabledTestPaths = [ "blocksatgui/tests/" ];
66
67 pythonImportsCheck = [ "blocksatcli" ];
68
69 meta = with lib; {
70 description = "Blockstream Satellite CLI";
71 homepage = "https://github.com/Blockstream/satellite";
72 changelog = "https://github.com/Blockstream/satellite/releases/tag/${src.tag}";
73 license = licenses.gpl3Only;
74 maintainers = with maintainers; [ prusnak ];
75 mainProgram = "blocksat-cli";
76 };
77}