2021-02-03 20:02:06 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2021-01-19 06:50:56 +00:00
|
|
|
, meson, ninja, pkg-config, gettext, libxslt, docbook_xsl_ns
|
2020-10-19 20:41:53 +01:00
|
|
|
, libcap, libidn2
|
2021-07-23 10:03:00 +01:00
|
|
|
, iproute2
|
2020-10-18 14:36:24 +01:00
|
|
|
, apparmorRulesFromClosure
|
2018-08-18 19:06:49 +01:00
|
|
|
}:
|
2004-08-05 20:30:00 +01:00
|
|
|
|
2013-03-18 11:21:00 +00:00
|
|
|
let
|
2021-12-19 11:01:43 +00:00
|
|
|
version = "20211215";
|
2018-09-02 11:40:46 +01:00
|
|
|
sunAsIsLicense = {
|
|
|
|
fullName = "AS-IS, SUN MICROSYSTEMS license";
|
2019-07-10 00:45:21 +01:00
|
|
|
url = "https://github.com/iputils/iputils/blob/s${version}/rdisc.c";
|
2018-09-02 11:40:46 +01:00
|
|
|
};
|
2019-07-10 00:45:21 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "iputils";
|
|
|
|
inherit version;
|
2013-06-04 13:18:55 +01:00
|
|
|
|
2018-08-18 19:06:49 +01:00
|
|
|
src = fetchFromGitHub {
|
2019-07-10 00:45:21 +01:00
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
2021-02-03 20:02:06 +00:00
|
|
|
rev = version;
|
2021-12-19 11:01:43 +00:00
|
|
|
sha256 = "1vzdch1xi2x2j8mvnsr4wwwh7kdkgf926xafw5kkb74yy1wac5qv";
|
2004-08-05 20:30:00 +01:00
|
|
|
};
|
|
|
|
|
2020-10-18 14:36:24 +01:00
|
|
|
outputs = ["out" "apparmor"];
|
|
|
|
|
2021-07-23 10:03:00 +01: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 19:47:08 +01:00
|
|
|
mesonFlags = [
|
|
|
|
"-DBUILD_RARPD=true"
|
|
|
|
"-DNO_SETCAP_OR_SUID=true"
|
|
|
|
"-Dsystemdunitdir=etc/systemd/system"
|
2020-10-19 21:02:46 +01:00
|
|
|
"-DINSTALL_SYSTEMD_UNITS=true"
|
2021-12-19 11:01:43 +00:00
|
|
|
"-DSKIP_TESTS=${lib.boolToString (!doCheck)}"
|
2020-08-21 19:47:08 +01:00
|
|
|
]
|
2019-03-24 19:00:28 +00:00
|
|
|
# Disable idn usage w/musl (https://github.com/iputils/iputils/pull/111):
|
2021-02-03 20:02:06 +00:00
|
|
|
++ lib.optional stdenv.hostPlatform.isMusl "-DUSE_IDN=false";
|
2019-03-24 19:00:28 +00:00
|
|
|
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ meson ninja pkg-config gettext libxslt.bin docbook_xsl_ns ];
|
2020-10-19 20:41:53 +01:00
|
|
|
buildInputs = [ libcap ]
|
2021-02-03 20:02:06 +00:00
|
|
|
++ lib.optional (!stdenv.hostPlatform.isMusl) libidn2;
|
2021-07-23 10:03:00 +01:00
|
|
|
checkInputs = [ iproute2 ];
|
|
|
|
|
2020-10-18 14:36:24 +01:00
|
|
|
postInstall = ''
|
2021-05-14 16:19:37 +01:00
|
|
|
mkdir $apparmor
|
|
|
|
cat >$apparmor/bin.ping <<EOF
|
2020-10-18 14:36:24 +01:00
|
|
|
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
|
|
|
|
'';
|
2013-03-18 14:07:03 +00:00
|
|
|
|
2021-02-03 20:02:06 +00:00
|
|
|
meta = with lib; {
|
2011-02-02 16:05:18 +00:00
|
|
|
description = "A set of small useful utilities for Linux networking";
|
2020-08-21 19:47:08 +01:00
|
|
|
inherit (src.meta) homepage;
|
|
|
|
changelog = "https://github.com/iputils/iputils/releases/tag/s${version}";
|
2018-09-02 11:40:46 +01:00
|
|
|
license = with licenses; [ gpl2Plus bsd3 sunAsIsLicense ];
|
2018-04-15 09:27:09 +01:00
|
|
|
platforms = platforms.linux;
|
2018-08-18 19:06:49 +01:00
|
|
|
maintainers = with maintainers; [ primeos lheckemann ];
|
2019-07-15 07:30:16 +01:00
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
A set of small useful utilities for Linux networking including:
|
|
|
|
|
|
|
|
arping
|
|
|
|
clockdiff
|
|
|
|
ninfod
|
|
|
|
ping
|
|
|
|
rarpd
|
|
|
|
rdisc
|
|
|
|
tracepath
|
|
|
|
'';
|
2011-02-02 16:05:18 +00:00
|
|
|
};
|
2004-08-05 20:30:00 +01:00
|
|
|
}
|