2023-02-02 18:25:31 +00:00
|
|
|
{ lib, fetchFromGitHub, stdenv, autoreconfHook, pkg-config
|
2021-08-22 07:53:02 +00:00
|
|
|
, ncurses
|
|
|
|
, IOKit
|
2023-02-02 18:25:31 +00:00
|
|
|
, libcap
|
|
|
|
, libnl
|
2021-08-22 07:53:02 +00:00
|
|
|
, sensorsSupport ? stdenv.isLinux, lm_sensors
|
2023-02-02 18:25:31 +00:00
|
|
|
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
|
2020-09-25 04:45:31 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
assert systemdSupport -> stdenv.isLinux;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "htop";
|
2023-02-16 17:41:37 +00:00
|
|
|
version = "3.2.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "htop-dev";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2023-02-16 17:41:37 +00:00
|
|
|
sha256 = "sha256-OrlNE1A71q4XAauYNfumV1Ev1wBpFIBxPiw7aF++yjM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook ]
|
|
|
|
++ lib.optional stdenv.isLinux pkg-config
|
|
|
|
;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
buildInputs = [ ncurses ]
|
2022-04-27 09:35:20 +00:00
|
|
|
++ lib.optional stdenv.isDarwin IOKit
|
2023-02-02 18:25:31 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [ libcap libnl ]
|
2022-04-27 09:35:20 +00:00
|
|
|
++ lib.optional sensorsSupport lm_sensors
|
|
|
|
++ lib.optional systemdSupport systemd
|
2021-08-22 07:53:02 +00:00
|
|
|
;
|
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
configureFlags = [ "--enable-unicode" "--sysconfdir=/etc" ]
|
2023-02-02 18:25:31 +00:00
|
|
|
++ lib.optionals stdenv.isLinux [
|
|
|
|
"--enable-affinity"
|
|
|
|
"--enable-capabilities"
|
|
|
|
"--enable-delayacct"
|
|
|
|
]
|
2022-04-27 09:35:20 +00:00
|
|
|
++ lib.optional sensorsSupport "--with-sensors"
|
2021-08-22 07:53:02 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
postFixup =
|
|
|
|
let
|
2022-04-27 09:35:20 +00:00
|
|
|
optionalPatch = pred: so: lib.optionalString pred "patchelf --add-needed ${so} $out/bin/htop";
|
2023-01-11 07:51:40 +00:00
|
|
|
in lib.optionalString (!stdenv.hostPlatform.isStatic) ''
|
2021-08-22 07:53:02 +00:00
|
|
|
${optionalPatch sensorsSupport "${lm_sensors}/lib/libsensors.so"}
|
|
|
|
${optionalPatch systemdSupport "${systemd}/lib/libsystemd.so"}
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "An interactive process viewer";
|
2020-10-07 09:15:18 +00:00
|
|
|
homepage = "https://htop.dev";
|
|
|
|
license = licenses.gpl2Only;
|
2021-04-05 15:23:46 +00:00
|
|
|
platforms = platforms.all;
|
2022-04-27 09:35:20 +00:00
|
|
|
maintainers = with maintainers; [ rob relrod SuperSandro2000 ];
|
|
|
|
changelog = "https://github.com/htop-dev/htop/blob/${version}/ChangeLog";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|