lol
1{ lib, stdenv, fetchurl, ncurses, libpcap, automake, nixosTests }:
2
3stdenv.mkDerivation rec {
4 pname = "iftop";
5 version = "1.0pre4";
6
7 src = fetchurl {
8 url = "http://ex-parrot.com/pdw/iftop/download/iftop-${version}.tar.gz";
9 sha256 = "15sgkdyijb7vbxpxjavh5qm5nvyii3fqcg9mzvw7fx8s6zmfwczp";
10 };
11
12 # Explicitly link against libgcc_s, to work around the infamous
13 # "libgcc_s.so.1 must be installed for pthread_cancel to work".
14 LDFLAGS = lib.optionalString stdenv.isLinux "-lgcc_s";
15
16 preConfigure = ''
17 cp ${automake}/share/automake*/config.{sub,guess} config
18 '';
19
20 buildInputs = [ncurses libpcap];
21
22 # Workaround build failure on -fno-common toolchains like upstream
23 # gcc-10. Otherwise build fails as:
24 # ld: tui.o:/build/iftop-1.0pre4/ui_common.h:41: multiple definition of `service_hash';
25 # iftop.o:/build/iftop-1.0pre4/ui_common.h:41: first defined here
26 env.NIX_CFLAGS_COMPILE = "-fcommon";
27
28 passthru.tests = { inherit (nixosTests) iftop; };
29
30 meta = with lib; {
31 description = "Display bandwidth usage on a network interface";
32 longDescription = ''
33 iftop does for network usage what top(1) does for CPU usage. It listens
34 to network traffic on a named interface and displays a table of current
35 bandwidth usage by pairs of hosts.
36 '';
37 license = licenses.gpl2Plus;
38 homepage = "http://ex-parrot.com/pdw/iftop/";
39 platforms = platforms.unix;
40 maintainers = [ ];
41 };
42}