1{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, pkg-config, ncurses, libconfuse
2, libnl }:
3
4stdenv.mkDerivation rec {
5 pname = "bmon";
6 version = "4.0";
7
8 src = fetchFromGitHub {
9 owner = "tgraf";
10 repo = "bmon";
11 rev = "v${version}";
12 sha256 = "1ilba872c09mnlvylslv4hqv6c9cz36l76q74rr99jvis1dg69gf";
13 };
14
15 # The source code defines `__unused__`, which is a reserved name
16 # https://github.com/tgraf/bmon/issues/89
17 patches = [
18 (fetchpatch {
19 url = "https://github.com/macports/macports-ports/raw/6d1dd5e9c8fae608bd22f3ede21e576f29c6358c/net/bmon/files/patch-fix__unused.diff";
20 extraPrefix = "";
21 sha256 = "sha256-UYIiJZzipsx9a0xabrKfyj8TWNW7IM77oXnVnSPkQkc=";
22 })
23 ];
24
25 nativeBuildInputs = [ autoreconfHook pkg-config ];
26
27 buildInputs = [ ncurses libconfuse ] ++ lib.optional stdenv.isLinux libnl;
28
29 preConfigure = ''
30 # Must be an absolute path
31 export PKG_CONFIG="$(command -v "$PKG_CONFIG")"
32 '';
33
34 meta = with lib; {
35 description = "Network bandwidth monitor";
36 homepage = "https://github.com/tgraf/bmon";
37 # Licensed unter BSD and MIT
38 # - https://github.com/tgraf/bmon/blob/master/LICENSE.BSD
39 # - https://github.com/tgraf/bmon/blob/master/LICENSE.MIT
40 license = licenses.bsd2;
41 platforms = platforms.unix;
42 maintainers = with maintainers; [ bjornfor pSub ];
43 mainProgram = "bmon";
44 };
45}