1(define-module (nmeum packages networking)
2 #:use-module (guix)
3 #:use-module (guix gexp)
4 #:use-module (guix build-system gnu)
5 #:use-module (guix git-download)
6 #:use-module ((guix licenses) #:prefix license:)
7 #:use-module (gnu packages base)
8 #:use-module (gnu packages bash)
9 #:use-module (gnu packages linux))
10
11(define-public dhcpcd
12 (package
13 (name "dhcpcd")
14 (version "10.0.6")
15 (source
16 (origin
17 (method git-fetch)
18 (uri (git-reference
19 (url "https://github.com/NetworkConfiguration/dhcpcd")
20 (commit (string-append "v" version))))
21 (sha256
22 (base32 "07n7d5wsmy955i6l8rkcmxhgxjygj2cxgpw79id2hx9w41fbkl5l"))
23 (file-name (git-file-name name version))))
24 (inputs (list bash-minimal))
25 (native-inputs (list eudev))
26 (build-system gnu-build-system)
27 (arguments
28 (list
29 #:test-target "test"
30 #:configure-flags #~(list "--enable-ipv6"
31 "--enable-privsep"
32 "--privsepuser=dhcpcd"
33 (string-append "--dbdir=" "/var/db/dhcpcd")
34 (string-append "--rundir=" "/var/run/dhcpcd")
35 (string-append "CC=" #$(cc-for-target)))
36 #:phases #~(modify-phases %standard-phases
37 (add-after 'unpack 'do-not-create-dbdir
38 (lambda _
39 ;; Make sure that the Makefile doesn't attempt to create
40 ;; /var/db/dhcpcd for which it doesn't have permissions.
41 (substitute* "src/Makefile"
42 (("\\$\\{INSTALL\\} -m \\$\\{DBMODE\\} -d \\$\\{DESTDIR\\}\\$\\{DBDIR\\}")
43 ""))))
44 (add-before 'build 'setenv
45 (lambda _
46 (setenv "HOST_SH" (which "sh"))))
47 (add-after 'install 'wrap-hooks
48 (lambda* (#:key inputs outputs #:allow-other-keys)
49 (let* ((out (assoc-ref outputs "out"))
50 (libexec (string-append out "/libexec"))
51 (sed (search-input-file inputs "/bin/sed"))
52 (rm (search-input-file inputs "/bin/rm")))
53 (wrap-program (string-append libexec
54 "/dhcpcd-run-hooks")
55 `("PATH" ":" suffix
56 (,(dirname sed)
57 ,(dirname rm))))))))))
58 (home-page "https://roy.marples.name/projects/dhcpcd")
59 (synopsis "Feature-rich DHCP and DHCPv6 client")
60 (description
61 "Provides a DHCP and a DHCPv6 client. Additionally,
62dhcpcd is also an IPv4LL (aka ZeroConf) client. In layperson's terms,
63dhcpcd runs on your machine and silently configures your computer to work
64on the attached networks without trouble and mostly without configuration.")
65 (license license:bsd-2)))
66
67