From patchwork Wed Feb 12 10:09:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: 45mg <45mg.writes@gmail.com> X-Patchwork-Id: 38505 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 3CF4927BBEA; Wed, 12 Feb 2025 10:11:21 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED 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 60F9827BBE2 for ; Wed, 12 Feb 2025 10:11:19 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ti9hz-0007xk-LE; Wed, 12 Feb 2025 05:11:07 -0500 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 1ti9hv-0007xQ-RK for guix-patches@gnu.org; Wed, 12 Feb 2025 05:11:05 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ti9hu-0002ck-BD; Wed, 12 Feb 2025 05:11:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=IXttwUS6HB+lnrq1XobO0tKyPPRiaHGuhcQB+iGjHIo=; b=lpWHyYw6sYTahYv/+Wj+p2AYYwzRZ57nKlQc+dQKAQJ3ugz8SPbQhw8V8A7eBxnmIdmcz88EFg4ZF6xgxL+y8vOOm/OhK8dtpHqmp577OAASa6lL8MmSCI6kYoUbJ9gK6XEBz9OdfRHkP/5F95SrOnAWhJ/g+vzzXbNXWPkJfzOHe60qbZsu8rYgTONJGhl+k8QSzGzoInwbWD4ZlmLrNYRR5M6m3u61Z6/GX5vEHDvfechFhr0m9DFdfxueKBGVLmNuENunNtIhFw+x2TkpxnSCKxyHlwgKnPjjA0MRusJKLY/2TLcAmGlr8ULO1E6FJ4OtQWkg3smPEK2VWaC0QQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ti9ht-0007Vl-SO; Wed, 12 Feb 2025 05:11:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75145] [PATCH v5] services: network-manager: Add extra-configuration-files field. Resent-From: 45mg <45mg.writes@gmail.com> Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Wed, 12 Feb 2025 10:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75145 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75145@debbugs.gnu.org, Maxim Cournoyer , Arnaud Daby-Seesaram Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , 45mg <45mg.writes@gmail.com>, Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 75145-submit@debbugs.gnu.org id=B75145.173935504828845 (code B ref 75145); Wed, 12 Feb 2025 10:11:01 +0000 Received: (at 75145) by debbugs.gnu.org; 12 Feb 2025 10:10:48 +0000 Received: from localhost ([127.0.0.1]:32811 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ti9hg-0007VB-4S for submit@debbugs.gnu.org; Wed, 12 Feb 2025 05:10:48 -0500 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]:53676) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <45mg.writes@gmail.com>) id 1ti9ha-0007Us-MH for 75145@debbugs.gnu.org; Wed, 12 Feb 2025 05:10:45 -0500 Received: by mail-pj1-x1044.google.com with SMTP id 98e67ed59e1d1-2fa488351ffso6164223a91.3 for <75145@debbugs.gnu.org>; Wed, 12 Feb 2025 02:10:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739355036; x=1739959836; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IXttwUS6HB+lnrq1XobO0tKyPPRiaHGuhcQB+iGjHIo=; b=Ra8dR8u/gHF8Dr/69HATdqsrrVqeGQPm1dU/iVs/dlbcd9MBazy/wfrlqkBW65QsnZ /4mYwYlXIn+8NNsvE+lT5yR3XJyMai7vIze7xtBUk3SVvcsMTxjEvyhWToclNSExlKBZ 95OGVVIpUrRwr83Tby+LQiK1Pa25IYzVdBcVmtXLQqSvz/FezPghyu7+RKcjC+2hGm/+ DPO+JqiNCpXdinx4LQZS1b5EQ5au6t+eOnBLwNwSlfiXvjjE2l+8wvlOH40sL1IbltWW 6D3c8FkdsqlwOF6LjpfUNGROBGM3G+U89bn/p86BfnJ70ZDoJm5fgf8tBfs88CHnRLEW nzqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739355036; x=1739959836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IXttwUS6HB+lnrq1XobO0tKyPPRiaHGuhcQB+iGjHIo=; b=BVCsXYr3T6YWIkTu33vW3pHiODZnIkvaTgGGuJ7XGZTBlRS7iisVRSclnIdQ1r3bki YrvxbspECNSZ6KM00GH4UvrdIlZU3jVfpzVJq0xMiRJIrLLkr2EOyw0M3uyry8j1Ro/Q Dygq0UbFjxmEgTH+sD/RD3GJDKj2axwjTKct5HDbBktU+uu4agEM5kYqbHLlE3u0ypnS qUCDN61ARuwp7MHm71j5/3YP9HIwxQjpYyd1AfjDqdBk/XCiaxpnSQan3kKD6WtDtVhP 5ALWGSLI1ZcxDvRos/pkn9PP384p4dUuxfbjoZEz8C0bjfN1h/42mXZrbFyeUbWwXtiq 7sHQ== X-Gm-Message-State: AOJu0YxOG1aHR/MNABqaEa4DekDLUdrO96KfiKfcbTjAVfkmxVmUdL3S fCBdAUx3VPBLXLGeutlW9+hcn9LMyIfgzqy23ic5VLAxL/pMh3bzvuJFRThC X-Gm-Gg: ASbGncsQB+GSQXWNIkGcllsP25A6Tyo0ldlGcjocawP12mM47H+eVJ1X5jwV3vU7gGy MghMjTWLXksnQ9oI0GbS9+BSGyn+bxZKtoOjRVcZet2MWAMUCtiXTfHayvF5AEMO9sjaejhWdu7 sZaeVsWDIEpriIiWlspC2a7/J7kXkP3eX0niVbSbp6xYMOHLBzcCEmVBTIqNbN7ht4Ou9bnY/7N OZVQUJJASI8mImvmOG4+kerWXgzuvaHYvPMXelmwDIfNHx3L+RZyPs7UCotmej9sI5F2bkZDPuo 62Vh3j+9ulZQ/JuR2EXTW6zVwTXRI/dI5cV+YQ== X-Google-Smtp-Source: AGHT+IHrGX7anO5JlnI9o7wP6wOLedhJlSk9jIkEq0cdBwa3tgX6uXw0iEtxcvOOAoyq5vnItgmwAw== X-Received: by 2002:a17:90b:524b:b0:2ee:a76a:830 with SMTP id 98e67ed59e1d1-2fbf5c58382mr4230446a91.24.1739355036165; Wed, 12 Feb 2025 02:10:36 -0800 (PST) Received: from localhost.localdomain (utm3.nitt.edu. [14.139.162.2]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21f368cf8acsm109916505ad.248.2025.02.12.02.10.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Feb 2025 02:10:35 -0800 (PST) From: 45mg <45mg.writes@gmail.com> Date: Wed, 12 Feb 2025 15:39:22 +0530 Message-ID: <33af7378f90f4bea3a4b09fe65ef967edee28433.1739354962.git.45mg.writes@gmail.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <87bjvkkfmm.fsf@gmail.com> References: <87bjvkkfmm.fsf@gmail.com> 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 Allow users to specify additional configuration files for NetworkManager. These files will be added to `/etc/NetworkManager/conf.d` (NetworkManager's default configuration directory location). * gnu/services/networking.scm () [extra-configuration-files]: New field. (network-manager-activation): Honor the new field. * doc/guix.texi (Networking Setup): Document the new field. Change-Id: I07479958e4d0aa318328c666a9630b779230b300 --- doc/guix.texi | 23 +++++++++++++++++++++++ gnu/services/networking.scm | 13 +++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) base-commit: d59a13b6401e7494d8d5c9c9f66df3318451be79 diff --git a/doc/guix.texi b/doc/guix.texi index ce780682ed..648398ed63 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21635,6 +21635,29 @@ Networking Setup (VPNs). An example of this is the @code{network-manager-openvpn} package, which allows NetworkManager to manage VPNs @i{via} OpenVPN. +@item @code{extra-configuration-files} (default: @code{'()}) +A list of two-element lists; the first element of each list is a file +name (as a string), and the second is a file-like object. Used to +specify configuration files which will be added to +@file{/etc/NetworkManager/conf.d}. NetworkManager will read additional +configuration from this directory. For details on configuration file +precedence and the configuration file format, see the +@command{NetworkManager.conf(5)} man page. + +For example, to add two files @file{001-basic.conf} and +@file{002-unmanaged.conf}: + +@lisp +(service network-manager-service-type + (network-manager-configuration + (extra-configuration-files + `(("existing-file" ,(local-file "001-basic.conf")) + ("constructed-file" ,(plain-file "002-unmanaged.conf" + "[keyfile] +unmanaged-devices=interface-name:wlo1_ap +")))))) +@end lisp + @end table @end deftp diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index af28bd0626..c93ed58cf5 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -23,6 +23,7 @@ ;;; Copyright © 2023 Bruno Victal ;;; Copyright © 2023 muradm ;;; Copyright © 2024 Nigko Yerden +;;; Copyright © 2025 45mg <45mg.writes@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -1253,18 +1254,26 @@ (define-record-type* (default '())) (iwd? network-manager-configuration-iwd? ; TODO: deprecated field, remove. (default #f) - (sanitize warn-iwd?-field-deprecation))) + (sanitize warn-iwd?-field-deprecation)) + (extra-configuration-files network-manager-configuration-extra-configuration-files + (default '()))) ;'((file-name-string file-like-object) ...) (define (network-manager-activation config) ;; Activation gexp for NetworkManager (match-record config - (network-manager dns vpn-plugins) + (network-manager dns vpn-plugins extra-configuration-files) #~(begin (use-modules (guix build utils)) (mkdir-p "/etc/NetworkManager/system-connections") #$@(if (equal? dns "dnsmasq") ;; create directory to store dnsmasq lease file '((mkdir-p "/var/lib/misc")) + '()) + #$@(if (pair? extra-configuration-files) ;if non-empty + `((symlink + ,(file-union "network-manager-configuration-directory" + extra-configuration-files) + "/etc/NetworkManager/conf.d")) '())))) (define (vpn-plugin-directory plugins)