summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/am/amdgpu_top/package.nix
blob: 5764e00b78ed1439fdadf6f7e3fe88f88a18e38b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
  lib,
  rustPlatform,
  fetchFromGitHub,
  libdrm,
  libx11,
  libGL,
  wayland,
  wayland-protocols,
  libxkbcommon,
  libxrandr,
  libxi,
  libxcursor,
  nix-update-script,
}:

rustPlatform.buildRustPackage (finalAttrs: {
  pname = "amdgpu_top";
  version = "0.11.5";

  src = fetchFromGitHub {
    owner = "Umio-Yasuno";
    repo = "amdgpu_top";
    tag = "v${finalAttrs.version}";
    hash = "sha256-hOwZHqm5DD4GGirvtYT1HWRp7Y59K1HIDsr9myFleRI=";
  };

  cargoHash = "sha256-Mqy95IflBLXnp6ZYWjZCDrNJWZ2kqd90533sPJ94c2U=";

  buildInputs = [
    libdrm
    libx11
    libGL
    wayland
    wayland-protocols
    libxkbcommon
    libxrandr
    libxi
    libxcursor
  ];

  postInstall = ''
    install -D ./assets/amdgpu_top.desktop -t $out/share/applications/
    install -D ./assets/amdgpu_top-tui.desktop -t $out/share/applications/
  '';

  postFixup = ''
    patchelf --set-rpath "${lib.makeLibraryPath finalAttrs.buildInputs}" $out/bin/${finalAttrs.meta.mainProgram}
  '';

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "Tool to display AMDGPU usage";
    homepage = "https://github.com/Umio-Yasuno/amdgpu_top";
    changelog = "https://github.com/Umio-Yasuno/amdgpu_top/releases";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      geri1701
      Gliczy
    ];
    platforms = lib.platforms.linux;
    mainProgram = "amdgpu_top";
  };
})