[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: install: Discover local substitute servers.
From: |
guix-commits |
Subject: |
branch master updated: install: Discover local substitute servers. |
Date: |
Fri, 11 Dec 2020 15:37:15 -0500 |
This is an automated email from the git hooks/post-receive script.
mothacehe pushed a commit to branch master
in repository guix.
The following commit(s) were added to refs/heads/master by this push:
new 8361817 install: Discover local substitute servers.
8361817 is described below
commit 8361817bf693742757b096468198626f297bb09e
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Fri Dec 4 11:33:16 2020 +0100
install: Discover local substitute servers.
* gnu/installer/substitutes.scm: New file.
* gnu/installer/newt/substitutes.scm: New file.
* gnu/local.mk (INSTALLER_MODULES): Add them.
* po/guix/POTFILES.in: Add gnu/installer/newt/substitutes.scm.
* gnu/installer/proxy.scm (with-silent-shepherd): Move to ...
* gnu/installer/utils.scm: ... here.
* gnu/installer/record.scm (<installer>)[substitutes-page]: New field.
* gnu/installer/newt.scm (substitutes-page): New procedure,
(newt-installer): register it.
* gnu/installer.scm (installer-steps): Add "substitutes-page" step.
* 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.
---
gnu/installer.scm | 7 +++++
gnu/installer/newt.scm | 5 ++++
gnu/installer/newt/substitutes.scm | 43 ++++++++++++++++++++++++++++
gnu/installer/proxy.scm | 6 +---
gnu/installer/record.scm | 3 ++
gnu/installer/{proxy.scm => substitutes.scm} | 20 ++++++-------
gnu/installer/utils.scm | 11 ++++++-
gnu/local.mk | 2 ++
gnu/system/install.scm | 6 ++++
po/guix/POTFILES.in | 1 +
10 files changed, 86 insertions(+), 18 deletions(-)
diff --git a/gnu/installer.scm b/gnu/installer.scm
index f401b24..7863edb 100644
--- a/gnu/installer.scm
+++ b/gnu/installer.scm
@@ -266,6 +266,13 @@ selected keymap."
(compute (lambda _
((installer-network-page current-installer)))))
+ ;; Ask whether to enable substitute server discovery.
+ (installer-step
+ (id 'substitutes)
+ (description (G_ "Substitute server discovery"))
+ (compute (lambda _
+ ((installer-substitutes-page current-installer)))))
+
;; Prompt for users (name, group and home directory).
(installer-step
(id 'user)
diff --git a/gnu/installer/newt.scm b/gnu/installer/newt.scm
index a1cbeca..4f7fc6f 100644
--- a/gnu/installer/newt.scm
+++ b/gnu/installer/newt.scm
@@ -30,6 +30,7 @@
#:use-module (gnu installer newt page)
#:use-module (gnu installer newt partition)
#:use-module (gnu installer newt services)
+ #:use-module (gnu installer newt substitutes)
#:use-module (gnu installer newt timezone)
#:use-module (gnu installer newt user)
#:use-module (gnu installer newt utils)
@@ -101,6 +102,9 @@ problem. The backtrace is displayed below. Please report it
by email to \
(define (network-page)
(run-network-page))
+(define (substitutes-page)
+ (run-substitutes-page))
+
(define (hostname-page)
(run-hostname-page))
@@ -130,6 +134,7 @@ problem. The backtrace is displayed below. Please report it
by email to \
(locale-page locale-page)
(menu-page menu-page)
(network-page network-page)
+ (substitutes-page substitutes-page)
(timezone-page timezone-page)
(hostname-page hostname-page)
(user-page user-page)
diff --git a/gnu/installer/newt/substitutes.scm
b/gnu/installer/newt/substitutes.scm
new file mode 100644
index 0000000..938cb1a
--- /dev/null
+++ b/gnu/installer/newt/substitutes.scm
@@ -0,0 +1,43 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Mathieu Othacehe <othacehe@gnu.org>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu installer newt substitutes)
+ #:use-module (gnu installer substitutes)
+ #:use-module (gnu installer utils)
+ #:use-module (guix i18n)
+ #:use-module (newt)
+ #:use-module (ice-9 match)
+ #:export (run-substitutes-page))
+
+(define* (run-substitutes-page)
+ (match (current-clients)
+ (()
+ (case (choice-window
+ (G_ "Substitute server discovery.")
+ (G_ "Enable") (G_ "Disable")
+ (G_ " By turning this option on, you allow Guix to fetch \
+substitutes (pre-built binaries) during installation from servers \
+discovered on your local area network (LAN) in addition to the official \
+server. This can increase download throughput.
+
+ There are no security risks: only genuine substitutes may be retrieved from \
+those servers. However, eavesdroppers on your LAN may be able to see what \
+software you are installing."))
+ ((1) (enable-discovery))
+ ((2) (disable-discovery))))
+ (_ #f)))
diff --git a/gnu/installer/proxy.scm b/gnu/installer/proxy.scm
index befaf3a..86c8272 100644
--- a/gnu/installer/proxy.scm
+++ b/gnu/installer/proxy.scm
@@ -17,15 +17,11 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu installer proxy)
+ #:use-module (gnu installer utils)
#:use-module (gnu services herd)
#:export (set-http-proxy
clear-http-proxy))
-(define-syntax-rule (with-silent-shepherd exp ...)
- (parameterize ((shepherd-message-port
- (%make-void-port "w")))
- exp ...))
-
(define (set-http-proxy proxy)
(with-silent-shepherd
(with-shepherd-action 'guix-daemon
diff --git a/gnu/installer/record.scm b/gnu/installer/record.scm
index 6ebd87f..0b34318 100644
--- a/gnu/installer/record.scm
+++ b/gnu/installer/record.scm
@@ -33,6 +33,7 @@
installer-locale-page
installer-menu-page
installer-network-page
+ installer-substitutes-page
installer-timezone-page
installer-hostname-page
installer-user-page
@@ -73,6 +74,8 @@
(menu-page installer-menu-page)
;; procedure void -> void
(network-page installer-network-page)
+ ;; procedure void -> void
+ (substitutes-page installer-substitutes-page)
;; procedure (zonetab) -> posix-timezone
(timezone-page installer-timezone-page)
;; procedure void -> void
diff --git a/gnu/installer/proxy.scm b/gnu/installer/substitutes.scm
similarity index 75%
copy from gnu/installer/proxy.scm
copy to gnu/installer/substitutes.scm
index befaf3a..c9a7418 100644
--- a/gnu/installer/proxy.scm
+++ b/gnu/installer/substitutes.scm
@@ -16,27 +16,23 @@
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
-(define-module (gnu installer proxy)
+(define-module (gnu installer substitutes)
+ #:use-module (gnu installer utils)
#:use-module (gnu services herd)
- #:export (set-http-proxy
- clear-http-proxy))
+ #:export (enable-discovery
+ disable-discovery))
-(define-syntax-rule (with-silent-shepherd exp ...)
- (parameterize ((shepherd-message-port
- (%make-void-port "w")))
- exp ...))
-
-(define (set-http-proxy proxy)
+(define (enable-discovery)
(with-silent-shepherd
(with-shepherd-action 'guix-daemon
- ('set-http-proxy proxy)
+ ('discover "on")
result
result)))
-(define (clear-http-proxy)
+(define (disable-discovery)
(with-silent-shepherd
(with-shepherd-action 'guix-daemon
- ('set-http-proxy)
+ ('discover "off")
result
result)))
diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm
index a7fa66a..bb97bc5 100644
--- a/gnu/installer/utils.scm
+++ b/gnu/installer/utils.scm
@@ -18,6 +18,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu installer utils)
+ #:use-module (gnu services herd)
#:use-module (guix utils)
#:use-module (guix build utils)
#:use-module (guix i18n)
@@ -43,7 +44,9 @@
with-server-socket
current-server-socket
current-clients
- send-to-clients))
+ send-to-clients
+
+ with-silent-shepherd))
(define* (read-lines #:optional (port (current-input-port)))
"Read lines from PORT and return them as a list."
@@ -233,3 +236,9 @@ accepting socket."
(current-clients (reverse remainder))
exp)
+
+(define-syntax-rule (with-silent-shepherd exp ...)
+ "Evaluate EXP while discarding shepherd messages."
+ (parameterize ((shepherd-message-port
+ (%make-void-port "w")))
+ exp ...))
diff --git a/gnu/local.mk b/gnu/local.mk
index f94725b..4cca767 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -717,6 +717,7 @@ INSTALLER_MODULES = \
%D%/installer/record.scm \
%D%/installer/services.scm \
%D%/installer/steps.scm \
+ %D%/installer/substitutes.scm \
%D%/installer/tests.scm \
%D%/installer/timezone.scm \
%D%/installer/user.scm \
@@ -733,6 +734,7 @@ INSTALLER_MODULES = \
%D%/installer/newt/page.scm \
%D%/installer/newt/partition.scm \
%D%/installer/newt/services.scm \
+ %D%/installer/newt/substitutes.scm \
%D%/installer/newt/timezone.scm \
%D%/installer/newt/user.scm \
%D%/installer/newt/utils.scm \
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index 7701297..a6b9e3d 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,6 +336,10 @@ 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)
+
;; The build daemon. Register the default substitute server key(s)
;; as trusted to allow the installation process to use substitutes by
;; default.
@@ -435,6 +440,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")))
diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in
index 5afb13f..1aec3be 100644
--- a/po/guix/POTFILES.in
+++ b/po/guix/POTFILES.in
@@ -25,6 +25,7 @@ gnu/installer/newt/network.scm
gnu/installer/newt/page.scm
gnu/installer/newt/partition.scm
gnu/installer/newt/services.scm
+gnu/installer/newt/substitutes.scm
gnu/installer/newt/timezone.scm
gnu/installer/newt/user.scm
gnu/installer/newt/utils.scm
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: install: Discover local substitute servers.,
guix-commits <=