From patchwork Mon Jun 26 21:59:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 51375 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 59E7327BBEC; Mon, 26 Jun 2023 23:02:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4281727BBE9 for ; Mon, 26 Jun 2023 23:02:19 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qDuGq-0005VY-4a; Mon, 26 Jun 2023 18:01:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qDuGi-00051v-S6 for guix-patches@gnu.org; Mon, 26 Jun 2023 18:01:10 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qDuGf-0005XH-8Y for guix-patches@gnu.org; Mon, 26 Jun 2023 18:01:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qDuGf-0008TB-3c for guix-patches@gnu.org; Mon, 26 Jun 2023 18:01:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#63985] [PATCH v3 09/11] services: NetworkManager: Prefer package over network-manager. Resent-From: Bruno Victal Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 26 Jun 2023 22:01:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63985 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 63985@debbugs.gnu.org Cc: Bruno Victal Received: via spool by 63985-submit@debbugs.gnu.org id=B63985.168781684732465 (code B ref 63985); Mon, 26 Jun 2023 22:01:05 +0000 Received: (at 63985) by debbugs.gnu.org; 26 Jun 2023 22:00:47 +0000 Received: from localhost ([127.0.0.1]:47190 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDuGN-0008RR-0b for submit@debbugs.gnu.org; Mon, 26 Jun 2023 18:00:47 -0400 Received: from smtpmciv3.myservices.hosting ([185.26.107.239]:50424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qDuGC-0008Qn-I3 for 63985@debbugs.gnu.org; Mon, 26 Jun 2023 18:00:37 -0400 Received: from mail1.netim.hosting (unknown [185.26.106.173]) by smtpmciv3.myservices.hosting (Postfix) with ESMTP id B7439203C4 for <63985@debbugs.gnu.org>; Tue, 27 Jun 2023 00:00:35 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 1C7568009B; Tue, 27 Jun 2023 00:00:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-2.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vtDQBfPRZ3Qi; Tue, 27 Jun 2023 00:00:34 +0200 (CEST) Received: from guix-nuc.home.arpa (unknown [10.192.1.83]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id 8FB448009A; Tue, 27 Jun 2023 00:00:34 +0200 (CEST) From: Bruno Victal Date: Mon, 26 Jun 2023 22:59:35 +0100 Message-Id: <81521d94a397b288655c9bc8b68b9a0efe09bc38.1687816734.git.mirai@makinata.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/networking.scm () [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 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 vpn-plugins) - `(,network-manager ,@vpn-plugins))))) - + (match-record config + (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 + (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