1{
2 lib,
3 stdenv,
4 fetchurl,
5 openssl,
6 fetchpatch,
7 lksctp-tools,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "iperf";
12 version = "3.19.1";
13
14 src = fetchurl {
15 url = "https://downloads.es.net/pub/iperf/iperf-${version}.tar.gz";
16 hash = "sha256-3GP4nsWB6pn4tVjY6zUQneBjgwENtaGQbCCKViugwnA=";
17 };
18
19 buildInputs = [ openssl ] ++ lib.optionals stdenv.hostPlatform.isLinux [ lksctp-tools ];
20 configureFlags = [ "--with-openssl=${openssl.dev}" ];
21
22 outputs = [
23 "out"
24 "man"
25 ];
26
27 patches = lib.optionals stdenv.hostPlatform.isMusl [
28 (fetchpatch {
29 url = "https://git.alpinelinux.org/aports/plain/main/iperf3/remove-pg-flags.patch?id=7f979fc51ae31d5c695d8481ba84a4afc5080efb";
30 name = "remove-pg-flags.patch";
31 sha256 = "0z3zsmf7ln08rg1mmzl8s8jm5gp8x62f5cxiqcmi8dcs2nsxwgbi";
32 })
33 ];
34
35 postInstall = ''
36 ln -s $out/bin/iperf3 $out/bin/iperf
37 ln -s $man/share/man/man1/iperf3.1 $man/share/man/man1/iperf.1
38 '';
39
40 meta = {
41 homepage = "https://software.es.net/iperf/";
42 description = "Tool to measure IP bandwidth using UDP or TCP";
43 platforms = lib.platforms.unix;
44 license = lib.licenses.bsd3;
45 mainProgram = "iperf3";
46 maintainers = with lib.maintainers; [ fpletz ];
47 };
48}