jenkins: 2.479.3 -> 2.492.1
[NixPkgs.git] / pkgs / by-name / dh / dhcpcd / package.nix
blob7394fea8f83fbff5f40936ab6cd7168e06c7e280
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   pkg-config,
6   udev,
7   freebsd,
8   runtimeShellPackage,
9   runtimeShell,
10   nixosTests,
11   enablePrivSep ? false,
14 stdenv.mkDerivation rec {
15   pname = "dhcpcd";
16   version = "10.1.0";
18   src = fetchFromGitHub {
19     owner = "NetworkConfiguration";
20     repo = "dhcpcd";
21     rev = "v${version}";
22     sha256 = "sha256-Qtg9jOFMR/9oWJDmoNNcEAMxG6G1F187HF4MMBJIoTw=";
23   };
25   nativeBuildInputs = [ pkg-config ];
26   buildInputs =
27     [
28       runtimeShellPackage # So patchShebangs finds a bash suitable for the installed scripts
29     ]
30     ++ lib.optionals stdenv.hostPlatform.isLinux [
31       udev
32     ]
33     ++ lib.optionals stdenv.hostPlatform.isFreeBSD [
34       freebsd.libcapsicum
35       freebsd.libcasper
36     ];
38   postPatch = ''
39     substituteInPlace hooks/dhcpcd-run-hooks.in --replace /bin/sh ${runtimeShell}
40   '';
42   configureFlags = [
43     "--sysconfdir=/etc"
44     "--localstatedir=/var"
45     "--disable-privsep"
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
53   # at runtime.
54   installFlags = [
55     "DBDIR=$(TMPDIR)/db"
56     "SYSCONFDIR=${placeholder "out"}/etc"
57   ];
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 ]";
64   passthru.tests = {
65     inherit (nixosTests.networking.scripted) macvlan dhcpSimple dhcpOneIf;
66   };
68   meta = with lib; {
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;
73     maintainers = [ ];
74     mainProgram = "dhcpcd";
75   };