mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-25 05:23:54 +00:00
Merge pull request #134583 from lovesegfault/htop-features
htop: optionally enable sensors and systemd support on Linux
This commit is contained in:
commit
19c3ab9856
@ -1,7 +1,14 @@
|
||||
{ lib, fetchFromGitHub, stdenv, autoreconfHook
|
||||
, ncurses, IOKit
|
||||
, ncurses
|
||||
, IOKit
|
||||
, sensorsSupport ? stdenv.isLinux, lm_sensors
|
||||
, systemdSupport ? stdenv.isLinux, systemd
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
assert systemdSupport -> stdenv.isLinux;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "htop";
|
||||
version = "3.0.5";
|
||||
@ -15,10 +22,26 @@ stdenv.mkDerivation rec {
|
||||
|
||||
nativeBuildInputs = [ autoreconfHook ];
|
||||
|
||||
buildInputs = [ ncurses
|
||||
] ++ lib.optionals stdenv.isDarwin [ IOKit ];
|
||||
buildInputs = [ ncurses ]
|
||||
++ optional stdenv.isDarwin IOKit
|
||||
++ optional sensorsSupport lm_sensors
|
||||
++ optional systemdSupport systemd
|
||||
;
|
||||
|
||||
meta = with lib; {
|
||||
configureFlags = [ "--enable-unicode" ]
|
||||
++ 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;
|
||||
|
Loading…
Reference in New Issue
Block a user