zenith: add nvidia GPU support (#126097)

This commit is contained in:
Ivar 2021-06-09 13:09:54 +02:00 committed by GitHub
parent 9845b1f590
commit 7e84163a5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 2 deletions

View File

@ -1,4 +1,11 @@
{ lib, stdenv, rustPlatform, fetchFromGitHub, IOKit }:
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, IOKit
, nvidiaSupport ? false
, makeWrapper
}:
rustPlatform.buildRustPackage rec {
pname = "zenith";
@ -11,12 +18,20 @@ rustPlatform.buildRustPackage rec {
sha256 = "1bn364rmp0q86rd7vgv4n7x09cdf9m4njcaq92jnk85ni6h147ax";
};
cargoBuildFlags = lib.optionals nvidiaSupport [ "--features" "nvidia" ];
cargoSha256 = "0c2mk2bcz4qjyqmf11yqhnhy4pqxr77b3c1gvr5jfmjshx4ff7v2";
nativeBuildInputs = lib.optional nvidiaSupport makeWrapper;
buildInputs = lib.optionals stdenv.isDarwin [ IOKit ];
postInstall = lib.optionalString nvidiaSupport ''
wrapProgram $out/bin/zenith \
--suffix LD_LIBRARY_PATH : "/run/opengl-driver/lib"
'';
meta = with lib; {
description = "Sort of like top or htop but with zoom-able charts, network, and disk usage";
description = "Sort of like top or htop but with zoom-able charts, network, and disk usage"
+ lib.optionalString nvidiaSupport ", and NVIDIA GPU usage";
homepage = "https://github.com/bvaisvil/zenith";
license = licenses.mit;
maintainers = with maintainers; [ bbigras ];

View File

@ -10115,6 +10115,13 @@ in
inherit (darwin.apple_sdk.frameworks) IOKit;
};
# Nvidia support does not require any propietary libraries, so CI can build it.
# Note that when enabling this unconditionally, non-nvidia users will always have an empty "GPU" section.
zenith-nvidia = callPackage ../tools/system/zenith {
inherit (darwin.apple_sdk.frameworks) IOKit;
nvidiaSupport = true;
};
zerotierone = callPackage ../tools/networking/zerotierone { };
zerofree = callPackage ../tools/filesystems/zerofree { };