From aa46e1ae342feed39eaf1e63ffadfc69606dafb0 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Mon, 6 Apr 2020 13:50:15 +0200 Subject: [PATCH 1/2] iproute: Simplify and improve the expression --- pkgs/os-specific/linux/iproute/default.nix | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/pkgs/os-specific/linux/iproute/default.nix b/pkgs/os-specific/linux/iproute/default.nix index 624644596d9..fd7417839a1 100644 --- a/pkgs/os-specific/linux/iproute/default.nix +++ b/pkgs/os-specific/linux/iproute/default.nix @@ -1,4 +1,7 @@ -{ fetchurl, stdenv, flex, bash, bison, db, iptables, pkgconfig, libelf, libmnl }: +{ stdenv, fetchurl +, bison, flex, pkg-config +, db, iptables, libelf, libmnl +}: stdenv.mkDerivation rec { pname = "iproute2"; @@ -10,7 +13,7 @@ stdenv.mkDerivation rec { }; preConfigure = '' - patchShebangs ./configure + # Don't try to create /var/lib/arpd: sed -e '/ARPDDIR/d' -i Makefile # Don't build netem tools--they're not installed and require HOSTCC substituteInPlace Makefile --replace " netem " " " @@ -19,11 +22,8 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" ]; makeFlags = [ - "DESTDIR=" - "LIBDIR=$(out)/lib" + "PREFIX=$(out)" "SBINDIR=$(out)/sbin" - "MANDIR=$(out)/share/man" - "BASH_COMPDIR=$(out)/share/bash-completion/completions" "DOCDIR=$(TMPDIR)/share/doc/${pname}" # Don't install docs "HDRDIR=$(dev)/include/iproute2" ]; @@ -36,17 +36,13 @@ stdenv.mkDerivation rec { "CONFDIR=$(out)/etc/iproute2" ]; + nativeBuildInputs = [ bison flex pkg-config ]; buildInputs = [ db iptables libelf libmnl ]; - nativeBuildInputs = [ bison flex pkgconfig ]; enableParallelBuilding = true; - postInstall = '' - PATH=${bash}/bin:$PATH patchShebangs $out/sbin - ''; - meta = with stdenv.lib; { - homepage = https://wiki.linuxfoundation.org/networking/iproute2; + homepage = "https://wiki.linuxfoundation.org/networking/iproute2"; description = "A collection of utilities for controlling TCP/IP networking and traffic control in Linux"; platforms = platforms.linux; license = licenses.gpl2; From 94f2a76718d30acee9fe16ae8c7b24f349c3cd75 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Mon, 6 Apr 2020 13:51:21 +0200 Subject: [PATCH 2/2] iproute: Build the netem tools They will be installed now and we can provide $HOSTCC for cross-compilation. New files: +lib/tc/experimental.dist +lib/tc/normal.dist +lib/tc/pareto.dist +lib/tc/paretonormal.dist Note: The distributions are generated in a reproducible way. Co-Authored-By: Benjamin Saunders --- pkgs/os-specific/linux/iproute/default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/iproute/default.nix b/pkgs/os-specific/linux/iproute/default.nix index fd7417839a1..9f6df0fccd5 100644 --- a/pkgs/os-specific/linux/iproute/default.nix +++ b/pkgs/os-specific/linux/iproute/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl -, bison, flex, pkg-config +, buildPackages, bison, flex, pkg-config , db, iptables, libelf, libmnl }: @@ -15,8 +15,6 @@ stdenv.mkDerivation rec { preConfigure = '' # Don't try to create /var/lib/arpd: sed -e '/ARPDDIR/d' -i Makefile - # Don't build netem tools--they're not installed and require HOSTCC - substituteInPlace Makefile --replace " netem " " " ''; outputs = [ "out" "dev" ]; @@ -36,6 +34,7 @@ stdenv.mkDerivation rec { "CONFDIR=$(out)/etc/iproute2" ]; + depsBuildBuild = [ buildPackages.stdenv.cc ]; # netem requires $HOSTCC nativeBuildInputs = [ bison flex pkg-config ]; buildInputs = [ db iptables libelf libmnl ];