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 ] ++ lib.optionals (pythonAtLeast "3.12") [ pyasyncore ];
50
51 nativeCheckInputs = [ pytestCheckHook ];
52
53 disabledTests = [
54 "test_monitor_get_stats"
55 "test_monitor_update_with_reporting_enabled"
56 "test_erasure_recovery"
57 # Non-NixOS package managers are not present in the build environment.
58 "test_parse_upgradable_list_apt"
59 "test_parse_upgradable_list_dnf"
60 ];
61
62 disabledTestPaths = [ "blocksatgui/tests/" ];
63
64 pythonImportsCheck = [ "blocksatcli" ];
65
66 meta = with lib; {
67 description = "Blockstream Satellite CLI";
68 homepage = "https://github.com/Blockstream/satellite";
69 changelog = "https://github.com/Blockstream/satellite/releases/tag/${src.tag}";
70 license = licenses.gpl3Only;
71 maintainers = with maintainers; [ prusnak ];
72 mainProgram = "blocksat-cli";
73 };
74}