diff options
| author | Alexey Abramov <levenson@mmer.org> | 2025-05-08 19:47:41 +0200 |
|---|---|---|
| committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2025-05-16 17:01:11 +0900 |
| commit | 6d5f630fa55923f9c7d9725e47c1eb7a63c29f41 (patch) | |
| tree | d502423d5c02c36a820e5d68988e7b1e5fc77ecc | |
| parent | efac01f19b65d7d77a98bbfd57fe2073fb13064a (diff) | |
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.texi | 4 | ||||
| -rw-r--r-- | doc/guix.texi | 11 | ||||
| -rw-r--r-- | gnu/services/dns.scm | 24 |
3 files changed, 30 insertions, 9 deletions
diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index fb58866d404..3ebe661a078 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi | |||
| @@ -4018,8 +4018,8 @@ guests connected to this virtual network switch: | |||
| 4018 | (service dnsmasq-service-type | 4018 | (service dnsmasq-service-type |
| 4019 | (dnsmasq-configuration | 4019 | (dnsmasq-configuration |
| 4020 | ;; You can have multiple instances of `dnsmasq-service-type` as long | 4020 | ;; You can have multiple instances of `dnsmasq-service-type` as long |
| 4021 | ;; as each one has a different provision. | 4021 | ;; as each one has a different shepherd-provision. |
| 4022 | (provision '(dnsmasq-virbr0)) | 4022 | (shepherd-provision '(dnsmasq-virbr0)) |
| 4023 | (extra-options (list | 4023 | (extra-options (list |
| 4024 | ;; Only bind to the virtual bridge. This | 4024 | ;; Only bind to the virtual bridge. This |
| 4025 | ;; avoids conflicts with other running | 4025 | ;; avoids conflicts with other running |
diff --git a/doc/guix.texi b/doc/guix.texi index 34092a2f735..ef5aa94d3c0 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -36120,9 +36120,14 @@ Data type representing the configuration of dnsmasq. | |||
| 36120 | @item @code{package} (default: @var{dnsmasq}) | 36120 | @item @code{package} (default: @var{dnsmasq}) |
| 36121 | Package object of the dnsmasq server. | 36121 | Package object of the dnsmasq server. |
| 36122 | 36122 | ||
| 36123 | @item @code{provision} (default: @code{'(dnsmasq)}) | 36123 | @item @code{shepherd-provision} (default: @code{'(dnsmasq)}) |
| 36124 | A list of symbols for the Shepherd service corresponding to this dnsmasq | 36124 | @itemx @code{shepherd-requirement} (default: @code{'(user-processes networking)}) |
| 36125 | configuration. | 36125 | This option can be used to provide a list of Shepherd service names |
| 36126 | (symbols) provided by this service. You might want to change the default | ||
| 36127 | value if you intend to run several @command{dnsmasq} instances. | ||
| 36128 | |||
| 36129 | Likewise, @code{shepherd-requirement} is a list of Shepherd service names | ||
| 36130 | (symbols) that this service will depend on. | ||
| 36126 | 36131 | ||
| 36127 | @item @code{no-hosts?} (default: @code{#f}) | 36132 | @item @code{no-hosts?} (default: @code{#f}) |
| 36128 | When true, don't read the hostnames in /etc/hosts. | 36133 | When true, don't read the hostnames in /etc/hosts. |
diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm index 05291eb65d9..fd849d08e89 100644 --- a/gnu/services/dns.scm +++ b/gnu/services/dns.scm | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #:use-module (gnu system shadow) | 27 | #:use-module (gnu system shadow) |
| 28 | #:use-module (gnu packages admin) | 28 | #:use-module (gnu packages admin) |
| 29 | #:use-module (gnu packages dns) | 29 | #:use-module (gnu packages dns) |
| 30 | #:use-module (guix deprecation) | ||
| 30 | #:use-module (guix packages) | 31 | #:use-module (guix packages) |
| 31 | #:use-module (guix records) | 32 | #:use-module (guix records) |
| 32 | #:use-module (guix gexp) | 33 | #:use-module (guix gexp) |
| @@ -742,8 +743,13 @@ cache.size = 100 * MB | |||
| 742 | dnsmasq-configuration? | 743 | dnsmasq-configuration? |
| 743 | (package dnsmasq-configuration-package | 744 | (package dnsmasq-configuration-package |
| 744 | (default dnsmasq)) ;file-like | 745 | (default dnsmasq)) ;file-like |
| 745 | (provision dnsmasq-provision | 746 | (provision dnsmasq-configuration-provision ; deprecated |
| 746 | (default '(dnsmasq))) | 747 | (default #f) |
| 748 | (sanitize warn-deprecated-dnsmasq-configuration-provision)) | ||
| 749 | (shepherd-provision dnsmasq-configuration-shepherd-provision | ||
| 750 | (default '(dnsmasq))) | ||
| 751 | (shepherd-requirement dnsmasq-configuration-shepherd-requirement | ||
| 752 | (default '(user-processes networking))) | ||
| 747 | (no-hosts? dnsmasq-configuration-no-hosts? | 753 | (no-hosts? dnsmasq-configuration-no-hosts? |
| 748 | (default #f)) ;boolean | 754 | (default #f)) ;boolean |
| 749 | (port dnsmasq-configuration-port | 755 | (port dnsmasq-configuration-port |
| @@ -799,9 +805,19 @@ cache.size = 100 * MB | |||
| 799 | (tftp-unique-root dnsmasq-tftp-unique-root | 805 | (tftp-unique-root dnsmasq-tftp-unique-root |
| 800 | (default #f))) ;"" or "ip" or "mac" | 806 | (default #f))) ;"" or "ip" or "mac" |
| 801 | 807 | ||
| 808 | (define (warn-deprecated-dnsmasq-configuration-provision value) | ||
| 809 | (when (pair? value) | ||
| 810 | (warn-about-deprecation | ||
| 811 | 'provision #f | ||
| 812 | #:replacement 'shepherd-provision)) | ||
| 813 | value) | ||
| 814 | |||
| 802 | (define (dnsmasq-shepherd-service config) | 815 | (define (dnsmasq-shepherd-service config) |
| 803 | (match-record config <dnsmasq-configuration> | 816 | (match-record config <dnsmasq-configuration> |
| 804 | (package | 817 | (package |
| 818 | provision | ||
| 819 | shepherd-provision | ||
| 820 | shepherd-requirement | ||
| 805 | no-hosts? | 821 | no-hosts? |
| 806 | port local-service? listen-addresses | 822 | port local-service? listen-addresses |
| 807 | resolv-file no-resolv? | 823 | resolv-file no-resolv? |
| @@ -815,8 +831,8 @@ cache.size = 100 * MB | |||
| 815 | tftp-lowercase? tftp-port-range | 831 | tftp-lowercase? tftp-port-range |
| 816 | tftp-root tftp-unique-root extra-options) | 832 | tftp-root tftp-unique-root extra-options) |
| 817 | (shepherd-service | 833 | (shepherd-service |
| 818 | (provision (dnsmasq-provision config)) | 834 | (provision (or provision shepherd-provision)) |
| 819 | (requirement '(user-processes networking)) | 835 | (requirement shepherd-requirement) |
| 820 | (documentation "Run the dnsmasq DNS server.") | 836 | (documentation "Run the dnsmasq DNS server.") |
| 821 | (start #~(make-forkexec-constructor | 837 | (start #~(make-forkexec-constructor |
| 822 | (list | 838 | (list |
