nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 python3Packages,
6 testers,
7 zabbix-cli,
8}:
9
10python3Packages.buildPythonApplication rec {
11 pname = "zabbix-cli";
12 version = "3.6.2";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "unioslo";
17 repo = "zabbix-cli";
18 tag = version;
19 hash = "sha256-Y4IR/le+7X3MYmrVnZMr+Gu59LkCB5UfMJ2s9ovSjLM=";
20 };
21
22 build-system = with python3Packages; [
23 hatchling
24 ];
25
26 dependencies =
27 with python3Packages;
28 [
29 httpx
30 packaging
31 platformdirs
32 prompt-toolkit
33 pydantic
34 requests
35 rich
36 shellingham
37 strenum
38 tomli
39 tomli-w
40 typer
41 typing-extensions
42 ]
43 ++ httpx.optional-dependencies.socks;
44
45 nativeCheckInputs = with python3Packages; [
46 freezegun
47 inline-snapshot
48 pytestCheckHook
49 pytest-httpserver
50 ];
51
52 # Otherwise tests will fail to create directory
53 # Permission denied: '/homeless-shelter'
54 preCheck = ''
55 export HOME=$(mktemp -d)
56 '';
57
58 disabledTests = [
59 # Disable failing test with Click >= v8.2.0
60 "test_patch_get_click_type"
61 ]
62 ++ lib.optionals stdenv.hostPlatform.isDarwin [
63 # Requires network access
64 "test_authenticator_login_with_any"
65 "test_client_auth_method"
66 "test_client_logout"
67 # PermissionError: [Errno 1] Operation not permitted: 'ps'
68 "test_is_headless_map"
69 "test_is_headless_set_false"
70 ];
71
72 pythonImportsCheck = [ "zabbix_cli" ];
73
74 passthru.tests.version = testers.testVersion {
75 package = zabbix-cli;
76 command = "HOME=$(mktemp -d) zabbix-cli --version";
77 };
78
79 meta = {
80 description = "Command-line interface for Zabbix";
81 homepage = "https://github.com/unioslo/zabbix-cli";
82 license = lib.licenses.gpl3Plus;
83 mainProgram = "zabbix-cli";
84 maintainers = [ lib.maintainers.anthonyroussel ];
85 };
86}