services: network-manager: Add iwd backend support.

* gnu/services/networking.scm (network-manager-configuration)[iwd?]: New
field.
(network-manager-shepherd-service): Add iwd to requirements if needed.
* doc/guix.texi: Add information about iwd? option.
This commit is contained in:
Andrew Tropin 2022-12-01 17:21:39 +04:00
parent 7dddf0cc54
commit 0823fd1aa9
No known key found for this signature in database
GPG key ID: 2208D20958C1DEB0
2 changed files with 13 additions and 4 deletions

View file

@ -19583,6 +19583,10 @@ This is the list of available plugins for virtual private networks
(VPNs). An example of this is the @code{network-manager-openvpn} (VPNs). An example of this is the @code{network-manager-openvpn}
package, which allows NetworkManager to manage VPNs @i{via} OpenVPN. package, which allows NetworkManager to manage VPNs @i{via} OpenVPN.
@item @code{iwd?} (default: @code{#f})
NetworkManager will use iwd as a backend for wireless networking if this
option is set to @code{#t}, otherwise it will use wpa-supplicant.
@end table @end table
@end deftp @end deftp

View file

@ -18,6 +18,7 @@
;;; Copyright © 2021 Christine Lemmer-Webber <cwebber@dustycloud.org> ;;; Copyright © 2021 Christine Lemmer-Webber <cwebber@dustycloud.org>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net> ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2022 Andrew Tropin <andrew@trop.in>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -1143,7 +1144,8 @@ (define-record-type* <network-manager-configuration>
(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
(default '()))) (default '()))
(iwd? network-manager-configuration-iwd? (default #f)))
(define network-manager-activation (define network-manager-activation
;; Activation gexp for NetworkManager ;; Activation gexp for NetworkManager
@ -1199,14 +1201,17 @@ (define network-manager-environment
(define network-manager-shepherd-service (define network-manager-shepherd-service
(match-lambda (match-lambda
(($ <network-manager-configuration> network-manager dns vpn-plugins) (($ <network-manager-configuration> network-manager dns vpn-plugins iwd?)
(let ((conf (plain-file "NetworkManager.conf" (let ((conf (plain-file "NetworkManager.conf"
(string-append "[main]\ndns=" dns "\n"))) (string-append
"[main]\ndns=" dns "\n"
(if iwd? "[device]\nwifi.backend=iwd\n" ""))))
(vpn (vpn-plugin-directory vpn-plugins))) (vpn (vpn-plugin-directory vpn-plugins)))
(list (shepherd-service (list (shepherd-service
(documentation "Run the NetworkManager.") (documentation "Run the NetworkManager.")
(provision '(networking)) (provision '(networking))
(requirement '(user-processes dbus-system wpa-supplicant loopback)) (requirement (append '(user-processes dbus-system loopback)
(if iwd? '(iwd) '(wpa-supplicant))))
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list (string-append #$network-manager (list (string-append #$network-manager
"/sbin/NetworkManager") "/sbin/NetworkManager")