about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/mtr/default.nix
blob: 59242551f92927e8cb6c7bc7c9f0ff63d4d07d35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig
, libcap, ncurses
, withGtk ? false, gtk2 ? null }:

assert withGtk -> gtk2 != null;

stdenv.mkDerivation rec {
  pname = "mtr";
  version = "0.93";

  src = fetchFromGitHub {
    owner  = "traviscross";
    repo   = "mtr";
    rev    = "v${version}";
    sha256 = "0n0zr9k61w7a9psnzgp7xnc7ll1ic2xzcvqsbbbyndg3v9rff6bw";
  };

  # we need this before autoreconfHook does its thing
  postPatch = ''
    echo ${version} > .tarball-version
  '';

  # and this after autoreconfHook has generated Makefile.in
  preConfigure = ''
    substituteInPlace Makefile.in \
      --replace ' install-exec-hook' ""
  '';

  configureFlags = stdenv.lib.optional (!withGtk) "--without-gtk";

  nativeBuildInputs = [ autoreconfHook pkgconfig ];

  buildInputs = [ libcap ncurses ] ++ stdenv.lib.optional withGtk gtk2;

  enableParallelBuilding = true;

  meta = with stdenv.lib; {
    description = "A network diagnostics tool";
    homepage    = "https://www.bitwizard.nl/mtr/";
    license     = licenses.gpl2;
    maintainers = with maintainers; [ koral orivej raskin ];
    platforms   = platforms.unix;
  };
}