1{
2 lib,
3 stdenv,
4 makeWrapper,
5 fetchurl,
6 autoPatchelfHook,
7 dbus,
8 fontconfig,
9 freetype,
10 glib,
11 libdrm,
12 libGLU,
13 libglvnd,
14 libICE,
15 libkrb5,
16 libSM,
17 libX11,
18 libxcb,
19 libXi,
20 libxkbcommon,
21 ncurses,
22 wayland,
23 zlib,
24}:
25
26let
27 buildNum = "2024-09-26-1411";
28in
29stdenv.mkDerivation {
30 pname = "rgp";
31 version = "2.3";
32
33 src = fetchurl {
34 url = "https://gpuopen.com/download/radeon-developer-tool-suite/RadeonDeveloperToolSuite-${buildNum}.tgz";
35 hash = "sha256-mgIFDStgat4E+67TaSLrcwgWTu7zLf7Nkn6zBlgeVcQ=";
36 };
37
38 nativeBuildInputs = [
39 makeWrapper
40 autoPatchelfHook
41 ];
42
43 buildInputs = [
44 dbus
45 fontconfig
46 freetype
47 glib
48 libdrm
49 libGLU
50 libglvnd
51 libICE
52 libkrb5
53 libSM
54 libX11
55 libxcb
56 libXi
57 libxkbcommon
58 ncurses
59 wayland
60 zlib
61 ];
62
63 installPhase = ''
64 mkdir -p $out/opt/rgp $out/bin
65 cp -r . $out/opt/rgp/
66
67 chmod +x $out/opt/rgp/scripts/*
68 patchShebangs $out/opt/rgp/scripts
69
70 for prog in RadeonDeveloperPanel RadeonDeveloperService RadeonDeveloperServiceCLI RadeonGPUAnalyzer RadeonGPUProfiler RadeonMemoryVisualizer RadeonRaytracingAnalyzer rga rtda; do
71 # makeWrapper is needed so that executables are started from the opt
72 # directory, where qt.conf and other tools are.
73 # Unset Qt theme, it does not work if the nixos Qt version is different from the packaged one.
74 makeWrapper \
75 $out/opt/rgp/$prog \
76 $out/bin/$prog \
77 --unset QT_QPA_PLATFORMTHEME \
78 --unset QT_STYLE_OVERRIDE \
79 --prefix LD_LIBRARY_PATH : $out/opt/rgp/lib
80 done
81 '';
82
83 meta = with lib; {
84 description = "Tool from AMD that allows for deep inspection of GPU workloads";
85 homepage = "https://gpuopen.com/rgp/";
86 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
87 license = licenses.unfree;
88 platforms = [ "x86_64-linux" ];
89 maintainers = with maintainers; [ Flakebi ];
90 };
91}