about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/compactor/default.nix
blob: 12e6f432c5bdc22bbf8b30e3e6a24e299b339425 (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
{ lib, stdenv, fetchFromGitHub
, asciidoctor, autoreconfHook, pkg-config
, boost, libctemplate, libmaxminddb, libpcap, libtins, openssl, protobuf, xz, zlib, catch2
, cbor-diag, cddl, diffutils, file, mktemp, netcat, tcpdump, wireshark-cli
}:

stdenv.mkDerivation rec {
  pname = "compactor";
  version = "1.2.3";

  src = fetchFromGitHub {
    owner = "dns-stats";
    repo = "compactor";
    rev = version;
    fetchSubmodules = true;
    hash = "sha256-5Z14suhO5ghhmZsSj4DsSoKm+ct2gQFO6qxhjmx4Xm4=";
  };

  patches = [
    ./patches/add-a-space-after-type-in-check-response-opt-sh.patch
  ];

  nativeBuildInputs = [
    asciidoctor
    autoreconfHook
    pkg-config
  ];
  buildInputs = [
    boost
    libctemplate
    libmaxminddb
    libpcap
    libtins
    openssl
    protobuf
    xz
    zlib
  ];

  postPatch = ''
    patchShebangs test-scripts/
    cp ${catch2}/include/catch2/catch.hpp tests/catch.hpp
  '';

  preConfigure = ''
    substituteInPlace configure \
      --replace "/usr/bin/file" "${file}/bin/file"
  '';

  configureFlags = [
    "--with-boost-libdir=${boost.out}/lib"
    "--with-boost=${boost.dev}"
  ];
  enableParallelBuilding = true;

  doCheck = !stdenv.isDarwin; # check-dnstap.sh failing on Darwin
  nativeCheckInputs = [
    cbor-diag
    cddl
    diffutils
    file
    mktemp
    netcat
    tcpdump
    wireshark-cli
  ];

  meta = with lib; {
    description = "Tools to capture DNS traffic and record it in C-DNS files";
    homepage    = "https://dns-stats.org/";
    changelog   = "https://github.com/dns-stats/compactor/raw/${version}/ChangeLog.txt";
    license     = licenses.mpl20;
    maintainers = with maintainers; [ fdns ];
    platforms   = platforms.unix;
  };
}