about summary refs log tree commit diff
path: root/pkgs/tools/networking/ntopng/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/networking/ntopng/default.nix')
-rw-r--r--pkgs/tools/networking/ntopng/default.nix60
1 files changed, 22 insertions, 38 deletions
diff --git a/pkgs/tools/networking/ntopng/default.nix b/pkgs/tools/networking/ntopng/default.nix
index 46dd586c0fa18..652ad4e288670 100644
--- a/pkgs/tools/networking/ntopng/default.nix
+++ b/pkgs/tools/networking/ntopng/default.nix
@@ -1,62 +1,46 @@
-{ lib, stdenv, fetchurl, libpcap,/* gnutls, libgcrypt,*/ libxml2, glib
-, geoip, geolite-legacy, sqlite, which, autoreconfHook, git
-, pkg-config, groff, curl, json_c, luajit, zeromq, rrdtool
+{ lib, stdenv, fetchFromGitHub, fetchpatch, pkg-config, bash, autoreconfHook
+, zeromq, ndpi, json_c, openssl, libpcap, libcap, curl, libmaxminddb
+, rrdtool, sqlite, libmysqlclient, expat, net-snmp
 }:
 
-# ntopng includes LuaJIT, mongoose, rrdtool and zeromq in its third-party/
-# directory, but we use luajit, zeromq, and rrdtool from nixpkgs
-
 stdenv.mkDerivation rec {
   pname = "ntopng";
-  version = "2.0";
+  version = "5.2.1";
 
-  src = fetchurl {
-    urls = [
-      "mirror://sourceforge/project/ntop/ntopng/old/ntopng-${version}.tar.gz"
-      "mirror://sourceforge/project/ntop/ntopng/ntopng-${version}.tar.gz"
-    ];
-    sha256 = "0l82ivh05cmmqcvs26r6y69z849d28njipphqzvnakf43ggddgrw";
+  src = fetchFromGitHub {
+    owner = "ntop";
+    repo = "ntopng";
+    rev = version;
+    sha256 = "sha256-FeRERSq8F3HEelUCkA6pgNNcP94xrWy6EbJgk+cEdqc=";
   };
 
   patches = [
-    ./0001-Undo-weird-modification-of-data_dir.patch
-    ./0002-Remove-requirement-to-have-writeable-callback-dir.patch
-    ./0003-New-libpcap-defines-SOCKET.patch
+    (fetchpatch {
+      url = "https://github.com/ntop/ntopng/commit/0aa580e1a45f248fffe6d11729ce40571f08e187.patch";
+      sha256 = "sha256-xqEVwfGgkNS+akbJnLZsVvEQdp9GxxUen8VkFomtcPI=";
+    })
   ];
 
-  buildInputs = [ libpcap/* gnutls libgcrypt*/ libxml2 glib geoip geolite-legacy
-    sqlite which autoreconfHook git pkg-config groff curl json_c luajit zeromq
-    rrdtool ];
+  nativeBuildInputs = [ bash autoreconfHook pkg-config ];
 
+  buildInputs = [
+    zeromq ndpi json_c openssl libpcap curl libmaxminddb rrdtool sqlite
+    libmysqlclient expat net-snmp libcap
+  ];
 
-  autoreconfPhase = ''
-    substituteInPlace autogen.sh --replace "/bin/rm" "rm"
-    substituteInPlace nDPI/autogen.sh --replace "/bin/rm" "rm"
-    $shell autogen.sh
-  '';
+  autoreconfPhase = "bash autogen.sh";
 
   preConfigure = ''
     substituteInPlace Makefile.in --replace "/bin/rm" "rm"
   '';
 
   preBuild = ''
-    substituteInPlace src/Ntop.cpp --replace "/usr/local" "$out"
-
-    sed -e "s|\(#define CONST_DEFAULT_DATA_DIR\).*|\1 \"/var/lib/ntopng\"|g" \
-        -e "s|\(#define CONST_DEFAULT_DOCS_DIR\).*|\1 \"$out/share/ntopng/httpdocs\"|g" \
-        -e "s|\(#define CONST_DEFAULT_SCRIPTS_DIR\).*|\1 \"$out/share/ntopng/scripts\"|g" \
-        -e "s|\(#define CONST_DEFAULT_CALLBACKS_DIR\).*|\1 \"$out/share/ntopng/scripts/callbacks\"|g" \
-        -e "s|\(#define CONST_DEFAULT_INSTALL_DIR\).*|\1 \"$out/share/ntopng\"|g" \
+    sed -e "s|\(#define CONST_BIN_DIR \).*|\1\"$out/bin\"|g" \
+        -e "s|\(#define CONST_SHARE_DIR \).*|\1\"$out/share\"|g" \
         -i include/ntop_defines.h
-
-    rm -rf httpdocs/geoip
-    ln -s ${geolite-legacy}/share/GeoIP httpdocs/geoip
-  '' + lib.optionalString stdenv.isDarwin ''
-    sed 's|LIBS += -lstdc++.6||' -i Makefile
   '';
 
-  NIX_CFLAGS_COMPILE = "-fpermissive"
-    + lib.optionalString stdenv.cc.isClang " -Wno-error=reserved-user-defined-literal";
+  enableParallelBuilding = true;
 
   meta = with lib; {
     description = "High-speed web-based traffic analysis and flow collection tool";