nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 python3Packages,
5 testers,
6 zabbix-cli,
7}:
8
9python3Packages.buildPythonApplication rec {
10 pname = "zabbix-cli";
11 version = "3.5.2";
12 pyproject = true;
13
14 src = fetchFromGitHub {
15 owner = "unioslo";
16 repo = "zabbix-cli";
17 tag = version;
18 hash = "sha256-Sgt3kVbyzNJCSVUYErHNOrgc7Jd3tIwYhwOESRPeAyw=";
19 };
20
21 build-system = with python3Packages; [
22 hatchling
23 ];
24
25 dependencies =
26 with python3Packages;
27 [
28 httpx
29 httpx.optional-dependencies.socks
30 packaging
31 platformdirs
32 prompt-toolkit
33 pydantic
34 requests
35 rich
36 strenum
37 tomli
38 tomli-w
39 typer
40 typing-extensions
41 ]
42 ++ lib.optionals (pythonOlder "3.10") [
43 importlib-metadata
44 ];
45
46 nativeCheckInputs = with python3Packages; [
47 freezegun
48 inline-snapshot
49 pytestCheckHook
50 pytest-httpserver
51 ];
52
53 # Otherwise tests will fail to create directory
54 # Permission denied: '/homeless-shelter'
55 preCheck = ''
56 export HOME=$(mktemp -d)
57 '';
58
59 pythonImportsCheck = [ "zabbix_cli" ];
60
61 passthru.tests.version = testers.testVersion {
62 package = zabbix-cli;
63 command = "HOME=$(mktemp -d) zabbix-cli --version";
64 };
65
66 meta = {
67 description = "Command-line interface for Zabbix";
68 homepage = "https://github.com/unioslo/zabbix-cli";
69 license = lib.licenses.gpl3Plus;
70 mainProgram = "zabbix-cli";
71 maintainers = [ lib.maintainers.anthonyroussel ];
72 };
73}