2022-04-27 09:35:20 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2022-06-16 17:23:12 +00:00
|
|
|
, gtest
|
2022-04-27 09:35:20 +00:00
|
|
|
, cudatoolkit
|
|
|
|
, libdrm
|
|
|
|
, ncurses
|
2022-11-21 17:40:18 +00:00
|
|
|
, nvtop
|
|
|
|
, testers
|
|
|
|
, udev
|
2022-04-27 09:35:20 +00:00
|
|
|
, addOpenGLRunpath
|
|
|
|
, amd ? true
|
2023-10-09 19:29:22 +00:00
|
|
|
, intel ? true
|
|
|
|
, msm ? true
|
2022-04-27 09:35:20 +00:00
|
|
|
, nvidia ? true
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
let
|
|
|
|
nvidia-postFixup = "addOpenGLRunpath $out/bin/nvtop";
|
2022-11-21 17:40:18 +00:00
|
|
|
libPath = lib.makeLibraryPath [ libdrm ncurses udev ];
|
2023-10-09 19:29:22 +00:00
|
|
|
drm-postFixup = ''
|
2022-04-27 09:35:20 +00:00
|
|
|
patchelf \
|
|
|
|
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath "${libPath}" \
|
|
|
|
$out/bin/nvtop
|
|
|
|
'';
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2023-10-09 19:29:22 +00:00
|
|
|
pname = "nvtop";
|
|
|
|
version = "3.0.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Syllo";
|
2020-09-25 04:45:31 +00:00
|
|
|
repo = "nvtop";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = version;
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-SHKdjzbc3ZZfOW2p8RLFRKKBfLnO+Z8/bKVxcdLLqxw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
cmakeFlags = with lib; [
|
2022-06-16 17:23:12 +00:00
|
|
|
"-DBUILD_TESTING=ON"
|
2022-11-21 17:40:18 +00:00
|
|
|
"-DUSE_LIBUDEV_OVER_LIBSYSTEMD=ON"
|
2022-04-27 09:35:20 +00:00
|
|
|
] ++ 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"
|
2023-10-09 19:29:22 +00:00
|
|
|
++ optional (!intel) "-DINTEL_SUPPORT=OFF"
|
|
|
|
++ optional (!msm) "-DMSM_SUPPORT=OFF"
|
2022-04-27 09:35:20 +00:00
|
|
|
++ optional (!nvidia) "-DNVIDIA_SUPPORT=OFF"
|
2023-10-09 19:29:22 +00:00
|
|
|
++ optional (amd || msm) "-DLibdrm_INCLUDE_DIRS=${libdrm}/lib/stubs/libdrm.so.2"
|
2022-04-27 09:35:20 +00:00
|
|
|
;
|
2022-06-16 17:23:12 +00:00
|
|
|
nativeBuildInputs = [ cmake gtest ] ++ lib.optional nvidia addOpenGLRunpath;
|
2022-11-21 17:40:18 +00:00
|
|
|
buildInputs = with lib; [ ncurses udev ]
|
2022-04-27 09:35:20 +00:00
|
|
|
++ optional nvidia cudatoolkit
|
2023-10-09 19:29:22 +00:00
|
|
|
++ optional (amd || msm) libdrm
|
2022-04-27 09:35:20 +00:00
|
|
|
;
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
# ordering of fixups is important
|
2023-10-09 19:29:22 +00:00
|
|
|
postFixup = (lib.optionalString (amd || msm) drm-postFixup) + (lib.optionalString nvidia nvidia-postFixup);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
passthru = {
|
|
|
|
tests.version = testers.testVersion {
|
|
|
|
inherit version;
|
|
|
|
package = nvtop;
|
|
|
|
command = "nvtop --version";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-10-09 19:29:22 +00:00
|
|
|
description = "A (h)top like task monitor for AMD, Adreno, Intel and NVIDIA GPUs";
|
2022-04-27 09:35:20 +00:00
|
|
|
longDescription = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
Nvtop stands for Neat Videocard TOP, a (h)top like task monitor for AMD, Adreno, Intel and NVIDIA GPUs.
|
|
|
|
It can handle multiple GPUs and print information about them in a htop familiar way.
|
2022-06-16 17:23:12 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/Syllo/nvtop";
|
2022-11-21 17:40:18 +00:00
|
|
|
changelog = "https://github.com/Syllo/nvtop/releases/tag/${version}";
|
|
|
|
license = licenses.gpl3Only;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
2022-11-21 17:40:18 +00:00
|
|
|
maintainers = with maintainers; [ willibutz gbtb anthonyroussel ];
|
|
|
|
mainProgram = "nvtop";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|