diff mbox series

[bug#45023] install: Discover local substitute servers.

Message ID 20201203140155.166988-1-othacehe@gnu.org
State Accepted
Headers show
Series [bug#45023] install: Discover local substitute servers. | expand

Checks

Context Check Description
cbaines/submitting builds success
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Mathieu Othacehe Dec. 3, 2020, 2:01 p.m. UTC
* gnu/system/install.scm (%installation-services): Add avahi-service-type and
enable substitute server discover in guix-service-type.
[<name-service-switch>]: Set it to %mdns-host-lookup-nss.
---

Hello,

This allows the installation image to use local substitute servers discovered
using Avahi.

It only increases the image closure by 10MiB.

Thanks,

Mathieu

 gnu/system/install.scm | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index 7701297411..7720a42c60 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -34,6 +34,7 @@ 
   #:use-module ((guix store) #:select (%store-prefix))
   #:use-module (gnu installer)
   #:use-module (gnu system locale)
+  #:use-module (gnu services avahi)
   #:use-module (gnu services dbus)
   #:use-module (gnu services networking)
   #:use-module (gnu services shepherd)
@@ -335,11 +336,18 @@  Access documentation at any time by pressing Alt-F2.\x1b[0m
           ;; The usual services.
           (syslog-service)
 
+          ;; Use the Avahi daemon to discover substitute servers on the local
+          ;; network.  It can be faster than fetching from remote servers.
+          (service avahi-service-type
+                   (avahi-configuration (debug? #t)))
+
           ;; The build daemon.  Register the default substitute server key(s)
-          ;; as trusted to allow the installation process to use substitutes by
-          ;; default.
+          ;; as trusted to allow the installation process to use substitutes
+          ;; by default.
           (service guix-service-type
-                   (guix-configuration (authorize-key? #t)))
+                   (guix-configuration
+                    (authorize-key? #t)
+                    (discover? #t))) ;see above.
 
           ;; Start udev so that useful device nodes are available.
           ;; Use device-mapper rules for cryptsetup & co; enable the CRDA for
@@ -435,6 +443,7 @@  Access documentation at any time by pressing Alt-F2.\x1b[0m
     (host-name "gnu")
     (timezone "Europe/Paris")
     (locale "en_US.utf8")
+    (name-service-switch %mdns-host-lookup-nss)
     (bootloader (bootloader-configuration
                  (bootloader grub-bootloader)
                  (target "/dev/sda")))