nixpkgs/pkgs/os-specific/linux/iputils/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
2.4 KiB
Nix
Raw Normal View History

2023-01-12 12:14:55 +00:00
{ lib
, stdenv
, fetchFromGitHub
, meson
, ninja
, pkg-config
, gettext
, libxslt
, docbook_xsl_ns
, libcap
, libidn2
2021-07-23 09:03:00 +00:00
, iproute2
, apparmorRulesFromClosure
2018-08-18 18:06:49 +00:00
}:
2023-01-06 03:24:12 +00:00
stdenv.mkDerivation rec {
pname = "iputils";
2024-01-20 05:44:11 +00:00
version = "20240117";
2018-08-18 18:06:49 +00:00
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = version;
2024-01-20 05:44:11 +00:00
hash = "sha256-sERY8ZKuXiY85cXdNWOm4byiNU7mOVIeA55dgQJHdoE=";
};
2023-01-12 12:14:55 +00:00
outputs = [ "out" "apparmor" ];
2021-07-23 09:03:00 +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-08-21 18:47:08 +00:00
mesonFlags = [
"-DNO_SETCAP_OR_SUID=true"
"-Dsystemdunitdir=etc/systemd/system"
"-DINSTALL_SYSTEMD_UNITS=true"
"-DSKIP_TESTS=${lib.boolToString (!doCheck)}"
2020-08-21 18:47:08 +00:00
]
2023-01-12 12:14:55 +00:00
# Disable idn usage w/musl (https://github.com/iputils/iputils/pull/111):
++ lib.optional stdenv.hostPlatform.isMusl "-DUSE_IDN=false";
nativeBuildInputs = [ meson ninja pkg-config gettext libxslt.bin docbook_xsl_ns ];
buildInputs = [ libcap ]
++ lib.optional (!stdenv.hostPlatform.isMusl) libidn2;
nativeCheckInputs = [ iproute2 ];
2021-07-23 09:03:00 +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
'';
meta = with lib; {
2023-01-12 12:14:55 +00:00
homepage = "https://github.com/iputils/iputils";
changelog = "https://github.com/iputils/iputils/releases/tag/${version}";
description = "A set of small useful utilities for Linux networking";
longDescription = ''
A set of small useful utilities for Linux networking including:
2023-01-06 03:24:12 +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
'';
2023-01-12 12:14:55 +00:00
license = with licenses; [ gpl2Plus bsd3 ];
platforms = platforms.linux;
maintainers = with maintainers; [ primeos lheckemann ];
};
}