at 24.11-pre 84 lines 2.4 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, meson 5, ninja 6, pkg-config 7, gettext 8, libxslt 9, docbook_xsl_ns 10, libcap 11, libidn2 12, iproute2 13, apparmorRulesFromClosure 14}: 15 16stdenv.mkDerivation rec { 17 pname = "iputils"; 18 version = "20240117"; 19 20 src = fetchFromGitHub { 21 owner = pname; 22 repo = pname; 23 rev = version; 24 hash = "sha256-sERY8ZKuXiY85cXdNWOm4byiNU7mOVIeA55dgQJHdoE="; 25 }; 26 27 outputs = [ "out" "apparmor" ]; 28 29 # We don't have the required permissions inside the build sandbox: 30 # /build/source/build/ping/ping: socket: Operation not permitted 31 doCheck = false; 32 33 mesonFlags = [ 34 "-DNO_SETCAP_OR_SUID=true" 35 "-Dsystemdunitdir=etc/systemd/system" 36 "-DINSTALL_SYSTEMD_UNITS=true" 37 "-DSKIP_TESTS=${lib.boolToString (!doCheck)}" 38 ] 39 # Disable idn usage w/musl (https://github.com/iputils/iputils/pull/111): 40 ++ lib.optional stdenv.hostPlatform.isMusl "-DUSE_IDN=false"; 41 42 nativeBuildInputs = [ meson ninja pkg-config gettext libxslt.bin docbook_xsl_ns ]; 43 buildInputs = [ libcap ] 44 ++ lib.optional (!stdenv.hostPlatform.isMusl) libidn2; 45 nativeCheckInputs = [ iproute2 ]; 46 47 postInstall = '' 48 mkdir $apparmor 49 cat >$apparmor/bin.ping <<EOF 50 include <tunables/global> 51 $out/bin/ping { 52 include <abstractions/base> 53 include <abstractions/consoles> 54 include <abstractions/nameservice> 55 include "${apparmorRulesFromClosure { name = "ping"; } 56 ([libcap] ++ lib.optional (!stdenv.hostPlatform.isMusl) libidn2)}" 57 include <local/bin.ping> 58 capability net_raw, 59 network inet raw, 60 network inet6 raw, 61 mr $out/bin/ping, 62 r $out/share/locale/**, 63 r @{PROC}/@{pid}/environ, 64 } 65 EOF 66 ''; 67 68 meta = with lib; { 69 homepage = "https://github.com/iputils/iputils"; 70 changelog = "https://github.com/iputils/iputils/releases/tag/${version}"; 71 description = "A set of small useful utilities for Linux networking"; 72 longDescription = '' 73 A set of small useful utilities for Linux networking including: 74 75 - arping: send ARP REQUEST to a neighbour host 76 - clockdiff: measure clock difference between hosts 77 - ping: send ICMP ECHO_REQUEST to network hosts 78 - tracepath: traces path to a network host discovering MTU along this path 79 ''; 80 license = with licenses; [ gpl2Plus bsd3 ]; 81 platforms = platforms.linux; 82 maintainers = with maintainers; [ primeos lheckemann ]; 83 }; 84}