nixpkgs-suyu/pkgs/tools/networking/dhcp/default.nix

91 lines
2.6 KiB
Nix
Raw Normal View History

2021-03-14 17:05:16 +01:00
{ stdenv, fetchurl, perl, file, nettools, iputils, iproute2, makeWrapper
, coreutils, gnused, openldap ? null
2019-03-23 05:44:16 +01:00
, buildPackages, lib
2015-03-26 20:27:48 +01:00
}:
stdenv.mkDerivation rec {
pname = "dhcp";
2020-01-26 20:44:15 +01:00
version = "4.4.2";
src = fetchurl {
url = "https://ftp.isc.org/isc/dhcp/${version}/${pname}-${version}.tar.gz";
2020-01-26 20:44:15 +01:00
sha256 = "08a5003zdxgl41b29zjkxa92h2i40zyjgxg0npvnhpkfl5jcsz0s";
};
patches =
2018-01-08 17:33:59 +01:00
[
# Make sure that the hostname gets set on reboot. Without this
# patch, the hostname doesn't get set properly if the old
# hostname (i.e. before reboot) is equal to the new hostname.
./set-hostname.patch
];
nativeBuildInputs = [ perl makeWrapper ];
2019-03-23 05:44:16 +01:00
buildInputs = [ openldap ];
2019-03-23 05:44:16 +01:00
depsBuildBuild = [ buildPackages.stdenv.cc ];
2015-03-26 20:27:48 +01:00
configureFlags = [
"--enable-failover"
"--enable-execute"
"--enable-tracing"
"--enable-delayed-ack"
"--enable-dhcpv6"
"--enable-paranoia"
"--enable-early-chroot"
"--sysconfdir=/etc"
"--localstatedir=/var"
] ++ lib.optional stdenv.isLinux "--with-randomdev=/dev/random"
2021-01-15 10:19:50 +01:00
++ lib.optionals (openldap != null) [ "--with-ldap" "--with-ldapcrypto" ];
2015-03-26 20:27:48 +01:00
2019-10-30 01:12:09 +01:00
NIX_CFLAGS_COMPILE = builtins.toString [
2018-05-16 23:36:32 +02:00
"-Wno-error=pointer-compare"
"-Wno-error=format-truncation"
2019-11-02 23:41:50 +01:00
"-Wno-error=stringop-truncation"
"-Wno-error=format-overflow"
2020-06-08 14:21:49 +02:00
"-Wno-error=stringop-overflow=8"
2018-05-16 23:36:32 +02:00
];
2015-03-26 20:27:48 +01:00
installFlags = [ "DESTDIR=\${out}" ];
postInstall =
''
2015-03-26 20:27:48 +01:00
mv $out/$out/* $out
DIR=$out/$out
while rmdir $DIR 2>/dev/null; do
DIR="$(dirname "$DIR")"
done
cp client/scripts/linux $out/sbin/dhclient-script
substituteInPlace $out/sbin/dhclient-script \
2021-03-14 17:05:16 +01:00
--replace /sbin/ip ${iproute2}/sbin/ip
wrapProgram "$out/sbin/dhclient-script" --prefix PATH : \
"${nettools}/bin:${nettools}/sbin:${iputils}/bin:${coreutils}/bin:${gnused}/bin"
'';
preConfigure =
''
substituteInPlace configure --replace "/usr/bin/file" "${file}/bin/file"
sed -i "includes/dhcpd.h" \
-e "s|^ *#define \+_PATH_DHCLIENT_SCRIPT.*$|#define _PATH_DHCLIENT_SCRIPT \"$out/sbin/dhclient-script\"|g"
2019-03-23 05:44:16 +01:00
export AR='${stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar'
'';
meta = with lib; {
description = "Dynamic Host Configuration Protocol (DHCP) tools";
longDescription = ''
ISC's Dynamic Host Configuration Protocol (DHCP) distribution
provides a freely redistributable reference implementation of
all aspects of DHCP, through a suite of DHCP tools: server,
client, and relay agent.
'';
2020-01-10 01:34:25 +01:00
homepage = "https://www.isc.org/dhcp/";
license = licenses.isc;
platforms = platforms.unix;
};
}