about summary refs log tree commit diff
path: root/pkgs/tools/networking/ntopng/default.nix
blob: 134c6f657547ed75c0c599129182be001e09a2dc (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
{
  lib,
  stdenv,
  autoreconfHook,
  curl,
  expat,
  fetchFromGitHub,
  fetchpatch,
  git,
  json_c,
  libcap,
  libmaxminddb,
  libmysqlclient,
  libpcap,
  libsodium,
  ndpi,
  net-snmp,
  openssl,
  pkg-config,
  rdkafka,
  gtest,
  rrdtool,
  hiredis,
  sqlite,
  which,
  zeromq,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "ntopng";
  version = "6.2";

  src = fetchFromGitHub {
    owner = "ntop";
    repo = "ntopng";
    rev = "refs/tags/${finalAttrs.version}";
    hash = "sha256-8PG18mOV/6EcBpKt9kLyI40OLDnpnc2b4IUu9JbK/Co=";
    fetchSubmodules = true;
  };

  preConfigure = ''
    substituteInPlace Makefile.in \
      --replace "/bin/rm" "rm"
  '';

  nativeBuildInputs = [
    autoreconfHook
    git
    pkg-config
    which
  ];

  buildInputs = [
    curl
    expat
    json_c
    libcap
    libmaxminddb
    libmysqlclient
    libpcap
    gtest
    hiredis
    libsodium
    net-snmp
    openssl
    rdkafka
    rrdtool
    sqlite
    zeromq
  ];

  autoreconfPhase = "bash autogen.sh";

  configureFlags = [
    "--with-ndpi-includes=${ndpi}/include/ndpi"
    "--with-ndpi-static-lib=${ndpi}/lib/"
  ];

  preBuild = ''
    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
  '';

  enableParallelBuilding = true;

  meta = with lib; {
    description = "High-speed web-based traffic analysis and flow collection tool";
    homepage = "https://www.ntop.org/products/traffic-analysis/ntop/";
    changelog = "https://github.com/ntop/ntopng/blob/${finalAttrs.version}/CHANGELOG.md";
    license = licenses.gpl3Plus;
    platforms = platforms.linux ++ platforms.darwin;
    maintainers = with maintainers; [ bjornfor ];
    mainProgram = "ntopng";
  };
})