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