1 { stdenv, fetchurl, fetchpatch, perl, file, nettools, iputils, iproute2, makeWrapper
2 , coreutils, gnused, openldap ? null
5 # client and relay are end of life, remove after 4.4.3
10 stdenv.mkDerivation rec {
15 url = "https://ftp.isc.org/isc/dhcp/${version}/${pname}-${version}.tar.gz";
16 sha256 = "sha256-CsQWu1WZfKhjIXT9EHN/1hzbjbonUhYKM1d1vCHcc8c=";
21 # Make sure that the hostname gets set on reboot. Without this
22 # patch, the hostname doesn't get set properly if the old
23 # hostname (i.e. before reboot) is equal to the new hostname.
27 nativeBuildInputs = [ perl makeWrapper ];
29 buildInputs = [ openldap ];
31 depsBuildBuild = [ buildPackages.stdenv.cc ];
37 "--enable-delayed-ack"
40 "--enable-early-chroot"
42 "--localstatedir=/var"
43 ] ++ lib.optional stdenv.isLinux "--with-randomdev=/dev/random"
44 ++ lib.optionals (openldap != null) [ "--with-ldap" "--with-ldapcrypto" ]
45 ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "BUILD_CC=$(CC_FOR_BUILD)";
47 NIX_CFLAGS_COMPILE = builtins.toString [
48 "-Wno-error=pointer-compare"
49 "-Wno-error=format-truncation"
50 "-Wno-error=stringop-truncation"
51 "-Wno-error=format-overflow"
52 "-Wno-error=stringop-overflow=8"
55 installFlags = [ "DESTDIR=\${out}" ];
61 while rmdir $DIR 2>/dev/null; do
62 DIR="$(dirname "$DIR")"
65 cp client/scripts/linux $out/sbin/dhclient-script
66 substituteInPlace $out/sbin/dhclient-script \
67 --replace /sbin/ip ${iproute2}/sbin/ip
68 wrapProgram "$out/sbin/dhclient-script" --prefix PATH : \
69 "${nettools}/bin:${nettools}/sbin:${iputils}/bin:${coreutils}/bin:${gnused}/bin"
70 '' + lib.optionalString (!withClient) ''
71 rm $out/sbin/{dhclient,dhclient-script,.dhclient-script-wrapped}
72 '' + lib.optionalString (!withRelay) ''
78 substituteInPlace configure --replace "/usr/bin/file" "${file}/bin/file"
79 sed -i "includes/dhcpd.h" \
80 -e "s|^ *#define \+_PATH_DHCLIENT_SCRIPT.*$|#define _PATH_DHCLIENT_SCRIPT \"$out/sbin/dhclient-script\"|g"
82 export AR='${stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar'
85 enableParallelBuilding = true;
88 description = "Dynamic Host Configuration Protocol (DHCP) tools";
91 ISC's Dynamic Host Configuration Protocol (DHCP) distribution
92 provides a freely redistributable reference implementation of
93 all aspects of DHCP, through a suite of DHCP tools: server,
94 client, and relay agent.
97 homepage = "https://www.isc.org/dhcp/";
98 license = licenses.mpl20;
99 platforms = platforms.unix;
100 knownVulnerabilities = lib.optional (withClient || withRelay) "The client and relay component of the dhcp package have reached their end of life";