1{
2 lib,
3 stdenv,
4 autoreconfHook,
5 fetchFromGitHub,
6 fetchpatch,
7 ldns,
8 libck,
9 nghttp2,
10 openssl,
11 pkg-config,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "dnsperf";
16 version = "2.14.0";
17
18 src = fetchFromGitHub {
19 owner = "DNS-OARC";
20 repo = "dnsperf";
21 rev = "v${version}";
22 hash = "sha256-eDDVNFMjj+0wEBe1qO6r4Bai554Sp+EmP86reJ/VXGk=";
23 };
24
25 nativeBuildInputs = [
26 autoreconfHook
27 pkg-config
28 ];
29
30 buildInputs = [
31 ldns # optional for DDNS (but cheap anyway)
32 libck
33 nghttp2
34 openssl
35 ];
36
37 patches = lib.optionals stdenv.hostPlatform.isMusl [
38 # dnsperf doesn't have support for musl (https://github.com/DNS-OARC/dnsperf/issues/265)
39 # and strerror_r returns int on non-glibc: https://github.com/NixOS/nixpkgs/issues/370498
40 # TODO: remove if better non-glibc detection is ever upstreamed
41 (fetchpatch {
42 url = "https://gitlab.alpinelinux.org/alpine/aports/-/raw/5bd92b8f86a0bf15dddf8fa180adf14344d6cc15/testing/dnsperf/musl-perf_strerror_r.patch";
43 hash = "sha256-yTJHXkti/xSklmVfAV45lEsOiHy7oL1phImNTNtcPkM=";
44 })
45 ];
46
47 doCheck = true;
48
49 meta = {
50 description = "Tools for DNS benchmaring";
51 homepage = "https://www.dns-oarc.net/tools/dnsperf";
52 changelog = "https://github.com/DNS-OARC/dnsperf/releases/tag/v${version}";
53 license = lib.licenses.isc;
54 platforms = lib.platforms.unix;
55 mainProgram = "dnsperf";
56 maintainers = with lib.maintainers; [
57 vcunat
58 mfrw
59 ];
60 };
61}