summary refs log tree commit diff
path: root/gnu/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-05-08 14:59:00 +0200
committerLudovic Courtès <ludo@gnu.org>2015-05-08 16:35:32 +0200
commit15137a29c23e4beab7641b6c6191fdff9716dea4 (patch)
tree0bbe0f45d3c5c2970d12a7ef75b457bcc053fecf /gnu/system
parent6b888efff627c0e50f45e22a6408a02232d3b87f (diff)
downloadguix-15137a29c23e4beab7641b6c6191fdff9716dea4.tar.gz
nss: Add '%mdns-host-lookup-nss'.
* gnu/system/nss.scm (%mdns-host-lookup-nss): New variable.
* doc/guix.texi (Name Service Switch): Document it.
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/nss.scm23
1 files changed, 23 insertions, 0 deletions
diff --git a/gnu/system/nss.scm b/gnu/system/nss.scm
index ec2d2517e7..f4d2855289 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.