Skip to content

Commit 190e1d4

Browse files
authored
htop-vim: fix build by not depending in htop derivation (#389674)
2 parents 092fc3b + cce88d6 commit 190e1d4

File tree

3 files changed

+82
-27
lines changed

3 files changed

+82
-27
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
lib,
3+
fetchFromGitHub,
4+
fetchpatch2,
5+
stdenv,
6+
autoreconfHook,
7+
pkg-config,
8+
ncurses,
9+
darwin,
10+
libcap,
11+
libnl,
12+
sensorsSupport ? stdenv.hostPlatform.isLinux,
13+
lm_sensors,
14+
systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd,
15+
systemd,
16+
}:
17+
18+
assert systemdSupport -> stdenv.hostPlatform.isLinux;
19+
20+
stdenv.mkDerivation rec {
21+
pname = "htop-vim";
22+
version = "unstable-2023-02-16";
23+
24+
src = fetchFromGitHub {
25+
owner = "KoffeinFlummi";
26+
repo = pname;
27+
rev = "b2b58f8f152343b70c33b79ba51a298024278621";
28+
hash = "sha256-ZfdBAlnjoy8g6xwrR/i2+dGldMOfLlX6DRlNqB8pkGM=";
29+
};
30+
31+
patches = [
32+
# See https://github.com/htop-dev/htop/pull/1412
33+
# Remove when updating to 3.4.0
34+
(fetchpatch2 {
35+
name = "htop-resolve-configuration-path.patch";
36+
url = "https://github.com/htop-dev/htop/commit/0dac8e7d38ec3aeae901a987717b5177986197e4.patch";
37+
hash = "sha256-Er1d/yV1fioYfEmXNlLO5ayAyXkyy+IaGSx1KWXvlv0=";
38+
})
39+
];
40+
41+
nativeBuildInputs = [ autoreconfHook ] ++ lib.optional stdenv.hostPlatform.isLinux pkg-config;
42+
43+
buildInputs =
44+
[ ncurses ]
45+
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.IOKit ]
46+
++ lib.optionals stdenv.hostPlatform.isLinux [
47+
libcap
48+
libnl
49+
]
50+
++ lib.optional sensorsSupport lm_sensors
51+
++ lib.optional systemdSupport systemd;
52+
53+
configureFlags =
54+
[
55+
"--enable-unicode"
56+
"--sysconfdir=/etc"
57+
]
58+
++ lib.optionals stdenv.hostPlatform.isLinux [
59+
"--enable-affinity"
60+
"--enable-capabilities"
61+
"--enable-delayacct"
62+
]
63+
++ lib.optional sensorsSupport "--enable-sensors";
64+
65+
postFixup =
66+
let
67+
optionalPatch = pred: so: lib.optionalString pred "patchelf --add-needed ${so} $out/bin/htop";
68+
in
69+
lib.optionalString (!stdenv.hostPlatform.isStatic) ''
70+
${optionalPatch sensorsSupport "${lib.getLib lm_sensors}/lib/libsensors.so"}
71+
${optionalPatch systemdSupport "${systemd}/lib/libsystemd.so"}
72+
'';
73+
74+
meta = with lib; {
75+
description = "Interactive process viewer, with vim-style keybindings";
76+
homepage = "https://github.com/KoffeinFlummi/htop-vim";
77+
license = licenses.gpl2Only;
78+
platforms = platforms.all;
79+
maintainers = with maintainers; [ thiagokokada ];
80+
mainProgram = "htop";
81+
};
82+
}

pkgs/tools/system/htop/htop-vim.nix

Lines changed: 0 additions & 25 deletions
This file was deleted.

pkgs/top-level/all-packages.nix

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11937,8 +11937,6 @@ with pkgs;
1193711937
inherit (darwin) IOKit;
1193811938
};
1193911939

11940-
htop-vim = callPackage ../tools/system/htop/htop-vim.nix { };
11941-
1194211940
humility = callPackage ../development/tools/rust/humility {
1194311941
inherit (darwin.apple_sdk.frameworks) AppKit;
1194411942
};

0 commit comments

Comments
 (0)