From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id yPj1JU7Af2dDMgAAe85BDQ:P1 (envelope-from ) for ; Thu, 09 Jan 2025 12:25:50 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id yPj1JU7Af2dDMgAAe85BDQ (envelope-from ) for ; Thu, 09 Jan 2025 13:25:50 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aBEHn6SZ; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1736425550; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=Af0w2rz/Vax1gn/d5cOIoCrQ68IsBq72QhtbVcKloAw=; b=AnMp1oVz5AGI7glCiH/fMaNNVvoSJjDXMCUgvugTD8iiNJHQQz2LjU73CaM2Eod7YgBSmA OInc4PhVZKEU0/f3lgSYNIt/oIzIEXitAkCfMZSXiObOPXKwNCaEqNOwm8gPy7yCSkkx9D PQLgiScSw5mu31JGc87J7juKWutfMlY8nNnRMd2lVFk1NS21w49Gj8s+ZmcI/nBN1qMK7b Tn4DYFRf0NZJgD/Zz/nyr92pbv8WwC0gOkn2ZQLU6Ar40Vj5ETLMNUngukEuWK/xRx8n5U WrGeInnczfok/WcE2HhZZijR4le7dsn5wcbFzUuY1Xo/qKJiGxbr5Rf4laby6g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aBEHn6SZ; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1736425550; a=rsa-sha256; cv=none; b=Jw5Rrj4EcClc6c1p4vid/rKVqt4If4dpVKFRi15W7LT4YbOahBCx7tdwxmhzXfuv67aN33 7wVX3pMXVhRjyEyTrHKOrrWESWtEjfimULE3cZfDyw1vAZE+sONCQ+HP9SQFTPXNEFgcaa AOpmjj+aJbrvwZVIbMHEoTn+DVHeR1Ogqi6w852e41Mi2sqoIotwTLSrqMf53VKW042ipi XhGiruBIHy5xzbPAGrcmRTalhsnNOiH7+RD9F1QmPluh/WrNn+sH+5gYjE8vFiNmcKfOJQ MlMx/Ry196yXvl7k7Wh1CSHaNGxmf6KP03Sg1QU+Oam22CPAyKMaAU+jXBcmzg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id ECCFE5E4A5 for ; Thu, 09 Jan 2025 13:25:49 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVrbE-000348-4m; Thu, 09 Jan 2025 07:25:20 -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 <45mg.writes@gmail.com>) id 1tVrb9-00033k-MU for guix-devel@gnu.org; Thu, 09 Jan 2025 07:25:16 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <45mg.writes@gmail.com>) id 1tVrb3-0000o5-TY for guix-devel@gnu.org; Thu, 09 Jan 2025 07:25:12 -0500 Received: by mail-pl1-x644.google.com with SMTP id d9443c01a7336-2166360285dso12865235ad.1 for ; Thu, 09 Jan 2025 04:25:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736425508; x=1737030308; darn=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=Af0w2rz/Vax1gn/d5cOIoCrQ68IsBq72QhtbVcKloAw=; b=aBEHn6SZdTuhR63NlLL2uA6Kb5/842rHTyj6tE/rVZnX5CUUYzCbsgpMmeyjCXJfCj Bfw+qABl93gMND4T2IiaQDKuVyORNBVmQ/QgIFRnejIgtjuw0CU1dwK/y4Adaaj6UHRT 2WpoSQFXDpJsz/CttVkdd+CrJOhZAutgjy2NjLH++2JipanXV0SX739v8IchDNFkU+8S EbzV18QMUawCrNP/GNtheo/YbsT2HIlGjRCG6OwW1+lCOWgASd0IBhm6opTbm5dL+bo7 7W+YxWM1+1MjgZ3SHR3dU66+M2EmWhkOAsRb1fmlaTh+RFPJlA4HYoUNtAI8UJL5ZBWW pP7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736425508; x=1737030308; 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=Af0w2rz/Vax1gn/d5cOIoCrQ68IsBq72QhtbVcKloAw=; b=Fs/M733jG4UrsrB+5xEfR7mbx0vUz6qsPosbP497beRBgcEsOLq7uFgXXFVmxH77x5 M9VgeBaWE0HwCv8HE4+PB09PyUY4r/mLYhV4yLSphg59M3aI/zRAt7pbzqIAy/Y+QfeQ 5THXPDRFakVXr1LeyDHumey8PRpBMDNu79AH1Lq3I1sqUS6pXOOPbFufXAuv5Z04XrPi MDk2c4MG70pR+pHwjMHLr60/jKDSZJMJmM6DYTEpxOdwcuYyh20ahvUy5bhV+N86rLK0 3YgBdt6RoEwhB2aqxYIcWXEWYVhk6lk+wf5aWhENgtUmFvPZ50HEJiiNagozMb/UrJb8 hhcg== X-Gm-Message-State: AOJu0Yw9kHKkOdbDz5bUDBlM4kApap3XT41jJ60ZF/a9w4ASCPfGX/Fj nMChXyi/iZgVTxE+qXX+5wjgS6ZuFKiRz26reyZnnZcb8htcsdNAalmnPXNo X-Gm-Gg: ASbGnctfgzCF0v1Z96uIUxx/wUuoir23VEyF+YxfddPRrI5WNVqAZLUsGFw/8vrHqrU heltDvCbeWQXYjEy9NKJGf4zWPSS7oBl6pLk1fJ3toIujdpOsb4QANLKsCvXI+rrDUlg992EKTk AyjsEW7VkYbPaKhICXvD4Y3hmckOMucU7Q18Ir4Y6RWIu9chVsrpupmdpnMWW1xDTq5nxlmDbPV 8Pdg+pe0T1A1Om9gmfmKR7uXUPFEOassDKbw/hKSJdJvzuwd793zjnL0tfItYc1+gMCqBL5qDsW YI4= X-Google-Smtp-Source: AGHT+IFOMLXsdm4h/FyGD/5ohNWgnC5XRTJg1tsO458mi6xl8BXMQxywzhwdPFFYh2SSAvnbDMDBBQ== X-Received: by 2002:a17:902:e84c:b0:215:4757:9ef3 with SMTP id d9443c01a7336-21a83f338b0mr89063095ad.9.1736425508502; Thu, 09 Jan 2025 04:25:08 -0800 (PST) Received: from localhost.localdomain (utm3.nitt.edu. [14.139.162.2]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21a91768814sm11496435ad.18.2025.01.09.04.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jan 2025 04:25:08 -0800 (PST) From: 45mg <45mg.writes@gmail.com> To: 75145@debbugs.gnu.org Cc: guix-devel@gnu.org, 45mg <45mg.writes@gmail.com> Subject: [PATCH v2 1/1] services: network-manager: Add extra-configuration-files field. Date: Thu, 9 Jan 2025 12:24:31 +0000 Message-ID: <6c5c3ce265d159c862de73a77e985cf30a1f30a8.1736423822.git.45mg.writes@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <7743f403ebf1693fc386a397e9aed1975b43f900.1735323486.git.45mg.writes@gmail.com> References: <7743f403ebf1693fc386a397e9aed1975b43f900.1735323486.git.45mg.writes@gmail.com> MIME-Version: 1.0 X-Debbugs-Cc: Ludovic Courtès , Maxim Cournoyer Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::644; envelope-from=45mg.writes@gmail.com; helo=mail-pl1-x644.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: ECCFE5E4A5 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: 1.53 X-Spam-Score: 1.53 X-TUID: eZ9Ssb2KWF2k 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-configuration-directory): New procedure. (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 | 26 ++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index caebe3b03c..279fdb838b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21455,6 +21455,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 48a86b3694..4355158225 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -1262,18 +1262,40 @@ (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-configuration-directory extra-configuration-files) + "Return a directory containing EXTRA-CONFIGURATION-FILES." + (with-imported-modules (source-module-closure '((guix build utils))) + (computed-file + "network-manager-configuration-directory" + #~(begin + (use-modules (guix build utils)) + (mkdir-p #$output) + (for-each (lambda (pair) + (let* ((filename (list-ref pair 0)) + (file (list-ref pair 1)) + (dest (string-append #$output "/" filename))) + (copy-file file dest))) + '#$extra-configuration-files))))) (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 + ,(network-manager-configuration-directory extra-configuration-files) + "/etc/NetworkManager/conf.d")) '())))) (define (vpn-plugin-directory plugins) -- 2.47.1