1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 gitUpdater,
6 meson,
7 ninja,
8 vala,
9 pkg-config,
10 pantheon,
11 python3,
12 curl,
13 flatpak,
14 gettext,
15 glib,
16 gtk3,
17 json-glib,
18 libwnck,
19 libgee,
20 libgtop,
21 libhandy,
22 sassc,
23 udisks2,
24 wrapGAppsHook3,
25 libX11,
26 libXext,
27 libXNVCtrl,
28}:
29
30stdenv.mkDerivation rec {
31 pname = "monitor";
32 version = "0.17.2";
33
34 src = fetchFromGitHub {
35 owner = "stsdc";
36 repo = "monitor";
37 rev = version;
38 hash = "sha256-Kk3L4hfHon0B6Y6vU7en1UFpg221+EiVCxMX9mvu7pU=";
39 fetchSubmodules = true;
40 };
41
42 nativeBuildInputs = [
43 gettext
44 meson
45 ninja
46 vala
47 pkg-config
48 python3
49 wrapGAppsHook3
50 ];
51
52 buildInputs = [
53 curl
54 flatpak
55 glib
56 gtk3
57 json-glib
58 pantheon.granite
59 pantheon.wingpanel
60 libgee
61 libgtop
62 libhandy
63 libwnck
64 sassc
65 udisks2
66 libX11
67 libXext
68 libXNVCtrl
69 ];
70
71 # Force link against Xext, otherwise build fails with:
72 # ld: /nix/store/...-libXNVCtrl-495.46/lib/libXNVCtrl.a(NVCtrl.o): undefined reference to symbol 'XextAddDisplay'
73 # ld: /nix/store/...-libXext-1.3.4/lib/libXext.so.6: error adding symbols: DSO missing from command line
74 # https://github.com/stsdc/monitor/issues/292
75 NIX_LDFLAGS = "-lXext";
76
77 mesonFlags = [ "-Dindicator-wingpanel=enabled" ];
78
79 postPatch = ''
80 chmod +x meson/post_install.py
81 patchShebangs meson/post_install.py
82
83 # Alternatively, using pkg-config here should just work.
84 substituteInPlace meson.build --replace \
85 "meson.get_compiler('c').find_library('libcurl', dirs: vapidir)" \
86 "meson.get_compiler('c').find_library('libcurl', dirs: '${curl.out}/lib')"
87
88 # Fix build with Vala 0.56.18
89 # https://github.com/elementary/monitor/issues/444
90 for i in $(find src/Resources -type f -name "*.vala"); do
91 substituteInPlace $i --replace-warn "[Compact]" ""
92 done
93 '';
94
95 passthru = {
96 updateScript = gitUpdater {
97 # Upstream frequently tags these to fix CI, which are mostly irrelevant to us.
98 ignoredVersions = "-";
99 };
100 };
101
102 meta = with lib; {
103 description = "Manage processes and monitor system resources";
104 longDescription = ''
105 Manage processes and monitor system resources.
106 To use the wingpanel indicator in this application, see the Pantheon
107 section in the NixOS manual.
108 '';
109 homepage = "https://github.com/stsdc/monitor";
110 maintainers = with maintainers; [ xiorcale ];
111 teams = [ teams.pantheon ];
112 platforms = platforms.linux;
113 license = licenses.gpl3Plus;
114 mainProgram = "com.github.stsdc.monitor";
115 };
116}