11 enablePrivSep ? false,
14 stdenv.mkDerivation rec {
18 src = fetchFromGitHub {
19 owner = "NetworkConfiguration";
22 sha256 = "sha256-Qtg9jOFMR/9oWJDmoNNcEAMxG6G1F187HF4MMBJIoTw=";
25 nativeBuildInputs = [ pkg-config ];
28 runtimeShellPackage # So patchShebangs finds a bash suitable for the installed scripts
30 ++ lib.optionals stdenv.hostPlatform.isLinux [
33 ++ lib.optionals stdenv.hostPlatform.isFreeBSD [
39 substituteInPlace hooks/dhcpcd-run-hooks.in --replace /bin/sh ${runtimeShell}
44 "--localstatedir=/var"
46 "--dbdir=/var/lib/dhcpcd"
47 (lib.enableFeature enablePrivSep "privsep")
48 ] ++ lib.optional enablePrivSep "--privsepuser=dhcpcd";
50 makeFlags = [ "PREFIX=${placeholder "out"}" ];
52 # Hack to make installation succeed. dhcpcd will still use /var/lib
56 "SYSCONFDIR=${placeholder "out"}/etc"
59 # Check that the udev plugin got built.
60 postInstall = lib.optionalString (
61 udev != null && stdenv.hostPlatform.isLinux
62 ) "[ -e ${placeholder "out"}/lib/dhcpcd/dev/udev.so ]";
65 inherit (nixosTests.networking.scripted) macvlan dhcpSimple dhcpOneIf;
69 description = "Client for the Dynamic Host Configuration Protocol (DHCP)";
70 homepage = "https://roy.marples.name/projects/dhcpcd";
71 platforms = platforms.linux ++ platforms.freebsd ++ platforms.openbsd;
72 license = licenses.bsd2;
74 mainProgram = "dhcpcd";