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