aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Abramov <levenson@mmer.org>2025-05-08 19:47:41 +0200
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2025-05-16 17:01:11 +0900
commit6d5f630fa55923f9c7d9725e47c1eb7a63c29f41 (patch)
treed502423d5c02c36a820e5d68988e7b1e5fc77ecc
parentefac01f19b65d7d77a98bbfd57fe2073fb13064a (diff)
downloadguix-6d5f630fa55923f9c7d9725e47c1eb7a63c29f41.tar.gz
guix-6d5f630fa55923f9c7d9725e47c1eb7a63c29f41.zip
services: dnsmasq: Add shepherd-provision and shepherd-requirement fields.
* gnu/services/dns.scm (<dnsmasq-configuration>)[provision]: Mark filed as deprecated with a warning. Set default to #f. [shepherd-provision]: Add new field for consistency with other services. [shepherd-requirement]: Add new field. (dnsmasq-shepherd-service): Use them. * doc/guix.texi: Document these changes. * doc/guix-cookbook.texi (Custom NAT-based network for libvirt): Update example to use 'shepherd-provision' instead of 'provision'. Change-Id: Icad4d9c4be5bf58368e8c416f1fdde1f9065557d Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
-rw-r--r--doc/guix-cookbook.texi4
-rw-r--r--doc/guix.texi11
-rw-r--r--gnu/services/dns.scm24
3 files changed, 30 insertions, 9 deletions
diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi
index fb58866d40..3ebe661a07 100644
--- a/doc/guix-cookbook.texi
+++ b/doc/guix-cookbook.texi
@@ -4018,8 +4018,8 @@ guests connected to this virtual network switch:
(service dnsmasq-service-type
(dnsmasq-configuration
;; You can have multiple instances of `dnsmasq-service-type` as long
- ;; as each one has a different provision.
- (provision '(dnsmasq-virbr0))
+ ;; as each one has a different shepherd-provision.
+ (shepherd-provision '(dnsmasq-virbr0))
(extra-options (list
;; Only bind to the virtual bridge. This
;; avoids conflicts with other running
diff --git a/doc/guix.texi b/doc/guix.texi
index 34092a2f73..ef5aa94d3c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -36120,9 +36120,14 @@ Data type representing the configuration of dnsmasq.
@item @code{package} (default: @var{dnsmasq})
Package object of the dnsmasq server.
-@item @code{provision} (default: @code{'(dnsmasq)})
-A list of symbols for the Shepherd service corresponding to this dnsmasq
-configuration.
+@item @code{shepherd-provision} (default: @code{'(dnsmasq)})
+@itemx @code{shepherd-requirement} (default: @code{'(user-processes networking)})
+This option can be used to provide a list of Shepherd service names
+(symbols) provided by this service. You might want to change the default
+value if you intend to run several @command{dnsmasq} instances.
+
+Likewise, @code{shepherd-requirement} is a list of Shepherd service names
+(symbols) that this service will depend on.
@item @code{no-hosts?} (default: @code{#f})
When true, don't read the hostnames in /etc/hosts.
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm
index 05291eb65d..fd849d08e8 100644
--- a/gnu/services/dns.scm
+++ b/gnu/services/dns.scm
@@ -27,6 +27,7 @@
#:use-module (gnu system shadow)
#:use-module (gnu packages admin)
#:use-module (gnu packages dns)
+ #:use-module (guix deprecation)
#:use-module (guix packages)
#:use-module (guix records)
#:use-module (guix gexp)
@@ -742,8 +743,13 @@ cache.size = 100 * MB
dnsmasq-configuration?
(package dnsmasq-configuration-package
(default dnsmasq)) ;file-like
- (provision dnsmasq-provision
- (default '(dnsmasq)))
+ (provision dnsmasq-configuration-provision ; deprecated
+ (default #f)
+ (sanitize warn-deprecated-dnsmasq-configuration-provision))
+ (shepherd-provision dnsmasq-configuration-shepherd-provision
+ (default '(dnsmasq)))
+ (shepherd-requirement dnsmasq-configuration-shepherd-requirement
+ (default '(user-processes networking)))
(no-hosts? dnsmasq-configuration-no-hosts?
(default #f)) ;boolean
(port dnsmasq-configuration-port
@@ -799,9 +805,19 @@ cache.size = 100 * MB
(tftp-unique-root dnsmasq-tftp-unique-root
(default #f))) ;"" or "ip" or "mac"
+(define (warn-deprecated-dnsmasq-configuration-provision value)
+ (when (pair? value)
+ (warn-about-deprecation
+ 'provision #f
+ #:replacement 'shepherd-provision))
+ value)
+
(define (dnsmasq-shepherd-service config)
(match-record config <dnsmasq-configuration>
(package
+ provision
+ shepherd-provision
+ shepherd-requirement
no-hosts?
port local-service? listen-addresses
resolv-file no-resolv?
@@ -815,8 +831,8 @@ cache.size = 100 * MB
tftp-lowercase? tftp-port-range
tftp-root tftp-unique-root extra-options)
(shepherd-service
- (provision (dnsmasq-provision config))
- (requirement '(user-processes networking))
+ (provision (or provision shepherd-provision))
+ (requirement shepherd-requirement)
(documentation "Run the dnsmasq DNS server.")
(start #~(make-forkexec-constructor
(list