Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, fetchpatch 2, buildPackages, bison, flex, pkg-config 3, db, iptables, libelf, libmnl 4, gitUpdater 5}: 6 7stdenv.mkDerivation rec { 8 pname = "iproute2"; 9 version = "6.3.0"; 10 11 src = fetchurl { 12 url = "mirror://kernel/linux/utils/net/${pname}/${pname}-${version}.tar.xz"; 13 sha256 = "sha256-37KpjbluemU8/8ZpMzWhpGbimjS2rFKL5I814dJ2ZzI="; 14 }; 15 16 patches = [ 17 # To avoid ./configure failing due to invalid arguments: 18 (fetchpatch { # configure: restore backward compatibility 19 url = "https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/patch/?id=a3272b93725a406bc98b67373da67a4bdf6fcdb0"; 20 sha256 = "0hyagh2lf6rrfss4z7ca8q3ydya6gg7vfhh25slhpgcn6lnk0xbv"; 21 }) 22 23 # fix build on musl. applied anywhere to prevent patchrot. 24 (fetchpatch { 25 url = "https://git.alpinelinux.org/aports/plain/main/iproute2/min.patch?id=4b78dbe29d18151402052c56af43cc12d04b1a69"; 26 sha256 = "sha256-0ROZQAN3mUPPgggictr23jyA4JDG7m9vmBUhgRp4ExY="; 27 }) 28 ]; 29 30 preConfigure = '' 31 # Don't try to create /var/lib/arpd: 32 sed -e '/ARPDDIR/d' -i Makefile 33 ''; 34 35 outputs = [ "out" "dev" ]; 36 37 makeFlags = [ 38 "PREFIX=$(out)" 39 "SBINDIR=$(out)/sbin" 40 "DOCDIR=$(TMPDIR)/share/doc/${pname}" # Don't install docs 41 "HDRDIR=$(dev)/include/iproute2" 42 ] ++ lib.optionals stdenv.hostPlatform.isStatic [ 43 "SHARED_LIBS=n" 44 # all build .so plugins: 45 "TC_CONFIG_NO_XT=y" 46 ]; 47 48 buildFlags = [ 49 "CONFDIR=/etc/iproute2" 50 ]; 51 52 installFlags = [ 53 "CONFDIR=$(out)/etc/iproute2" 54 ]; 55 56 depsBuildBuild = [ buildPackages.stdenv.cc ]; # netem requires $HOSTCC 57 nativeBuildInputs = [ bison flex pkg-config ]; 58 buildInputs = [ db iptables libelf libmnl ]; 59 60 enableParallelBuilding = true; 61 62 passthru.updateScript = gitUpdater { 63 # No nicer place to find latest release. 64 url = "https://git.kernel.org/pub/scm/network/iproute2/iproute2.git"; 65 rev-prefix = "v"; 66 }; 67 68 meta = with lib; { 69 homepage = "https://wiki.linuxfoundation.org/networking/iproute2"; 70 description = "A collection of utilities for controlling TCP/IP networking and traffic control in Linux"; 71 platforms = platforms.linux; 72 license = licenses.gpl2; 73 maintainers = with maintainers; [ primeos eelco fpletz globin ]; 74 }; 75}