Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 fetchurl, 5 ncurses, 6 perl, 7 help2man, 8 apparmorRulesFromClosure, 9 libxcrypt, 10 util-linux, 11}: 12 13stdenv.mkDerivation rec { 14 pname = "inetutils"; 15 version = "2.6"; 16 17 src = fetchurl { 18 url = "mirror://gnu/${pname}/${pname}-${version}.tar.xz"; 19 hash = "sha256-aL7b/q9z99hr4qfZm8+9QJPYKfUncIk5Ga4XTAsjV8o="; 20 }; 21 22 outputs = [ 23 "out" 24 "apparmor" 25 ]; 26 27 patches = [ 28 # https://git.congatec.com/yocto/meta-openembedded/commit/3402bfac6b595c622e4590a8ff5eaaa854e2a2a3 29 ./inetutils-1_9-PATH_PROCNET_DEV.patch 30 ]; 31 32 strictDeps = true; 33 nativeBuildInputs = [ 34 help2man 35 perl # for `whois' 36 ]; 37 buildInputs = [ 38 ncurses # for `talk' 39 libxcrypt 40 ]; 41 42 # Don't use help2man if cross-compiling 43 # https://lists.gnu.org/archive/html/bug-sed/2017-01/msg00001.html 44 # https://git.congatec.com/yocto/meta-openembedded/blob/3402bfac6b595c622e4590a8ff5eaaa854e2a2a3/meta-networking/recipes-connectivity/inetutils/inetutils_1.9.1.bb#L44 45 preConfigure = 46 let 47 isCross = stdenv.hostPlatform != stdenv.buildPlatform; 48 in 49 lib.optionalString isCross '' 50 export HELP2MAN=true 51 ''; 52 53 configureFlags = [ 54 "--with-ncurses-include-dir=${ncurses.dev}/include" 55 ] 56 ++ lib.optionals stdenv.hostPlatform.isMusl [ 57 # Musl doesn't define rcmd 58 "--disable-rcp" 59 "--disable-rsh" 60 "--disable-rlogin" 61 "--disable-rexec" 62 ] 63 ++ lib.optional stdenv.hostPlatform.isDarwin "--disable-servers"; 64 65 doCheck = true; 66 67 installFlags = [ "SUIDMODE=" ]; 68 69 postInstall = '' 70 mkdir $apparmor 71 cat >$apparmor/bin.ping <<EOF 72 $out/bin/ping { 73 include <abstractions/base> 74 include <abstractions/consoles> 75 include <abstractions/nameservice> 76 include "${apparmorRulesFromClosure { name = "ping"; } [ stdenv.cc.libc ]}" 77 include <local/bin.ping> 78 capability net_raw, 79 network inet raw, 80 network inet6 raw, 81 mr $out/bin/ping, 82 } 83 EOF 84 ''; 85 86 meta = with lib; { 87 description = "Collection of common network programs"; 88 89 longDescription = '' 90 The GNU network utilities suite provides the 91 following tools: ftp(d), hostname, ifconfig, inetd, logger, ping, rcp, 92 rexec(d), rlogin(d), rsh(d), syslogd, talk(d), telnet(d), tftp(d), 93 traceroute, uucpd, and whois. 94 ''; 95 96 homepage = "https://www.gnu.org/software/inetutils/"; 97 license = licenses.gpl3Plus; 98 99 maintainers = with maintainers; [ matthewbauer ]; 100 platforms = platforms.unix; 101 102 /** 103 The `logger` binary from `util-linux` is preferred over `inetutils`. 104 To instead prioritize this package, set a _lower_ `meta.priority`, or 105 use e.g. `lib.setPrio 5 inetutils`. 106 */ 107 priority = (util-linux.meta.priority or lib.meta.defaultPriority) + 1; 108 }; 109}