1{ lib, stdenv, fetchFromGitHub, pkg-config, gettext, makeWrapper
2, ncurses, libdrm, libpciaccess, libxcb }:
3
4stdenv.mkDerivation rec {
5 pname = "radeontop";
6 version = "1.4";
7
8 src = fetchFromGitHub {
9 sha256 = "0kwqddidr45s1blp0h8r8h1dd1p50l516yb6mb4s6zsc827xzgg3";
10 rev = "v${version}";
11 repo = "radeontop";
12 owner = "clbr";
13 };
14
15 buildInputs = [ ncurses libdrm libpciaccess libxcb ];
16 nativeBuildInputs = [ pkg-config gettext makeWrapper ];
17
18 enableParallelBuilding = true;
19
20 patchPhase = ''
21 substituteInPlace getver.sh --replace ver=unknown ver=${version}
22 substituteInPlace Makefile --replace pkg-config "$PKG_CONFIG"
23 '';
24
25 makeFlags = [ "PREFIX=$(out)" ];
26
27 postInstall = ''
28 wrapProgram $out/bin/radeontop \
29 --prefix LD_LIBRARY_PATH : $out/lib
30 '';
31
32 meta = with lib; {
33 description = "Top-like tool for viewing AMD Radeon GPU utilization";
34 longDescription = ''
35 View GPU utilization, both for the total activity percent and individual
36 blocks. Supports R600 and later cards: even Southern Islands should work.
37 Works with both the open drivers and AMD Catalyst. Total GPU utilization
38 is also valid for OpenCL loads; the other blocks are only useful for GL
39 loads. Requires root rights or other permissions to read /dev/mem.
40 '';
41 homepage = "https://github.com/clbr/radeontop";
42 platforms = platforms.linux;
43 license = licenses.gpl3;
44 };
45}