mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
services: network-manager: Add extra-configuration-files field.
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 (<network-manager-configuration>) [extra-configuration-files]: New field. (network-manager-activation): Honor the new field. * doc/guix.texi (Networking Setup): Document the new field. Change-Id: I07479958e4d0aa318328c666a9630b779230b300 Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
parent
51720d1afa
commit
0caba8f5db
2 changed files with 34 additions and 2 deletions
|
@ -21636,6 +21636,28 @@ This is the list of available plugins for virtual private networks
|
||||||
(VPNs). An example of this is the @code{network-manager-openvpn}
|
(VPNs). An example of this is the @code{network-manager-openvpn}
|
||||||
package, which allows NetworkManager to manage VPNs @i{via} 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 the
|
||||||
|
@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 @samp{man 5
|
||||||
|
NetworkManager.conf}.
|
||||||
|
|
||||||
|
For example, to add two files named @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\n"))))))
|
||||||
|
@end lisp
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
@end deftp
|
@end deftp
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
|
;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
|
||||||
;;; Copyright © 2023 muradm <mail@muradm.net>
|
;;; Copyright © 2023 muradm <mail@muradm.net>
|
||||||
;;; Copyright © 2024 Nigko Yerden <nigko.yerden@gmail.com>
|
;;; Copyright © 2024 Nigko Yerden <nigko.yerden@gmail.com>
|
||||||
|
;;; Copyright © 2025 45mg <45mg.writes@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -1253,18 +1254,27 @@ project's documentation} for more information."
|
||||||
(default '()))
|
(default '()))
|
||||||
(iwd? network-manager-configuration-iwd? ; TODO: deprecated field, remove.
|
(iwd? network-manager-configuration-iwd? ; TODO: deprecated field, remove.
|
||||||
(default #f)
|
(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)
|
(define (network-manager-activation config)
|
||||||
;; Activation gexp for NetworkManager
|
;; Activation gexp for NetworkManager
|
||||||
(match-record config <network-manager-configuration>
|
(match-record config <network-manager-configuration>
|
||||||
(network-manager dns vpn-plugins)
|
(network-manager dns vpn-plugins extra-configuration-files)
|
||||||
#~(begin
|
#~(begin
|
||||||
(use-modules (guix build utils))
|
(use-modules (guix build utils))
|
||||||
(mkdir-p "/etc/NetworkManager/system-connections")
|
(mkdir-p "/etc/NetworkManager/system-connections")
|
||||||
#$@(if (equal? dns "dnsmasq")
|
#$@(if (equal? dns "dnsmasq")
|
||||||
;; create directory to store dnsmasq lease file
|
;; create directory to store dnsmasq lease file
|
||||||
'((mkdir-p "/var/lib/misc"))
|
'((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)
|
(define (vpn-plugin-directory plugins)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue