diff --git a/pkgs/tools/system/zenith/default.nix b/pkgs/tools/system/zenith/default.nix index 8fc9637bfb9..1e36614c427 100644 --- a/pkgs/tools/system/zenith/default.nix +++ b/pkgs/tools/system/zenith/default.nix @@ -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 ]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cbc0e79a3c0..8a563ee0352 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };