summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-01-16 11:18:34 +0100
committerLudovic Courtès <ludo@gnu.org>2019-01-16 14:07:37 +0100
commit2e04ab7147948b51d4e437ca9ba910530ac2a788 (patch)
tree47f8b503f775d43766afe7098911e09e28911971 /gnu
parent39ad752cf9d2e2044ea8f4fc28bddfd9ad69f2c0 (diff)
downloadguix-2e04ab7147948b51d4e437ca9ba910530ac2a788.tar.gz
services: avahi: Deprecate the 'avahi-service' procedure.
* gnu/services/avahi.scm (<avahi-configuration>): Export getters.  Add
default values.
(avahi-service-type)[default-value]: New field.
(avahi-service): Mark as deprecated.
* gnu/services/desktop.scm (%desktop-services): Use the 'service' form
instead of calling 'avahi-service'.
* gnu/tests/base.scm (%avahi-os): Likewise.
* doc/guix.texi (Base Services): Adjust example accordingly.
(Networking Services): Update accordingly.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/avahi.scm52
-rw-r--r--gnu/services/desktop.scm4
-rw-r--r--gnu/tests/base.scm3
3 files changed, 40 insertions, 19 deletions
diff --git a/gnu/services/avahi.scm b/gnu/services/avahi.scm
index 5de30ffb97..547d826551 100644
--- a/gnu/services/avahi.scm
+++ b/gnu/services/avahi.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,9 +24,22 @@
   #:use-module (gnu system shadow)
   #:use-module (gnu packages avahi)
   #:use-module (gnu packages admin)
+  #:use-module (guix deprecation)
   #:use-module (guix records)
   #:use-module (guix gexp)
   #:export (avahi-configuration
+            avahi-configuration?
+
+            avahi-configuration-avahi
+            avahi-configuration-debug?
+            avahi-configuration-host-name
+            avahi-configuration-publish?
+            avahi-configuration-publish-workstation?
+            avahi-configuration-ipv4?
+            avahi-configuration-ipv6?
+            avahi-configuration-wide-area?
+            avahi-configuration-domains-to-browse
+
             avahi-service
             avahi-service-type))
 
@@ -37,7 +50,6 @@
 ;;;
 ;;; Code:
 
-  ;; TODO: Export.
 (define-record-type* <avahi-configuration>
   avahi-configuration make-avahi-configuration
   avahi-configuration?
@@ -45,18 +57,24 @@
                      (default avahi))
   (debug?            avahi-configuration-debug?   ;Boolean
                      (default #f))
-  (host-name         avahi-configuration-host-name) ;string
-  (publish?          avahi-configuration-publish?)  ;Boolean
+  (host-name         avahi-configuration-host-name ;string | #f
+                     (default #f))
+  (publish?          avahi-configuration-publish? ;boolean
+                     (default #t))
 
   ;; The default for this was #t in Avahi 0.6.31 and became #f in 0.7.  For
   ;; now we stick to the old default.
   (publish-workstation? avahi-configuration-publish-workstation? ;Boolean
                         (default #t))
 
-  (ipv4?             avahi-configuration-ipv4?)     ;Boolean
-  (ipv6?             avahi-configuration-ipv6?)     ;Boolean
-  (wide-area?        avahi-configuration-wide-area?) ;Boolean
-  (domains-to-browse avahi-configuration-domains-to-browse)) ;list of strings
+  (ipv4?             avahi-configuration-ipv4?    ;Boolean
+                     (default #t))
+  (ipv6?             avahi-configuration-ipv6?    ;Boolean
+                     (default #t))
+  (wide-area?        avahi-configuration-wide-area? ;Boolean
+                     (default #f))
+  (domains-to-browse avahi-configuration-domains-to-browse ;list of strings
+                     (default '())))
 
 (define* (configuration-file config)
   "Return an avahi-daemon configuration file based on CONFIG, an
@@ -145,14 +163,16 @@ service switch (NSS) with support for @code{.local} host name resolution.")
                          ;; Provide 'avahi-browse', 'avahi-resolve', etc. in
                          ;; the system profile.
                          (service-extension profile-service-type
-                                            avahi-package))))))
-
-(define* (avahi-service #:key (avahi avahi) debug?
-                        host-name
-                        (publish? #t)
-                        (ipv4? #t) (ipv6? #t)
-                        wide-area?
-                        (domains-to-browse '()))
+                                            avahi-package)))
+                  (default-value (avahi-configuration)))))
+
+(define-deprecated (avahi-service #:key (avahi avahi) debug?
+                                  host-name
+                                  (publish? #t)
+                                  (ipv4? #t) (ipv6? #t)
+                                  wide-area?
+                                  (domains-to-browse '()))
+  avahi-service-type
   "Return a service that runs @command{avahi-daemon}, a system-wide
 mDNS/DNS-SD responder that allows for service discovery and
 \"zero-configuration\" host name lookups (see @uref{http://avahi.org/}), and
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 47d1096c6d..2d5e900658 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
@@ -986,7 +986,7 @@ as expected.")))
          ;; The D-Bus clique.
          (service network-manager-service-type)
          (service wpa-supplicant-service-type)    ;needed by NetworkManager
-         (avahi-service)
+         (service avahi-service-type)
          (udisks-service)
          (upower-service)
          (accountsservice-service)
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 2b20aac1dc..0f8fb7f456 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -706,7 +706,8 @@ non-ASCII names from /tmp.")
   (operating-system
     (inherit %simple-os)
     (name-service-switch %mdns-host-lookup-nss)
-    (services (cons* (avahi-service #:debug? #t)
+    (services (cons* (service avahi-service-type
+                              (avahi-configuration (debug? #t)))
                      (dbus-service)
                      (service dhcp-client-service-type) ;needed for multicast