about summary refs log tree commit diff
path: root/pkgs/tools/networking/tracebox/default.nix
blob: dce1fc532046999c264f9c197a884e8317d85068 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{ lib
, stdenv
, fetchFromGitHub
, autoreconfHook
, libpcap
, lua5_1
, json_c
, testers
, tracebox
}:
stdenv.mkDerivation rec {
  pname = "tracebox";
  version = "0.4.4";

  src = fetchFromGitHub {
    owner = "tracebox";
    repo = "tracebox";
    rev = "v${version}";
    hash = "sha256-1KBJ4uXa1XpzEw23IjndZg+aGJXk3PVw8LYKAvxbxCA=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [ autoreconfHook ];
  buildInputs = [
    libpcap
    lua5_1
    json_c
  ];

  postPatch = ''
    sed -i configure.ac \
      -e 's,$(git describe .*),${version},'
  '';

  configureFlags = [
    "--with-lua=yes"
    "--with-libpcap=yes"
  ];

  env = {
    CXXFLAGS = "-std=c++14";
    LUA_LIB = "-llua";
    PCAPLIB = "-lpcap";
  };

  enableParallelBuilding = true;

  passthru.tests.version = testers.testVersion {
    package = tracebox;
    command = "tracebox -V";
  };

  meta = with lib; {
    homepage = "http://www.tracebox.org/";
    description = "A middlebox detection tool";
    license = licenses.gpl2;
    maintainers = with maintainers; [ ck3d ];
    platforms = platforms.linux;
  };
}