1{
2 stdenv,
3 buildPythonApplication,
4 fetchFromGitHub,
5 isPyPy,
6 pythonOlder,
7 lib,
8 defusedxml,
9 packaging,
10 psutil,
11 setuptools,
12 nixosTests,
13 pytestCheckHook,
14 which,
15 podman,
16 selenium,
17 # Optional dependencies:
18 fastapi,
19 jinja2,
20 pysnmp,
21 hddtemp,
22 netifaces2, # IP module
23 uvicorn,
24 requests,
25 prometheus-client,
26}:
27
28buildPythonApplication rec {
29 pname = "glances";
30 version = "4.3.1";
31 pyproject = true;
32
33 disabled = isPyPy || pythonOlder "3.9";
34
35 src = fetchFromGitHub {
36 owner = "nicolargo";
37 repo = "glances";
38 tag = "v${version}";
39 hash = "sha256-KaH2dV9bOtBZkfbIGIgQS8vL39XwSyatSjclcXpeVGM=";
40 };
41
42 build-system = [ setuptools ];
43
44 # On Darwin this package segfaults due to mismatch of pure and impure
45 # CoreFoundation. This issues was solved for binaries but for interpreted
46 # scripts a workaround below is still required.
47 # Relevant: https://github.com/NixOS/nixpkgs/issues/24693
48 makeWrapperArgs = lib.optionals stdenv.hostPlatform.isDarwin [
49 "--set"
50 "DYLD_FRAMEWORK_PATH"
51 "/System/Library/Frameworks"
52 ];
53
54 # some tests fail in darwin sandbox
55 doCheck = !stdenv.hostPlatform.isDarwin;
56
57 dependencies = [
58 defusedxml
59 netifaces2
60 packaging
61 psutil
62 pysnmp
63 fastapi
64 uvicorn
65 requests
66 jinja2
67 which
68 prometheus-client
69 ]
70 ++ lib.optional stdenv.hostPlatform.isLinux hddtemp;
71
72 passthru.tests = {
73 service = nixosTests.glances;
74 };
75
76 nativeCheckInputs = [
77 which
78 pytestCheckHook
79 selenium
80 podman
81 ];
82
83 disabledTestPaths = [
84 # Message: Unable to obtain driver for chrome
85 "tests/test_webui.py"
86 ];
87
88 meta = {
89 homepage = "https://nicolargo.github.io/glances/";
90 description = "Cross-platform curses-based monitoring tool";
91 mainProgram = "glances";
92 changelog = "https://github.com/nicolargo/glances/blob/${src.tag}/NEWS.rst";
93 license = lib.licenses.lgpl3Only;
94 maintainers = with lib.maintainers; [
95 koral
96 ];
97 };
98}