summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-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.