25 --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
26 --set-rpath "${lib.makeLibraryPath [ libdrm ncurses udev ]}" \
29 needDrm = (amd || msm || panfrost || panthor);
31 stdenv.mkDerivation (finalAttrs: {
35 src = fetchFromGitHub {
38 rev = finalAttrs.version;
39 hash = "sha256-MkkBY2PR6FZnmRMqv9MWqwPWRgixfkUQW5TWJtHEzwA=";
42 cmakeFlags = with lib.strings; [
43 (cmakeBool "BUILD_TESTING" true)
44 (cmakeBool "USE_LIBUDEV_OVER_LIBSYSTEMD" true)
45 (cmakeBool "AMDGPU_SUPPORT" amd)
46 (cmakeBool "NVIDIA_SUPPORT" nvidia)
47 (cmakeBool "INTEL_SUPPORT" intel)
48 (cmakeBool "APPLE_SUPPORT" apple)
49 (cmakeBool "MSM_SUPPORT" msm)
50 (cmakeBool "PANFROST_SUPPORT" panfrost)
51 (cmakeBool "PANTHOR_SUPPORT" panthor)
52 (cmakeBool "ASCEND_SUPPORT" ascend)
54 nativeBuildInputs = [ cmake gtest ] ++ lib.optional nvidia addDriverRunpath;
56 buildInputs = [ ncurses udev ]
57 ++ lib.optional nvidia cudatoolkit
58 ++ lib.optional needDrm libdrm
61 # this helps cmake to find <drm.h>
62 env.NIX_CFLAGS_COMPILE = lib.optionalString needDrm "-isystem ${lib.getDev libdrm}/include/libdrm";
64 # ordering of fixups is important
65 postFixup = (lib.optionalString needDrm drm-postFixup) + (lib.optionalString nvidia "addDriverRunpath $out/bin/nvtop");
70 tests.version = testers.testVersion {
71 inherit (finalAttrs) version;
72 package = finalAttrs.finalPackage;
73 command = "nvtop --version";
78 description = "(h)top like task monitor for AMD, Adreno, Intel and NVIDIA GPUs";
80 Nvtop stands for Neat Videocard TOP, a (h)top like task monitor for AMD, Adreno, Intel and NVIDIA GPUs.
81 It can handle multiple GPUs and print information about them in a htop familiar way.
83 homepage = "https://github.com/Syllo/nvtop";
84 changelog = "https://github.com/Syllo/nvtop/releases/tag/${finalAttrs.version}";
85 license = licenses.gpl3Only;
86 platforms = platforms.linux;
87 maintainers = with maintainers; [ willibutz gbtb anthonyroussel ];
88 mainProgram = "nvtop";