about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/dhcp
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/tools/networking/dhcp
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/tools/networking/dhcp')
-rw-r--r--nixpkgs/pkgs/tools/networking/dhcp/default.nix77
-rw-r--r--nixpkgs/pkgs/tools/networking/dhcp/set-hostname.patch12
2 files changed, 89 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/networking/dhcp/default.nix b/nixpkgs/pkgs/tools/networking/dhcp/default.nix
new file mode 100644
index 000000000000..6c7f335891f5
--- /dev/null
+++ b/nixpkgs/pkgs/tools/networking/dhcp/default.nix
@@ -0,0 +1,77 @@
+{ stdenv, fetchurl, perl, file, nettools, iputils, iproute, makeWrapper
+, coreutils, gnused, openldap ? null
+}:
+
+stdenv.mkDerivation rec {
+  name = "dhcp-${version}";
+  version = "4.4.1";
+
+  src = fetchurl {
+    url = "https://ftp.isc.org/isc/dhcp/${version}/${name}.tar.gz";
+    sha256 = "025nfqx4zwdgv4b3rkw26ihcj312vir08jk6yi57ndmb4a4m08ia";
+  };
+
+  patches =
+    [
+      # 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
+    ];
+
+  buildInputs = [ perl makeWrapper openldap ];
+
+  configureFlags = [
+    "--enable-failover"
+    "--enable-execute"
+    "--enable-tracing"
+    "--enable-delayed-ack"
+    "--enable-dhcpv6"
+    "--enable-paranoia"
+    "--enable-early-chroot"
+    "--sysconfdir=/etc"
+    "--localstatedir=/var"
+  ] ++ stdenv.lib.optionals (openldap != null) [ "--with-ldap" "--with-ldapcrypto" ];
+
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=pointer-compare" ];
+
+  installFlags = [ "DESTDIR=\${out}" ];
+
+  postInstall =
+    ''
+      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 \
+        --replace /sbin/ip ${iproute}/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" \
+	-"es|^ *#define \+_PATH_DHCLIENT_SCRIPT.*$|#define _PATH_DHCLIENT_SCRIPT \"$out/sbin/dhclient-script\"|g"
+    '';
+
+  meta = with stdenv.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.
+   '';
+
+    homepage = http://www.isc.org/products/DHCP/;
+    license = licenses.isc;
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ wkennington ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/networking/dhcp/set-hostname.patch b/nixpkgs/pkgs/tools/networking/dhcp/set-hostname.patch
new file mode 100644
index 000000000000..7aa9d0814514
--- /dev/null
+++ b/nixpkgs/pkgs/tools/networking/dhcp/set-hostname.patch
@@ -0,0 +1,12 @@
+--- a/client/scripts/linux	2010-09-15 00:49:48.000000000 +0200
++++ b/client/scripts/linux	2011-04-01 16:08:10.984372269 +0200
+@@ -133,9 +133,7 @@
+            [ "$current_hostname" = '(none)' ] ||
+            [ "$current_hostname" = 'localhost' ] ||
+            [ "$current_hostname" = "$old_host_name" ]; then
+-           if [ "$new_host_name" != "$old_host_name" ]; then
+-               hostname "$new_host_name"
+-           fi
++           hostname "$new_host_name"
+         fi
+     fi