guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/05: nss: Add '%mdns-host-lookup-nss'.


From: Ludovic Courtès
Subject: 01/05: nss: Add '%mdns-host-lookup-nss'.
Date: Fri, 08 May 2015 14:35:39 +0000

civodul pushed a commit to branch master
in repository guix.

commit 15137a29c23e4beab7641b6c6191fdff9716dea4
Author: Ludovic Courtès <address@hidden>
Date:   Fri May 8 14:59:00 2015 +0200

    nss: Add '%mdns-host-lookup-nss'.
    
    * gnu/system/nss.scm (%mdns-host-lookup-nss): New variable.
    * doc/guix.texi (Name Service Switch): Document it.
---
 doc/guix.texi      |   24 +++++++++++++++++++-----
 gnu/system/nss.scm |   23 +++++++++++++++++++++++
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 2d02a04..8e36ce3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5180,6 +5180,10 @@ for host names ending in @code{.local}:
                   (name "mdns")))))
 @end example
 
+Don't worry: the @code{%mdns-host-lookup-nss} variable (see below)
+contains this configuration, so you won't have to type it if all you
+want is to have @code{.local} host lookup working.
+
 Note that, in this case, in addition to setting the
 @code{name-service-switch} of the @code{operating-system} declaration,
 @code{nscd-service} must be told where to find the @code{nss-mdns}
@@ -5207,6 +5211,21 @@ configuration file:
 @noindent
 @dots{} and then refer to @var{%my-base-services} instead of
 @var{%base-services} in the @code{operating-system} declaration.
+Lastly, this relies on the availability of the Avahi service
+(@pxref{Desktop Services, @code{avahi-service}}).
+
+For convenience, the following variables provide typical NSS
+configurations.
+
address@hidden {Scheme Variable} %default-nss
+This is the default name service switch configuration, a
address@hidden object.
address@hidden defvr
+
address@hidden {Scheme Variable} %mdns-host-lookup-nss
+This is the name service switch configuration with support for host name
+lookup over multicast DNS (mDNS) for host names ending in @code{.local}.
address@hidden defvr
 
 The reference for name service switch configuration is given below.  It
 is a direct mapping of the C library's configuration file format, so
@@ -5217,11 +5236,6 @@ not only of adding this warm parenthetic feel that we 
like, but also
 static checks: you'll know about syntax errors and typos as soon as you
 run @command{guix system}.
 
address@hidden {Scheme Variable} %default-nss
-This is the default name service switch configuration, a
address@hidden object.
address@hidden defvr
-
 @deftp {Data Type} name-service-switch
 
 This is the data type representation the configuration of libc's name
diff --git a/gnu/system/nss.scm b/gnu/system/nss.scm
index ec2d251..f4d2855 100644
--- a/gnu/system/nss.scm
+++ b/gnu/system/nss.scm
@@ -29,6 +29,8 @@
             lookup-specification
 
             %default-nss
+            %mdns-host-lookup-nss
+
             %files
             %compat
             %dns
@@ -148,6 +150,27 @@
   ;; Default NSS configuration.
   (name-service-switch))
 
+(define %mdns-host-lookup-nss
+  (name-service-switch
+    (hosts (list %files                           ;first, check /etc/hosts
+
+                 ;; If the above did not succeed, try with 'mdns_minimal'.
+                 (name-service
+                   (name "mdns_minimal")
+
+                   ;; 'mdns_minimal' is authoritative for '.local'.  When it
+                   ;; returns "not found", no need to try the next methods.
+                   (reaction (lookup-specification
+                              (not-found => return))))
+
+                 ;; Then fall back to DNS.
+                 (name-service
+                   (name "dns"))
+
+                 ;; Finally, try with the "full" 'mdns'.
+                 (name-service
+                   (name "mdns"))))))
+
 
 ;;;
 ;;; Serialization.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]