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