about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/tracebox/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/networking/tracebox/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/networking/tracebox/default.nix51
1 files changed, 37 insertions, 14 deletions
diff --git a/nixpkgs/pkgs/tools/networking/tracebox/default.nix b/nixpkgs/pkgs/tools/networking/tracebox/default.nix
index 79efc95036d9..33bb443e3710 100644
--- a/nixpkgs/pkgs/tools/networking/tracebox/default.nix
+++ b/nixpkgs/pkgs/tools/networking/tracebox/default.nix
@@ -1,34 +1,57 @@
-{ lib, stdenv, fetchFromGitHub, autoreconfHook, libcrafter, libpcap, lua }:
-
+{ lib
+, stdenv
+, fetchFromGitHub
+, autoreconfHook
+, libpcap
+, lua5_1
+, json_c
+, testers
+, tracebox
+}:
 stdenv.mkDerivation rec {
   pname = "tracebox";
-  version = "0.2";
+  version = "0.4.4";
 
   src = fetchFromGitHub {
     owner = "tracebox";
     repo = "tracebox";
     rev = "v${version}";
-    hash = "sha256-2r503xEF3/F9QQCEaSnd4Hw/RbbAhVj9C0SVZepVrT8=";
+    hash = "sha256-1KBJ4uXa1XpzEw23IjndZg+aGJXk3PVw8LYKAvxbxCA=";
+    fetchSubmodules = true;
   };
 
   nativeBuildInputs = [ autoreconfHook ];
-  buildInputs = [ libcrafter lua ];
+  buildInputs = [
+    libpcap
+    lua5_1
+    json_c
+  ];
 
-  configureFlags = [ "--with-lua=yes" ];
+  postPatch = ''
+    sed -i configure.ac \
+      -e 's,$(git describe .*),${version},'
+  '';
 
-  NIX_LDFLAGS = "${libpcap}/lib/libpcap.so ${libcrafter}/lib/libcrafter.so";
+  configureFlags = [
+    "--with-lua=yes"
+    "--with-libpcap=yes"
+  ];
 
-  preAutoreconf = ''
-    substituteInPlace Makefile.am --replace "noinst" ""
-    sed '/noinst/d' -i configure.ac
-    sed '/libcrafter/d' -i src/tracebox/Makefile.am
-  '';
+  PCAPLIB="-lpcap";
+  LUA_LIB="-llua";
+
+  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 = lib.licenses.gpl2;
-    maintainers = [ ];
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ ck3d ];
     platforms = platforms.linux;
   };
 }