1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 autoreconfHook,
6 pkg-config,
7 libcap,
8 ncurses,
9 jansson,
10 withGtk ? false,
11 gtk3,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "mtr${lib.optionalString withGtk "-gui"}";
16 version = "0.96";
17
18 src = fetchFromGitHub {
19 owner = "traviscross";
20 repo = "mtr";
21 rev = "v${version}";
22 sha256 = "sha256-Oit0jEm1g+jYCIoTak/mcdlF14GDkDOAWKmX2mYw30M=";
23 };
24
25 # we need this before autoreconfHook does its thing
26 postPatch = ''
27 echo ${version} > .tarball-version
28 '';
29
30 # and this after autoreconfHook has generated Makefile.in
31 preConfigure = ''
32 substituteInPlace Makefile.in \
33 --replace ' install-exec-hook' ""
34 '';
35
36 configureFlags = lib.optional (!withGtk) "--without-gtk";
37
38 nativeBuildInputs = [
39 autoreconfHook
40 pkg-config
41 ];
42
43 buildInputs = [
44 ncurses
45 jansson
46 ]
47 ++ lib.optional withGtk gtk3
48 ++ lib.optional stdenv.hostPlatform.isLinux libcap;
49
50 enableParallelBuilding = true;
51
52 meta = with lib; {
53 description = "Network diagnostics tool";
54 homepage = "https://www.bitwizard.nl/mtr/";
55 license = licenses.gpl2Only;
56 maintainers = with maintainers; [
57 koral
58 orivej
59 raskin
60 globin
61 ryan4yin
62 ];
63 mainProgram = "mtr";
64 platforms = platforms.unix;
65 };
66}