nixpkgs/pkgs/tools/system/htop/default.nix
Philip Taron 127ea2d80e
htop: fix configure.am error with --enable-sensors
Commit 23c81659b5 didn't get the configure flag quite right. According to https://github.com/htop-dev/htop/blob/main/configure.ac#L671, it's `--enable-sensors`, not `--with-sensors`.

I tested this out locally with 

```
programs.htop = {
    enable = true;
    package = pkgs.htop.overrideAttrs (prev: {
      configureFlags = [
        "--enable-unicode"
        "--sysconfdir=/etc"
        "--enable-affinity"
        "--enable-capabilities"
        "--enable-delayacct"
        "--enable-sensors"
      ];
    });
  };
```
2023-08-31 13:40:13 -07:00

61 lines
1.7 KiB
Nix

{ lib, fetchFromGitHub, stdenv, autoreconfHook, pkg-config
, ncurses
, IOKit
, libcap
, libnl
, sensorsSupport ? stdenv.isLinux, lm_sensors
, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, systemd
}:
assert systemdSupport -> stdenv.isLinux;
stdenv.mkDerivation rec {
pname = "htop";
version = "3.2.2";
src = fetchFromGitHub {
owner = "htop-dev";
repo = pname;
rev = version;
sha256 = "sha256-OrlNE1A71q4XAauYNfumV1Ev1wBpFIBxPiw7aF++yjM=";
};
nativeBuildInputs = [ autoreconfHook ]
++ lib.optional stdenv.isLinux pkg-config
;
buildInputs = [ ncurses ]
++ lib.optional stdenv.isDarwin IOKit
++ lib.optionals stdenv.isLinux [ libcap libnl ]
++ lib.optional sensorsSupport lm_sensors
++ lib.optional systemdSupport systemd
;
configureFlags = [ "--enable-unicode" "--sysconfdir=/etc" ]
++ lib.optionals stdenv.isLinux [
"--enable-affinity"
"--enable-capabilities"
"--enable-delayacct"
]
++ lib.optional sensorsSupport "--enable-sensors"
;
postFixup =
let
optionalPatch = pred: so: lib.optionalString pred "patchelf --add-needed ${so} $out/bin/htop";
in lib.optionalString (!stdenv.hostPlatform.isStatic) ''
${optionalPatch sensorsSupport "${lm_sensors}/lib/libsensors.so"}
${optionalPatch systemdSupport "${systemd}/lib/libsystemd.so"}
'';
meta = with lib; {
description = "An interactive process viewer";
homepage = "https://htop.dev";
license = licenses.gpl2Only;
platforms = platforms.all;
maintainers = with maintainers; [ rob relrod SuperSandro2000 ];
changelog = "https://github.com/htop-dev/htop/blob/${version}/ChangeLog";
mainProgram = "htop";
};
}