summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/pm/pmacct/package.nix
blob: f4e89e4779b039e559b4e1ef4564187229087398 (plain)
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
97
98
99
100
101
102
103
{
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  pkg-config,
  autoreconfHook,
  libtool,
  libpcap,
  libcdada,
  # Optional Dependencies
  withKafka ? true,
  rdkafka,
  withJansson ? true,
  jansson,
  withNflog ? true,
  libnetfilter_log,
  withSQLite ? true,
  sqlite,
  withPgSQL ? true,
  libpq,
  withMysql ? true,
  libmysqlclient,
  zlib,
  numactl,
  gnutlsSupport ? false,
  gnutls,
  testers,
}:

stdenv.mkDerivation (finalAttrs: {
  version = "1.7.9";
  pname = "pmacct";

  src = fetchFromGitHub {
    owner = "pmacct";
    repo = "pmacct";
    rev = "v${finalAttrs.version}";
    hash = "sha256-3gV6GUhTQnH09NRIJQI0xBn05Bgo3AJsE2cSxNPXITo=";
  };

  patches = [
    # Fixes GCC15 compatibility
    # Can be removed with the next release
    # Custom version of https://github.com/pmacct/pmacct/commit/6466578967d3d39c46f7ec10b308bca36568697d.patch
    # without the copyright date changes.
    ./gcc15-compat.patch
  ];

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    libtool
  ];
  buildInputs = [
    libcdada
    libpcap
  ]
  ++ lib.optional withKafka rdkafka
  ++ lib.optional withJansson jansson
  ++ lib.optional withNflog libnetfilter_log
  ++ lib.optional withSQLite sqlite
  ++ lib.optional withPgSQL libpq
  ++ lib.optionals withMysql [
    libmysqlclient
    zlib
    numactl
  ]
  ++ lib.optional gnutlsSupport gnutls;

  env.MYSQL_CONFIG = lib.optionalString withMysql "${lib.getDev libmysqlclient}/bin/mysql_config";

  configureFlags = [
    "--with-pcap-includes=${libpcap}/include"
  ]
  ++ lib.optional withKafka "--enable-kafka"
  ++ lib.optional withJansson "--enable-jansson"
  ++ lib.optional withNflog "--enable-nflog"
  ++ lib.optional withSQLite "--enable-sqlite3"
  ++ lib.optional withPgSQL "--enable-pgsql"
  ++ lib.optional withMysql "--enable-mysql"
  ++ lib.optional gnutlsSupport "--enable-gnutls";

  passthru.tests = {
    version = testers.testVersion {
      package = finalAttrs.finalPackage;
      command = "pmacct -V";
    };
  };

  meta = {
    description = "Small set of multi-purpose passive network monitoring tools";
    longDescription = ''
      pmacct is a small set of multi-purpose passive network monitoring tools
      [NetFlow IPFIX sFlow libpcap BGP BMP RPKI IGP Streaming Telemetry]
    '';
    homepage = "http://www.pmacct.net/";
    changelog = "https://github.com/pmacct/pmacct/blob/v${finalAttrs.version}/ChangeLog";
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ _0x4A6F ];
    platforms = lib.platforms.unix;
  };
})