From f9a4a6e0383405ff3e1a35148fcf2594b139944e Mon Sep 17 00:00:00 2001 From: Michael Eden Date: Sat, 23 Mar 2019 00:44:16 -0400 Subject: [PATCH] dhcp: cross compile --- pkgs/tools/networking/dhcp/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/networking/dhcp/default.nix b/pkgs/tools/networking/dhcp/default.nix index 41074e3dad6bc..6987bc553a58f 100644 --- a/pkgs/tools/networking/dhcp/default.nix +++ b/pkgs/tools/networking/dhcp/default.nix @@ -1,5 +1,6 @@ { stdenv, fetchurl, perl, file, nettools, iputils, iproute, makeWrapper , coreutils, gnused, openldap ? null +, buildPackages, lib }: stdenv.mkDerivation rec { @@ -19,7 +20,11 @@ stdenv.mkDerivation rec { ./set-hostname.patch ]; - buildInputs = [ perl makeWrapper openldap ]; + nativeBuildInputs = [ perl ]; + + buildInputs = [ makeWrapper openldap ]; + + depsBuildBuild = [ buildPackages.stdenv.cc ]; configureFlags = [ "--enable-failover" @@ -31,6 +36,7 @@ stdenv.mkDerivation rec { "--enable-early-chroot" "--sysconfdir=/etc" "--localstatedir=/var" + (lib.optional stdenv.isLinux "--with-randomdev=/dev/random") ] ++ stdenv.lib.optionals (openldap != null) [ "--with-ldap" "--with-ldapcrypto" ]; NIX_CFLAGS_COMPILE = [ "-Wno-error=pointer-compare" ]; @@ -57,6 +63,8 @@ stdenv.mkDerivation rec { substituteInPlace configure --replace "/usr/bin/file" "${file}/bin/file" sed -i "includes/dhcpd.h" \ -"es|^ *#define \+_PATH_DHCLIENT_SCRIPT.*$|#define _PATH_DHCLIENT_SCRIPT \"$out/sbin/dhclient-script\"|g" + + export AR='${stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar' ''; meta = with stdenv.lib; {