2023-02-02 18:25:31 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
, gettext
|
|
|
|
, libxslt
|
|
|
|
, docbook_xsl_ns
|
|
|
|
, libcap
|
|
|
|
, libidn2
|
2021-08-05 21:33:18 +00:00
|
|
|
, iproute2
|
2021-05-20 23:08:51 +00:00
|
|
|
, apparmorRulesFromClosure
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "iputils";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "20231222";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
2021-02-19 19:06:45 +00:00
|
|
|
rev = version;
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-/blxT6k79fgbxX8qCQuJMf7zDPwMjJUt7FCscaMXx6U=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
outputs = [ "out" "apparmor" ];
|
2021-05-20 23:08:51 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
# We don't have the required permissions inside the build sandbox:
|
|
|
|
# /build/source/build/ping/ping: socket: Operation not permitted
|
|
|
|
doCheck = false;
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
mesonFlags = [
|
|
|
|
"-DNO_SETCAP_OR_SUID=true"
|
|
|
|
"-Dsystemdunitdir=etc/systemd/system"
|
2020-10-19 09:53:12 +00:00
|
|
|
"-DINSTALL_SYSTEMD_UNITS=true"
|
2022-01-26 04:04:25 +00:00
|
|
|
"-DSKIP_TESTS=${lib.boolToString (!doCheck)}"
|
2020-09-25 04:45:31 +00:00
|
|
|
]
|
2023-02-02 18:25:31 +00:00
|
|
|
# Disable idn usage w/musl (https://github.com/iputils/iputils/pull/111):
|
|
|
|
++ lib.optional stdenv.hostPlatform.isMusl "-DUSE_IDN=false";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ meson ninja pkg-config gettext libxslt.bin docbook_xsl_ns ];
|
2020-10-19 09:53:12 +00:00
|
|
|
buildInputs = [ libcap ]
|
2021-02-19 19:06:45 +00:00
|
|
|
++ lib.optional (!stdenv.hostPlatform.isMusl) libidn2;
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ iproute2 ];
|
2021-08-05 21:33:18 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
postInstall = ''
|
|
|
|
mkdir $apparmor
|
|
|
|
cat >$apparmor/bin.ping <<EOF
|
|
|
|
include <tunables/global>
|
|
|
|
$out/bin/ping {
|
|
|
|
include <abstractions/base>
|
|
|
|
include <abstractions/consoles>
|
|
|
|
include <abstractions/nameservice>
|
|
|
|
include "${apparmorRulesFromClosure { name = "ping"; }
|
|
|
|
([libcap] ++ lib.optional (!stdenv.hostPlatform.isMusl) libidn2)}"
|
|
|
|
include <local/bin.ping>
|
|
|
|
capability net_raw,
|
|
|
|
network inet raw,
|
|
|
|
network inet6 raw,
|
|
|
|
mr $out/bin/ping,
|
|
|
|
r $out/share/locale/**,
|
|
|
|
r @{PROC}/@{pid}/environ,
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-19 19:06:45 +00:00
|
|
|
meta = with lib; {
|
2023-02-02 18:25:31 +00:00
|
|
|
homepage = "https://github.com/iputils/iputils";
|
|
|
|
changelog = "https://github.com/iputils/iputils/releases/tag/${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A set of small useful utilities for Linux networking";
|
|
|
|
longDescription = ''
|
|
|
|
A set of small useful utilities for Linux networking including:
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
- arping: send ARP REQUEST to a neighbour host
|
|
|
|
- clockdiff: measure clock difference between hosts
|
|
|
|
- ping: send ICMP ECHO_REQUEST to network hosts
|
|
|
|
- tracepath: traces path to a network host discovering MTU along this path
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2023-02-02 18:25:31 +00:00
|
|
|
license = with licenses; [ gpl2Plus bsd3 ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ primeos lheckemann ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|