services: dhcp-client-configuration: Add 'shepherd-requirement' field.

* gnu/services/networking.scm (<dhcp-client-configuration>)
[shepherd-requirement]: New field.
(dhcp-client-shepherd-service): Honor it.
(dhcp-client-configuration-shepherd-requirement): Export accessor.
* doc/guix.texi (Networking Setup): Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Sergey Trofimov 2023-04-11 09:33:57 +02:00 committed by Ludovic Courtès
parent 8d442e8a53
commit 61031dd32f
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 12 additions and 2 deletions

View File

@ -20000,6 +20000,12 @@ should listen on---e.g., @code{'("eno1")}.
When set to @code{'all}, the DHCP client listens on all the available
non-loopback interfaces that can be activated. Otherwise the DHCP
client listens only on the specified interfaces.
@item @code{shepherd-requirement} (default: @code{'()})
This option can be used to provide a list of symbols naming Shepherd services
that this service will depend on, such as @code{'wpa-supplicant} or
@code{'iwd} if you require authenticated access for encrypted WiFi or Ethernet
networks.
@end table
@end deftp
@ -20103,7 +20109,7 @@ Data Type representing the configuration of connman.
@item @code{connman} (default: @var{connman})
The connman package to use.
@item @code{shepherd-requirement} (default: @code{()})
@item @code{shepherd-requirement} (default: @code{'()})
This option can be used to provide a list of symbols naming Shepherd services
that this service will depend on, such as @code{'wpa-supplicant} or
@code{'iwd} if you require authenticated access for encrypted WiFi or Ethernet

View File

@ -89,6 +89,7 @@
dhcp-client-configuration?
dhcp-client-configuration-package
dhcp-client-configuration-interfaces
dhcp-client-configuration-shepherd-requirement
dhcpd-service-type
dhcpd-configuration
@ -288,6 +289,8 @@
dhcp-client-configuration?
(package dhcp-client-configuration-package ;file-like
(default isc-dhcp))
(shepherd-requirement dhcp-client-configuration-shepherd-requirement
(default '()))
(interfaces dhcp-client-configuration-interfaces
(default 'all))) ;'all | list of strings
@ -295,11 +298,12 @@
(match-lambda
((? dhcp-client-configuration? config)
(let ((package (dhcp-client-configuration-package config))
(shepherd-requirement (dhcp-client-configuration-shepherd-requirement config))
(interfaces (dhcp-client-configuration-interfaces config))
(pid-file "/var/run/dhclient.pid"))
(list (shepherd-service
(documentation "Set up networking via DHCP.")
(requirement '(user-processes udev))
(requirement `(user-processes udev ,@shepherd-requirement))
;; XXX: Running with '-nw' ("no wait") avoids blocking for a minute when
;; networking is unavailable, but also means that the interface is not up