[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#63985] [PATCH v3 09/11] services: NetworkManager: Prefer package ov
From: |
Bruno Victal |
Subject: |
[bug#63985] [PATCH v3 09/11] services: NetworkManager: Prefer package over network-manager. |
Date: |
Mon, 26 Jun 2023 22:59:35 +0100 |
* gnu/services/networking.scm (<network-manager-configuration>)
[package]: New field.
[network-manager]: Deprecate field.
(network-manager-environment, network-manager-shepherd)
(network-manager-service-type): Adjust to use 'package'.
* doc/guix.texi (Networking Setup): Replace mentions of network-manager with
package.
---
doc/guix.texi | 2 +-
gnu/services/networking.scm | 41 +++++++++++++++++++++++++++++--------
2 files changed, 33 insertions(+), 10 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 2f7e734874..974bfa3fb0 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20352,7 +20352,7 @@ Networking Setup
Data type representing the configuration of NetworkManager.
@table @asis
-@item @code{network-manager} (default: @code{network-manager})
+@item @code{package} (default: @code{network-manager})
The NetworkManager package to use.
@item @code{shepherd-requirement} (default: @code{'(wpa-supplicant)})
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index a4d3affa6c..496ff0f0ec 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -166,6 +166,7 @@ (define-module (gnu services networking)
network-manager-configuration
network-manager-configuration?
+ network-manager-configuration-package
network-manager-configuration-shepherd-requirement
network-manager-configuration-dns
network-manager-configuration-vpn-plugins
@@ -1164,8 +1165,10 @@ (define (warn-iwd?-field-deprecation value)
'shepherd-requirement' field instead~%")))
value)
+(define-maybe/no-serialization package)
+
(define-configuration network-manager-configuration
- (network-manager
+ (package
(package network-manager)
"The NetworkManager package to use."
empty-serializer)
@@ -1242,6 +1245,17 @@ (define-configuration network-manager-configuration
(apply generic-ini-serialize-string
'wifi.backend value rest)))))
+ (network-manager
+ maybe-package
+ "Deprecated. Use ``package'' field instead."
+ (sanitizer
+ (lambda (value)
+ (when (maybe-value-set? value)
+ (warning (G_ "the 'network-manager' field is deprecated, please use \
+'package' field instead~%")))
+ value))
+ empty-serializer)
+
(prefix generic-ini-))
(define (network-manager-serialize-configuration config)
@@ -1288,10 +1302,11 @@ (define (network-manager-environment config)
(define (network-manager-shepherd-service config)
(match-record config <network-manager-configuration>
- (network-manager shepherd-requirement dns iwd?)
+ (package shepherd-requirement dns iwd?)
(let* ((iwd? (or iwd? ; TODO: deprecated field, remove later.
(and shepherd-requirement
(memq 'iwd shepherd-requirement))))
+ (package (maybe-value network-manager package))
(conf (network-manager-serialize-configuration config))
(vpn-plugin-env (map (match-lambda
((key . value)
@@ -1314,7 +1329,7 @@ (define (network-manager-shepherd-service config)
'((mkdir-p "/var/lib/misc")) '())
(let ((pid
(fork+exec-command
- (list #$(file-append network-manager
+ (list #$(file-append package
"/sbin/NetworkManager")
(string-append "--config=" #$conf)
"--no-daemon")
@@ -1332,7 +1347,7 @@ (define (network-manager-shepherd-service config)
;; to finish starting-up. This is required otherwise
;; services will fail since the network interfaces be
;; absent until NetworkManager finishes setting them up.
- (system* #$(file-append network-manager "/bin/nm-online")
+ (system* #$(file-append package "/bin/nm-online")
"--wait-for-startup" "--quiet")
;; XXX: Finally, return the pid from running
;; fork+exec-command to shepherd.
@@ -1342,10 +1357,18 @@ (define (network-manager-shepherd-service config)
(define network-manager-service-type
(let ((config->packages
(lambda (config)
- (match-record config <network-manager-configuration>
- (network-manager vpn-plugins)
- `(,network-manager ,@vpn-plugins)))))
-
+ (match-record config <network-manager-configuration>
+ (package network-manager vpn-plugins)
+ (let ((package (or (maybe-value network-manager)
+ package)))
+ `(,package ,@vpn-plugins)))))
+ ;; Handle network-manager field deprecation for
+ ;; polkit-service-type extension.
+ (network-manager-configuration-package*
+ (lambda (config)
+ (match-record config <network-manager-configuration>
+ (package network-manager)
+ (maybe-value network-manager package)))))
(service-type
(name 'network-manager)
(extensions
@@ -1355,7 +1378,7 @@ (define network-manager-service-type
(service-extension polkit-service-type
(compose
list
- network-manager-configuration-network-manager))
+ network-manager-configuration-package*))
(service-extension account-service-type
network-manager-accounts)
(service-extension session-environment-service-type
--
2.39.2
- [bug#63985] [PATCH RFC v2 3/5] services: fstrim-service-type: Serialize with SRFI-171 transducers., (continued)
- [bug#63985] [PATCH RFC v2 3/5] services: fstrim-service-type: Serialize with SRFI-171 transducers., Bruno Victal, 2023/06/10
- [bug#63985] [PATCH RFC v2 2/5] services: configuration: Use transducers within serialize-configuration., Bruno Victal, 2023/06/10
- [bug#63985] [PATCH RFC v2 4/5] services: configuration: Add serializer-options field., Bruno Victal, 2023/06/10
- [bug#63985] [PATCH RFC v2 5/5] services: configuration: New generic-ini module., Bruno Victal, 2023/06/10
- [bug#63985] [PATCH v3 00/11] Service subsystem improvements, Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 06/11] services: configuration: New generic-ini module., Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 11/11] services: NetworkManager: Add extra-options field., Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 07/11] services: configuration: Add some commonly used predicates., Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 05/11] services: configuration: Add serializer-options field., Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 10/11] services: NetworkManager: add log-configuration field., Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 09/11] services: NetworkManager: Prefer package over network-manager.,
Bruno Victal <=
- [bug#63985] [PATCH v3 03/11] services: fstrim-service-type: Serialize with SRFI-171 transducers., Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 08/11] services: NetworkManager: Use define-configuration and generic-ini., Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 04/11] doc: Rewrite define-configuration., Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 02/11] services: configuration: Use transducers within serialize-configuration., Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 01/11] services: configuration: Simplify normalize-extra-args., Bruno Victal, 2023/06/26
- [bug#63985] [PATCH v3 00/11] Service subsystem improvements, Liliana Marie Prikler, 2023/06/27