Merge pull request #201557 from anthonyroussel/nvtop_fix

nvtop: fix build

Fixes #201340
This commit is contained in:
Mario Rodas 2022-11-18 08:01:38 -05:00 committed by GitHub
commit 512130c735
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 = ''