mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
services: wireguard: Add the shepherd-requirement field.
* gnu/services/vpn.scm (<wireguard-configuration>): Add shepherd-requirement. (wireguard-shepherd-service): Pass shepherd-requirement. Add user-processes to requirements. * doc/guix.texi (VPN Services):[wireguard]: Document it. Change-Id: Ia85add5067f6f9e023b8d65d6ce067b98eeb111e Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
committed by
Ludovic Courtès
parent
d9bfc66633
commit
81a911eab8
@@ -35739,6 +35739,10 @@ be executed before tearing down the interface.
|
||||
List of strings or G-expressions. These are script snippets which will
|
||||
be executed after tearing down the interface.
|
||||
|
||||
@item @code{shepherd-requirement} (default: @code{'()}) (type: list-of-symbols)
|
||||
A list of symbols naming Shepherd services that this service
|
||||
will depend on.
|
||||
|
||||
@item @code{table} (default: @code{"auto"})
|
||||
The routing table to which routes are added, as a string. There are two
|
||||
special values: @code{"off"} that disables the creation of routes
|
||||
|
||||
@@ -88,6 +88,7 @@
|
||||
wireguard-configuration-post-up
|
||||
wireguard-configuration-pre-down
|
||||
wireguard-configuration-post-down
|
||||
wireguard-configuration-shepherd-requirement
|
||||
wireguard-configuration-table
|
||||
wireguard-configuration-auto-start?
|
||||
|
||||
@@ -765,6 +766,8 @@ strongSwan.")))
|
||||
(default '()))
|
||||
(post-down wireguard-configuration-post-down ;list of strings
|
||||
(default '()))
|
||||
(shepherd-requirement wireguard-configuration-shepherd-requirement ; list of symbols
|
||||
(default '()))
|
||||
(table wireguard-configuration-table ;string
|
||||
(default "auto"))
|
||||
(auto-start? wireguard-configuration-auto-start? ;boolean
|
||||
@@ -918,12 +921,12 @@ public key, if any."
|
||||
|
||||
(define (wireguard-shepherd-service config)
|
||||
(match-record config <wireguard-configuration>
|
||||
(wireguard interface)
|
||||
(wireguard interface shepherd-requirement)
|
||||
(let ((wg-quick (file-append wireguard "/bin/wg-quick"))
|
||||
(auto-start? (wireguard-configuration-auto-start? config))
|
||||
(config (wireguard-configuration-file config)))
|
||||
(list (shepherd-service
|
||||
(requirement '(networking))
|
||||
(requirement `(networking user-processes ,@shepherd-requirement))
|
||||
(provision (list (wireguard-service-name interface)))
|
||||
(start #~(lambda _
|
||||
(invoke #$wg-quick "up" #$config)))
|
||||
|
||||
Reference in New Issue
Block a user