Unverified Commit 512130c7 authored by Mario Rodas's avatar Mario Rodas Committed by GitHub
Browse files

Merge pull request #201557 from anthonyroussel/nvtop_fix

nvtop: fix build

Fixes #201340
parents 9b70453b 547f2797
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -6,16 +6,18 @@
, cudatoolkit
, libdrm
, ncurses
, nvtop
, testers
, udev
, addOpenGLRunpath
, amd ? true
, nvidia ? true
, udev
}:

let
  pname-suffix = if amd && nvidia then "" else if amd then "-amd" else "-nvidia";
  nvidia-postFixup = "addOpenGLRunpath $out/bin/nvtop";
  libPath = lib.makeLibraryPath [ libdrm ncurses ];
  libPath = lib.makeLibraryPath [ libdrm ncurses udev ];
  amd-postFixup = ''
    patchelf \
      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
@@ -37,6 +39,7 @@ stdenv.mkDerivation rec {
  cmakeFlags = with lib; [
    "-DCMAKE_BUILD_TYPE=Release"
    "-DBUILD_TESTING=ON"
    "-DUSE_LIBUDEV_OVER_LIBSYSTEMD=ON"
  ] ++ optional nvidia "-DNVML_INCLUDE_DIRS=${cudatoolkit}/include"
  ++ optional nvidia "-DNVML_LIBRARIES=${cudatoolkit}/targets/x86_64-linux/lib/stubs/libnvidia-ml.so"
  ++ optional (!amd) "-DAMDGPU_SUPPORT=OFF"
@@ -54,6 +57,14 @@ stdenv.mkDerivation rec {

  doCheck = true;

  passthru = {
    tests.version = testers.testVersion {
      inherit version;
      package = nvtop;
      command = "nvtop --version";
    };
  };

  meta = with lib; {
    description = "A (h)top like task monitor for AMD, Intel and NVIDIA GPUs";
    longDescription = ''