From patchwork Sat Feb 1 19:49:26 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: 38156 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 AA65127BBE2; Sat, 1 Feb 2025 19:52:36 +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=-6.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_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 056A327BBE9 for ; Sat, 1 Feb 2025 19:52:34 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1teJXA-00059r-8N; Sat, 01 Feb 2025 14:52:04 -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 1teJX8-00059Y-HA for guix-patches@gnu.org; Sat, 01 Feb 2025 14:52:02 -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 1teJX8-0005Ir-67; Sat, 01 Feb 2025 14:52:02 -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=JRJSkwr1N2/DEjqSkjEQlvi+8vAwTv0rlVVKqTI9XIw=; b=Fi3AGIZCEjWzQcN9YRykdNTKwayrFjPiWwa+OBOW9wg3nT+6pz+xkH1TOP2tZ1vuBqGoeJAgewmctJ3k5r/F9aOoF0RA7nYBougjJh9L6K+zyrfmJfgCy/61t7G66OZGRCvaxkHRa9KoRhhTTYI3IiivRrAdqYoONEISUBT/Eh0DY9gkoELSI8GoVt+b6Q3xTthCe966BEJNwKuQdymqzl0ZuyR55xs2ZZE24UBnnouRFeDx/1uf2ymz3pS70V4CVBU513F2hpWBh6hhgleKcOHchXxwB+HshxshEYgu6KIEjg9lfJ6TGC5cZh6U9fYDcdaz9hRsT0kkpTUc8XDgSA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1teJX7-0003hW-KI; Sat, 01 Feb 2025 14:52:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75145] [PATCH v3] 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: Sat, 01 Feb 2025 19:52: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 Cc: Arnaud Daby-Seesaram , 45mg <45mg.writes@gmail.com>, Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer , 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.173843950514202 (code B ref 75145); Sat, 01 Feb 2025 19:52:01 +0000 Received: (at 75145) by debbugs.gnu.org; 1 Feb 2025 19:51:45 +0000 Received: from localhost ([127.0.0.1]:60076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1teJWr-0003gu-Ae for submit@debbugs.gnu.org; Sat, 01 Feb 2025 14:51:45 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:61792) 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 1teJWl-0003gc-QT for 75145@debbugs.gnu.org; Sat, 01 Feb 2025 14:51:43 -0500 Received: by mail-pl1-x643.google.com with SMTP id d9443c01a7336-21669fd5c7cso53725125ad.3 for <75145@debbugs.gnu.org>; Sat, 01 Feb 2025 11:51:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738439493; x=1739044293; 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=JRJSkwr1N2/DEjqSkjEQlvi+8vAwTv0rlVVKqTI9XIw=; b=GS8gvko9cqGuRHXFGsovPnQcaAcnFWLAEl58Xw/Pcp9y1B+O9Khk3p3fF3LHJsyZi2 4tQPZCMOtTs5E1/hHZ94TFgNk0PrlsiIXNwvj7ej+lYZZMvO92dpPPSaX6lbAu4FI9qd otWrM2fKSWQopjOyMUotj9MKNyk69qWHh4srjNlhjf+t7Qx0kIvGIy8UqA2Jfp9klq5X ghLBgL0+DuCCpcFLxss0OCNfcUoUJTTaHBQeQKxIA5+XfR9EmQrEQHNjcFMRE18hWgDM owc0MECxYCpzystbI3sN/TdqjUT6DdGzpDvK+wy8V+N3AvKMSomQQJBRkO+Wfsdfky+T OwLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738439493; x=1739044293; 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=JRJSkwr1N2/DEjqSkjEQlvi+8vAwTv0rlVVKqTI9XIw=; b=rtZDJiav1MnRhWAZEWHnOn34GcRFACFtDdBhv+wr+diVVDl5bvHNRHNkO1KlVqUKSN SySdn81fvpHLhxNg6TxHiiwE/NXZ0nZ/6nwmFg+vCVl/iWhLEacx6poSxdfJoUF4GmD5 aZd46Dw6ukXaT76CVaEUx/OqSDE9mOZ7mHAYZal8AKCnVJeKndrLGMMKA7j7e5PrhzKe /IvZw+U2fVPAq8nqOUwN/LmX4gvi2dx6ISqJc+gYfKcRRWeJPoVo+96wSYtPOjaEcN23 PnKzW55O9XNQ4NV/fc13Ucc9iZLUZSbeM8QT1VooNvcTDqmEoZC0NTv+zqvlRJ46UEW8 8cNg== X-Gm-Message-State: AOJu0YzCYldIojwmSTRYmCibiHa/DXXlJ+Oww3RHaas6VtF/moK2Wjk0 PvHMVvFRwUcvyhHeN0ZdCLqQb+YOpZuIqrJSbn3E8AWL8mpdzsbygDvrdqfs X-Gm-Gg: ASbGncsF/5OGBjrCOO1fEPMHAE22KIj4A6WPSo+V2o3qqONHzH9RiDi0HG9HyKxkDN/ vV/oQePMPWOjBALSKZ3xMatqO+FAgC7UiOgiOAd8FuSfaBRzaSkWc3iNGfTk0QfKh02CQ7DRE8E lGFj57MqpTakyN8H4BhEieB69L2ESrXSbVa6vbEQP7YH0QcaABGMwZmPCRTztVtQqNXfJhYieSz snvJ9TeKS2nfc4YP6yPXMus151Uh45uok4B9fwkqYEog0elRzym1Qhq0HEiJHGIwR7vnOcJcX7m VawmQ5ymFdPS0Sq6J/BvQvX6yNP8loB1Z/9axA== X-Google-Smtp-Source: AGHT+IFbT+rXtk2fyAREZLOp2F3EUUcexEmW51jyJM7zkQIRx6ZSeQNjU/C8fpS653c3jWgxSeLotA== X-Received: by 2002:a05:6a00:1396:b0:725:db34:6a7d with SMTP id d2e1a72fcca58-72fd0c7c6c5mr23351201b3a.23.1738439493128; Sat, 01 Feb 2025 11:51:33 -0800 (PST) Received: from localhost.localdomain (utm3.nitt.edu. [14.139.162.2]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72fe69cebbcsm5482856b3a.130.2025.02.01.11.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Feb 2025 11:51:32 -0800 (PST) From: 45mg <45mg.writes@gmail.com> Date: Sun, 2 Feb 2025 01:19:26 +0530 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: <87wmeos4l0.fsf@gmail.com> References: <87wmeos4l0.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 | 21 +++++++++++++++++++++ gnu/services/networking.scm | 13 +++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) base-commit: b85d20e853192a92093cd8d6a5756ec80e94c658 diff --git a/doc/guix.texi b/doc/guix.texi index b1b6d98e74..58ce4663c3 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21541,6 +21541,27 @@ 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{'()}) +An alist of file names to file-like objects, representing 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..4e455cc114 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 '()))) ;alist of file names to file-like objects (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 extra-configuration-files + `((symlink + ,(file-union "network-manager-configuration-directory" + extra-configuration-files) + "/etc/NetworkManager/conf.d")) '())))) (define (vpn-plugin-directory plugins)