10 , enablePrivSep ? false
13 stdenv.mkDerivation rec {
17 src = fetchFromGitHub {
18 owner = "NetworkConfiguration";
21 sha256 = "sha256-Qtg9jOFMR/9oWJDmoNNcEAMxG6G1F187HF4MMBJIoTw=";
24 nativeBuildInputs = [ pkg-config ];
26 runtimeShellPackage # So patchShebangs finds a bash suitable for the installed scripts
27 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
29 ] ++ lib.optionals stdenv.hostPlatform.isFreeBSD [
35 substituteInPlace hooks/dhcpcd-run-hooks.in --replace /bin/sh ${runtimeShell}
40 "--localstatedir=/var"
42 "--dbdir=/var/lib/dhcpcd"
43 (lib.enableFeature enablePrivSep "privsep")
44 ] ++ lib.optional enablePrivSep "--privsepuser=dhcpcd";
46 makeFlags = [ "PREFIX=${placeholder "out"}" ];
48 # Hack to make installation succeed. dhcpcd will still use /var/lib
50 installFlags = [ "DBDIR=$(TMPDIR)/db" "SYSCONFDIR=${placeholder "out"}/etc" ];
52 # Check that the udev plugin got built.
53 postInstall = lib.optionalString (udev != null && stdenv.hostPlatform.isLinux) "[ -e ${placeholder "out"}/lib/dhcpcd/dev/udev.so ]";
56 inherit (nixosTests.networking.scripted) macvlan dhcpSimple dhcpOneIf;
60 description = "Client for the Dynamic Host Configuration Protocol (DHCP)";
61 homepage = "https://roy.marples.name/projects/dhcpcd";
62 platforms = platforms.linux ++ platforms.freebsd;
63 license = licenses.bsd2;
65 mainProgram = "dhcpcd";