btrbk: add mainProgram
[NixPkgs.git] / pkgs / by-name / if / iftop / package.nix
blobfdda3245b8b1e477b67db199b5d39939bfbf658b
1 { lib, stdenv, fetchurl, ncurses, libpcap, automake, nixosTests }:
3 stdenv.mkDerivation rec {
4   pname = "iftop";
5   version = "1.0pre4";
7   src = fetchurl {
8     url = "http://ex-parrot.com/pdw/iftop/download/iftop-${version}.tar.gz";
9     sha256 = "15sgkdyijb7vbxpxjavh5qm5nvyii3fqcg9mzvw7fx8s6zmfwczp";
10   };
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.hostPlatform.isLinux "-lgcc_s";
16   preConfigure = ''
17     cp ${automake}/share/automake*/config.{sub,guess} config
18   '';
20   buildInputs = [ncurses libpcap];
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";
28   passthru.tests = { inherit (nixosTests) iftop; };
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     mainProgram = "iftop";
42   };