1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 asciidoctor,
6 autoreconfHook,
7 pkg-config,
8 boost186,
9 libctemplate,
10 libmaxminddb,
11 libpcap,
12 libtins,
13 openssl,
14 protobuf,
15 xz,
16 zlib,
17 catch2,
18 cbor-diag,
19 cddl,
20 diffutils,
21 file,
22 mktemp,
23 netcat,
24 tcpdump,
25 wireshark-cli,
26}:
27
28stdenv.mkDerivation rec {
29 pname = "compactor";
30 version = "1.2.3";
31
32 src = fetchFromGitHub {
33 owner = "dns-stats";
34 repo = "compactor";
35 rev = version;
36 fetchSubmodules = true;
37 hash = "sha256-5Z14suhO5ghhmZsSj4DsSoKm+ct2gQFO6qxhjmx4Xm4=";
38 };
39
40 patches = [
41 ./patches/add-a-space-after-type-in-check-response-opt-sh.patch
42
43 # https://github.com/dns-stats/compactor/pull/91
44 ./patches/update-golden-cbor2diag-output.patch
45 ];
46
47 nativeBuildInputs = [
48 asciidoctor
49 autoreconfHook
50 pkg-config
51 ];
52 buildInputs = [
53 boost186
54 libctemplate
55 libmaxminddb
56 libpcap
57 libtins
58 openssl
59 protobuf
60 xz
61 zlib
62 ];
63
64 postPatch = ''
65 patchShebangs test-scripts/
66 cp ${catch2}/include/catch2/catch.hpp tests/catch.hpp
67 '';
68
69 preConfigure = ''
70 substituteInPlace configure \
71 --replace "/usr/bin/file" "${file}/bin/file"
72 '';
73
74 configureFlags = [
75 "--with-boost-libdir=${boost186.out}/lib"
76 "--with-boost=${boost186.dev}"
77 ];
78 enableParallelBuilding = true;
79 enableParallelInstalling = false; # race conditions when installing
80
81 doCheck = !stdenv.hostPlatform.isDarwin; # check-dnstap.sh failing on Darwin
82 nativeCheckInputs = [
83 cbor-diag
84 cddl
85 diffutils
86 file
87 mktemp
88 netcat
89 tcpdump
90 wireshark-cli
91 ];
92
93 meta = {
94 description = "Tools to capture DNS traffic and record it in C-DNS files";
95 homepage = "https://dns-stats.org/";
96 changelog = "https://github.com/dns-stats/compactor/raw/${version}/ChangeLog.txt";
97 license = lib.licenses.mpl20;
98 maintainers = with lib.maintainers; [ fdns ];
99 platforms = lib.platforms.unix;
100 };
101}