push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,120 @@
{
lib,
stdenv,
fetchFromGitHub,
cmake,
gtest,
cudatoolkit,
libdrm,
ncurses,
testers,
udev,
apple-sdk_12,
addDriverRunpath,
amd ? false,
intel ? false,
msm ? false,
nvidia ? false,
apple ? false,
panfrost ? false,
panthor ? false,
ascend ? false,
v3d ? false,
tpu ? 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 || intel);
in
stdenv.mkDerivation (finalAttrs: {
pname = "nvtop";
version = "3.2.0";
# between generation of multiple update PRs for each package flavor and manual updates I choose manual updates
# nixpkgs-update: no auto update
src = fetchFromGitHub {
owner = "Syllo";
repo = "nvtop";
rev = finalAttrs.version;
hash = "sha256-8iChT55L2NSnHg8tLIry0rgi/4966MffShE0ib+2ywc=";
};
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)
(cmakeBool "V3D_SUPPORT" v3d)
(cmakeBool "TPU_SUPPORT" tpu) # requires libtpuinfo which is not packaged yet
];
nativeBuildInputs = [
cmake
]
++ lib.optionals finalAttrs.doCheck [
gtest
]
++ lib.optional nvidia addDriverRunpath;
buildInputs = [
ncurses
]
++ lib.optional stdenv.hostPlatform.isLinux udev
++ lib.optional stdenv.hostPlatform.isDarwin apple-sdk_12
++ lib.optional nvidia cudatoolkit
++ lib.optional needDrm libdrm;
# this helps cmake to find <drm.h>
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 "addDriverRunpath $out/bin/nvtop");
# https://github.com/Syllo/nvtop/commit/33ec008e26a00227a666ccb11321e9971a50daf8
doCheck = !stdenv.hostPlatform.isDarwin;
passthru = {
tests.version = testers.testVersion {
inherit (finalAttrs) version;
package = finalAttrs.finalPackage;
command = "nvtop --version";
};
};
meta = with lib; {
description = "htop-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 = if apple then platforms.darwin else platforms.linux;
maintainers = with maintainers; [
gbtb
anthonyroussel
moni
];
mainProgram = "nvtop";
};
})

View File

@@ -0,0 +1,40 @@
{ callPackage, stdenv }:
let
# 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"
"apple"
"intel"
"msm"
"nvidia"
"panfrost"
"panthor"
"v3d"
];
# 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 = [
"ascend"
"tpu"
];
defaultSupport = builtins.listToAttrs (
# apple can only build on darwin, and it can't build everything else, and vice versa
map (gpu: {
name = gpu;
value =
(gpu == "apple" && stdenv.buildPlatform.isDarwin && stdenv.hostPlatform == stdenv.buildPlatform)
|| (gpu != "apple" && stdenv.buildPlatform.isLinux);
}) defaultGPUFamilies
);
in
{
full = callPackage ./build-nvtop.nix defaultSupport; # this package supports all default GPU families
}
# additional packages with only one specific GPU family support
// builtins.listToAttrs (
map (gpu: {
name = gpu;
value = (callPackage ./build-nvtop.nix { "${gpu}" = true; });
}) defaultGPUFamilies
)