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>
This commit is contained in:
		
							parent
							
								
									79ae719ad1
								
							
						
					
					
						commit
						7777d767a4
					
				
					 2 changed files with 13 additions and 3 deletions
				
			
		|  | @ -19836,6 +19836,12 @@ Data type representing the configuration of NetworkManager. | ||||||
| @item @code{network-manager} (default: @code{network-manager}) | @item @code{network-manager} (default: @code{network-manager}) | ||||||
| The NetworkManager package to use. | The NetworkManager package to use. | ||||||
| 
 | 
 | ||||||
|  | @item @code{shepherd-requirement} (default: @code{'(wpa-supplicant)}) | ||||||
|  | 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. | ||||||
|  | 
 | ||||||
| @item @code{dns} (default: @code{"default"}) | @item @code{dns} (default: @code{"default"}) | ||||||
| Processing mode for DNS, which affects how NetworkManager uses the | Processing mode for DNS, which affects how NetworkManager uses the | ||||||
| @code{resolv.conf} configuration file. | @code{resolv.conf} configuration file. | ||||||
|  |  | ||||||
|  | @ -143,6 +143,7 @@ | ||||||
| 
 | 
 | ||||||
|             network-manager-configuration |             network-manager-configuration | ||||||
|             network-manager-configuration? |             network-manager-configuration? | ||||||
|  |             network-manager-configuration-shepherd-requirement | ||||||
|             network-manager-configuration-dns |             network-manager-configuration-dns | ||||||
|             network-manager-configuration-vpn-plugins |             network-manager-configuration-vpn-plugins | ||||||
|             network-manager-service-type |             network-manager-service-type | ||||||
|  | @ -1140,6 +1141,8 @@ project's documentation} for more information." | ||||||
|   network-manager-configuration? |   network-manager-configuration? | ||||||
|   (network-manager network-manager-configuration-network-manager |   (network-manager network-manager-configuration-network-manager | ||||||
|                    (default network-manager)) |                    (default network-manager)) | ||||||
|  |   (shepherd-requirement network-manager-configuration-shepherd-requirement | ||||||
|  |                         (default '(wpa-supplicant))) | ||||||
|   (dns network-manager-configuration-dns |   (dns network-manager-configuration-dns | ||||||
|        (default "default")) |        (default "default")) | ||||||
|   (vpn-plugins network-manager-configuration-vpn-plugins ;list of file-like |   (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) | (define (network-manager-shepherd-service config) | ||||||
|   (match-record config <network-manager-configuration> |   (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" |     (let ((conf (plain-file "NetworkManager.conf" | ||||||
|                             (string-append |                             (string-append | ||||||
|                              "[main]\ndns=" dns "\n" |                              "[main]\ndns=" dns "\n" | ||||||
|  | @ -1209,8 +1212,9 @@ project's documentation} for more information." | ||||||
|       (list (shepherd-service |       (list (shepherd-service | ||||||
|              (documentation "Run the NetworkManager.") |              (documentation "Run the NetworkManager.") | ||||||
|              (provision '(networking)) |              (provision '(networking)) | ||||||
|              (requirement (append '(user-processes dbus-system loopback) |              (requirement `(user-processes dbus-system loopback | ||||||
|                                   (if iwd? '(iwd) '(wpa-supplicant)))) |                             ,@shepherd-requirement | ||||||
|  |                             ,@(if iwd? '(iwd) '()))) | ||||||
|              (start #~(make-forkexec-constructor |              (start #~(make-forkexec-constructor | ||||||
|                        (list (string-append #$network-manager |                        (list (string-append #$network-manager | ||||||
|                                             "/sbin/NetworkManager") |                                             "/sbin/NetworkManager") | ||||||
|  |  | ||||||
		Reference in a new issue