summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorBruno Victal <mirai@makinata.eu>2023-03-07 12:43:58 +0000
committerLudovic Courtès <ludo@gnu.org>2023-03-10 14:49:57 +0100
commit7777d767a43ec73539cf386311feee2f683ead92 (patch)
tree57ec22539337e721d001048efda000f4b83c27cd /gnu
parent79ae719ad1e336fd7de93eb954281f0c0521c64b (diff)
downloadguix-7777d767a43ec73539cf386311feee2f683ead92.tar.gz
services: network-manager: Add 'shepherd-requirement' field.
Note: This also makes wpa-supplicant an optional requirement.

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

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/networking.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index dacf64c2d1..4a3d5b887f 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -143,6 +143,7 @@
 
             network-manager-configuration
             network-manager-configuration?
+            network-manager-configuration-shepherd-requirement
             network-manager-configuration-dns
             network-manager-configuration-vpn-plugins
             network-manager-service-type
@@ -1140,6 +1141,8 @@ project's documentation} for more information."
   network-manager-configuration?
   (network-manager network-manager-configuration-network-manager
                    (default network-manager))
+  (shepherd-requirement network-manager-configuration-shepherd-requirement
+                        (default '(wpa-supplicant)))
   (dns network-manager-configuration-dns
        (default "default"))
   (vpn-plugins network-manager-configuration-vpn-plugins ;list of file-like
@@ -1200,7 +1203,7 @@ project's documentation} for more information."
 
 (define (network-manager-shepherd-service config)
   (match-record config <network-manager-configuration>
-    (network-manager dns vpn-plugins iwd?)
+    (network-manager shepherd-requirement dns vpn-plugins iwd?)
     (let ((conf (plain-file "NetworkManager.conf"
                             (string-append
                              "[main]\ndns=" dns "\n"
@@ -1209,8 +1212,9 @@ project's documentation} for more information."
       (list (shepherd-service
              (documentation "Run the NetworkManager.")
              (provision '(networking))
-             (requirement (append '(user-processes dbus-system loopback)
-                                  (if iwd? '(iwd) '(wpa-supplicant))))
+             (requirement `(user-processes dbus-system loopback
+                            ,@shepherd-requirement
+                            ,@(if iwd? '(iwd) '())))
              (start #~(make-forkexec-constructor
                        (list (string-append #$network-manager
                                             "/sbin/NetworkManager")