nixpkgs/pkgs/tools/system/nvtop/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

84 lines
2.3 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, cmake
2022-06-13 14:25:17 +00:00
, gtest
, cudatoolkit
, libdrm
, ncurses
2022-11-16 21:15:16 +00:00
, nvtop
, testers
, udev
, addOpenGLRunpath
, amd ? true
, intel ? true
, msm ? true
, nvidia ? true
}:
2018-07-21 17:04:04 +00:00
let
nvidia-postFixup = "addOpenGLRunpath $out/bin/nvtop";
libPath = lib.makeLibraryPath [ libdrm ncurses udev ];
drm-postFixup = ''
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${libPath}" \
$out/bin/nvtop
'';
in
2018-07-21 17:04:04 +00:00
stdenv.mkDerivation rec {
pname = "nvtop";
version = "3.0.2";
2018-07-21 17:04:04 +00:00
src = fetchFromGitHub {
owner = "Syllo";
repo = "nvtop";
2018-07-21 17:04:04 +00:00
rev = version;
hash = "sha256-SHKdjzbc3ZZfOW2p8RLFRKKBfLnO+Z8/bKVxcdLLqxw=";
2018-07-21 17:04:04 +00:00
};
cmakeFlags = with lib; [
2022-06-13 14:25:17 +00:00
"-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"
++ optional (!intel) "-DINTEL_SUPPORT=OFF"
++ optional (!msm) "-DMSM_SUPPORT=OFF"
++ optional (!nvidia) "-DNVIDIA_SUPPORT=OFF"
++ optional (amd || msm) "-DLibdrm_INCLUDE_DIRS=${libdrm}/lib/stubs/libdrm.so.2"
;
2022-06-13 14:25:17 +00:00
nativeBuildInputs = [ cmake gtest ] ++ lib.optional nvidia addOpenGLRunpath;
2022-11-06 19:43:09 +00:00
buildInputs = with lib; [ ncurses udev ]
++ optional nvidia cudatoolkit
++ optional (amd || msm) libdrm
;
# ordering of fixups is important
postFixup = (lib.optionalString (amd || msm) drm-postFixup) + (lib.optionalString nvidia nvidia-postFixup);
2018-07-21 17:04:04 +00:00
2022-06-13 14:25:17 +00:00
doCheck = true;
2022-11-16 21:15:16 +00:00
passthru = {
tests.version = testers.testVersion {
inherit version;
package = nvtop;
command = "nvtop --version";
};
};
meta = with lib; {
description = "A (h)top like task monitor for AMD, Adreno, Intel and NVIDIA GPUs";
longDescription = ''
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-13 14:25:17 +00:00
'';
homepage = "https://github.com/Syllo/nvtop";
2022-11-06 19:43:09 +00:00
changelog = "https://github.com/Syllo/nvtop/releases/tag/${version}";
license = licenses.gpl3Only;
2018-07-21 17:04:04 +00:00
platforms = platforms.linux;
maintainers = with maintainers; [ willibutz gbtb anthonyroussel ];
mainProgram = "nvtop";
2018-07-21 17:04:04 +00:00
};
}