depot/third_party/nixpkgs/pkgs/tools/system/htop/default.nix
Default email 3cbfd2b52c Project import generated by Copybara.
GitOrigin-RevId: 395879c28386e1abf20c7ecacd45880759548391
2021-12-18 20:06:50 -05:00

52 lines
1.3 KiB
Nix

{ lib, fetchFromGitHub, stdenv, autoreconfHook
, ncurses
, IOKit
, sensorsSupport ? stdenv.isLinux, lm_sensors
, systemdSupport ? stdenv.isLinux, systemd
}:
with lib;
assert systemdSupport -> stdenv.isLinux;
stdenv.mkDerivation rec {
pname = "htop";
version = "3.1.2";
src = fetchFromGitHub {
owner = "htop-dev";
repo = pname;
rev = version;
sha256 = "sha256-RKYS8UYZTVKMR/3DG31eqkG4knPRl8WXsZU/XGmGmAg=";
};
nativeBuildInputs = [ autoreconfHook ];
buildInputs = [ ncurses ]
++ optional stdenv.isDarwin IOKit
++ optional sensorsSupport lm_sensors
++ optional systemdSupport systemd
;
configureFlags = [ "--enable-unicode" "--sysconfdir=/etc" ]
++ optional sensorsSupport "--with-sensors"
;
postFixup =
let
optionalPatch = pred: so: optionalString pred "patchelf --add-needed ${so} $out/bin/htop";
in
''
${optionalPatch sensorsSupport "${lm_sensors}/lib/libsensors.so"}
${optionalPatch systemdSupport "${systemd}/lib/libsystemd.so"}
'';
meta = {
description = "An interactive process viewer for Linux";
homepage = "https://htop.dev";
license = licenses.gpl2Only;
platforms = platforms.all;
maintainers = with maintainers; [ rob relrod ];
changelog = "https://github.com/htop-dev/${pname}/blob/${version}/ChangeLog";
};
}