From c0d67ddff4dfd46d08a62cf730c04bda5b882481 Mon Sep 17 00:00:00 2001 From: "R. Ryantm" Date: Fri, 23 Feb 2024 22:37:12 +0000 Subject: [PATCH 1/2] nvtop: 3.0.2 -> 3.1.0 --- pkgs/tools/system/nvtop/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/system/nvtop/default.nix b/pkgs/tools/system/nvtop/default.nix index e47291207f08..618bd9c3b2d5 100644 --- a/pkgs/tools/system/nvtop/default.nix +++ b/pkgs/tools/system/nvtop/default.nix @@ -28,13 +28,13 @@ let in stdenv.mkDerivation rec { pname = "nvtop"; - version = "3.0.2"; + version = "3.1.0"; src = fetchFromGitHub { owner = "Syllo"; repo = "nvtop"; rev = version; - hash = "sha256-SHKdjzbc3ZZfOW2p8RLFRKKBfLnO+Z8/bKVxcdLLqxw="; + hash = "sha256-MkkBY2PR6FZnmRMqv9MWqwPWRgixfkUQW5TWJtHEzwA="; }; cmakeFlags = with lib; [ From 7c3a7384184273aec77ba583a81b04b1340a7696 Mon Sep 17 00:00:00 2001 From: gbtb Date: Sun, 25 Feb 2024 16:57:57 +1000 Subject: [PATCH 2/2] nvtop: fixed build with drm, added more arm gpu support --- .../manual/release-notes/rl-2405.section.md | 2 + pkgs/tools/system/nvtop/build-nvtop.nix | 90 ++++++++++++++++++ pkgs/tools/system/nvtop/default.nix | 95 +++---------------- pkgs/top-level/aliases.nix | 5 + pkgs/top-level/all-packages.nix | 26 +---- 5 files changed, 113 insertions(+), 105 deletions(-) create mode 100644 pkgs/tools/system/nvtop/build-nvtop.nix diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md index 48038c2e2e70..adcc5c514646 100644 --- a/nixos/doc/manual/release-notes/rl-2405.section.md +++ b/nixos/doc/manual/release-notes/rl-2405.section.md @@ -105,6 +105,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m - `idris2` was updated to v0.7.0. This version introduces breaking changes. Check out the [changelog](https://github.com/idris-lang/Idris2/blob/v0.7.0/CHANGELOG.md#v070) for details. +- `nvtop` family of packages was reorganized into nested attrset. `nvtop` has been renamed to `nvtopPackages.full`, and all `nvtop-{amd,nvidia,intel,msm}` packages are now named as `nvtopPackages.{amd,nvidia,intel,msm}` + - `neo4j` has been updated to 5, you may want to read the [release notes for Neo4j 5](https://neo4j.com/release-notes/database/neo4j-5/) - `services.neo4j.allowUpgrade` was removed and no longer has any effect. Neo4j 5 supports automatic rolling upgrades. diff --git a/pkgs/tools/system/nvtop/build-nvtop.nix b/pkgs/tools/system/nvtop/build-nvtop.nix new file mode 100644 index 000000000000..a72ab1ce0dfd --- /dev/null +++ b/pkgs/tools/system/nvtop/build-nvtop.nix @@ -0,0 +1,90 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, gtest +, cudatoolkit +, libdrm +, ncurses +, testers +, udev +, addOpenGLRunpath +, amd ? false +, intel ? false +, msm ? false +, nvidia ? false +, apple ? false +, panfrost ? false +, panthor ? false +, ascend ? false +}: + +let + drm-postFixup = '' + patchelf \ + --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ + --set-rpath "${lib.makeLibraryPath [ libdrm ncurses udev ]}" \ + $out/bin/nvtop + ''; + needDrm = (amd || msm || panfrost || panthor); +in +stdenv.mkDerivation (finalAttrs: { + pname = "nvtop"; + version = "3.1.0"; + + src = fetchFromGitHub { + owner = "Syllo"; + repo = "nvtop"; + rev = finalAttrs.version; + hash = "sha256-MkkBY2PR6FZnmRMqv9MWqwPWRgixfkUQW5TWJtHEzwA="; + }; + + cmakeFlags = with lib.strings; [ + (cmakeBool "BUILD_TESTING" true) + (cmakeBool "USE_LIBUDEV_OVER_LIBSYSTEMD" true) + (cmakeBool "AMDGPU_SUPPORT" amd) + (cmakeBool "NVIDIA_SUPPORT" nvidia) + (cmakeBool "INTEL_SUPPORT" intel) + (cmakeBool "APPLE_SUPPORT" apple) + (cmakeBool "MSM_SUPPORT" msm) + (cmakeBool "PANFROST_SUPPORT" panfrost) + (cmakeBool "PANTHOR_SUPPORT" panthor) + (cmakeBool "ASCEND_SUPPORT" ascend) + ]; + nativeBuildInputs = [ cmake gtest ] ++ lib.optional nvidia addOpenGLRunpath; + + buildInputs = with lib; [ ncurses udev ] + ++ optional nvidia cudatoolkit + ++ optional needDrm libdrm + ; + + # this helps cmake to find + env.NIX_CFLAGS_COMPILE = lib.optionalString needDrm "-isystem ${lib.getDev libdrm}/include/libdrm"; + + # ordering of fixups is important + postFixup = (lib.optionalString needDrm drm-postFixup) + (lib.optionalString nvidia "addOpenGLRunpath $out/bin/nvtop"); + + doCheck = true; + + passthru = { + tests.version = testers.testVersion { + inherit (finalAttrs) version; + package = finalAttrs.finalPackage; + 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. + ''; + homepage = "https://github.com/Syllo/nvtop"; + changelog = "https://github.com/Syllo/nvtop/releases/tag/${finalAttrs.version}"; + license = licenses.gpl3Only; + platforms = platforms.linux; + maintainers = with maintainers; [ willibutz gbtb anthonyroussel ]; + mainProgram = "nvtop"; + }; +}) diff --git a/pkgs/tools/system/nvtop/default.nix b/pkgs/tools/system/nvtop/default.nix index 618bd9c3b2d5..f6e679b6ffef 100644 --- a/pkgs/tools/system/nvtop/default.nix +++ b/pkgs/tools/system/nvtop/default.nix @@ -1,83 +1,18 @@ -{ lib -, stdenv -, fetchFromGitHub -, cmake -, gtest -, cudatoolkit -, libdrm -, ncurses -, nvtop -, testers -, udev -, addOpenGLRunpath -, amd ? true -, intel ? true -, msm ? true -, nvidia ? true -}: - +{ callPackage }: 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 - ''; + # this GPU families are supported "by-default" upstream (see https://github.com/Syllo/nvtop/blob/3a69c2d060298cd6f92cb09db944eded98be1c23/CMakeLists.txt#L81) + # coincidentally, these families are also easy to build in nixpkgs at the moment + defaultGPUFamilies = [ "amd" "intel" "msm" "nvidia" "panfrost" "panthor" ]; + # these GPU families are partially supported upstream, they are also tricky to build in nixpkgs + # volunteers with specific hardware needed to build and test these package variants + additionalGPUFamilies = [ "apple" "ascend" ]; + defaultSupport = builtins.listToAttrs (builtins.map (gpu: { name = gpu; value = true; }) defaultGPUFamilies); in -stdenv.mkDerivation rec { - pname = "nvtop"; - version = "3.1.0"; - - src = fetchFromGitHub { - owner = "Syllo"; - repo = "nvtop"; - rev = version; - hash = "sha256-MkkBY2PR6FZnmRMqv9MWqwPWRgixfkUQW5TWJtHEzwA="; - }; - - cmakeFlags = with lib; [ - "-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" - ; - nativeBuildInputs = [ cmake gtest ] ++ lib.optional nvidia addOpenGLRunpath; - 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); - - 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, 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. - ''; - homepage = "https://github.com/Syllo/nvtop"; - changelog = "https://github.com/Syllo/nvtop/releases/tag/${version}"; - license = licenses.gpl3Only; - platforms = platforms.linux; - maintainers = with maintainers; [ willibutz gbtb anthonyroussel ]; - mainProgram = "nvtop"; - }; +{ + full = callPackage ./build-nvtop.nix defaultSupport; #this package supports all default GPU families } +# additional packages with only one specific GPU family support +// builtins.listToAttrs (builtins.map (gpu: { name = gpu; value = (callPackage ./build-nvtop.nix { "${gpu}" = true; }); }) defaultGPUFamilies) + + + diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 4441c11fd289..c5221c9f6391 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -768,6 +768,11 @@ mapAliases ({ noto-fonts-extra = noto-fonts; # Added 2023-04-08 NSPlist = nsplist; # Added 2024-01-05 nvidia-thrust = throw "nvidia-thrust has been removed because the project was deprecated; use cudaPackages.cuda_cccl"; + nvtop = lib.warn "nvtop has been renamed to nvtopPackages.full" nvtopPackages.full; # Added 2024-02-25 + nvtop-amd = lib.warn "nvtop-amd has been renamed to nvtopPackages.amd" nvtopPackages.amd; # Added 2024-02-25 + nvtop-nvidia = lib.warn "nvtop-nvidia has been renamed to nvtopPackages.nvidia" nvtopPackages.nvidia; # Added 2024-02-25 + nvtop-intel = lib.warn "nvtop-intel has been renamed to nvtopPackages.intel" nvtopPackages.intel; # Added 2024-02-25 + nvtop-msm = lib.warn "nvtop-msm has been renamed to nvtopPackages.msm" nvtopPackages.msm; # Added 2024-02-25 ### O ### diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index efd371c771f6..f7dd4c640c4a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24069,31 +24069,7 @@ with pkgs; nvitop = callPackage ../tools/system/nvitop { }; - nvtop = callPackage ../tools/system/nvtop { }; - nvtop-amd = (callPackage ../tools/system/nvtop { - amd = true; - intel = false; - msm = false; - nvidia = false; - }).overrideAttrs { pname = "nvtop-amd"; }; - nvtop-intel = (callPackage ../tools/system/nvtop { - amd = false; - intel = true; - msm = false; - nvidia = false; - }).overrideAttrs { pname = "nvtop-intel"; }; - nvtop-msm = (callPackage ../tools/system/nvtop { - amd = false; - intel = false; - msm = true; - nvidia = false; - }).overrideAttrs { pname = "nvtop-msm"; }; - nvtop-nvidia = (callPackage ../tools/system/nvtop { - amd = false; - intel = false; - msm = false; - nvidia = true; - }).overrideAttrs { pname = "nvtop-nvidia"; }; + nvtopPackages = recurseIntoAttrs (import ../tools/system/nvtop { inherit callPackage; }); ocl-icd = callPackage ../development/libraries/ocl-icd { };