diff options
| author | Mathieu Othacehe <othacehe@gnu.org> | 2020-12-04 11:33:16 +0100 |
|---|---|---|
| committer | Mathieu Othacehe <othacehe@gnu.org> | 2020-12-11 21:37:07 +0100 |
| commit | 8361817bf693742757b096468198626f297bb09e (patch) | |
| tree | fe2008436678b49cb81f66811345e0474da2bafe | |
| parent | 6ca66f641485cc5a06ba7d34b9c36b738ea1d654 (diff) | |
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.
| -rw-r--r-- | gnu/installer.scm | 7 | ||||
| -rw-r--r-- | gnu/installer/newt.scm | 5 | ||||
| -rw-r--r-- | gnu/installer/newt/substitutes.scm | 43 | ||||
| -rw-r--r-- | gnu/installer/proxy.scm | 6 | ||||
| -rw-r--r-- | gnu/installer/record.scm | 3 | ||||
| -rw-r--r-- | gnu/installer/substitutes.scm | 41 | ||||
| -rw-r--r-- | gnu/installer/utils.scm | 11 | ||||
| -rw-r--r-- | gnu/local.mk | 2 | ||||
| -rw-r--r-- | gnu/system/install.scm | 6 | ||||
| -rw-r--r-- | po/guix/POTFILES.in | 1 |
10 files changed, 119 insertions, 6 deletions
diff --git a/gnu/installer.scm b/gnu/installer.scm index f401b242f82..7863edbb67d 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm | |||
| @@ -266,6 +266,13 @@ selected keymap." | |||
| 266 | (compute (lambda _ | 266 | (compute (lambda _ |
| 267 | ((installer-network-page current-installer))))) | 267 | ((installer-network-page current-installer))))) |
| 268 | 268 | ||
| 269 | ;; Ask whether to enable substitute server discovery. | ||
| 270 | (installer-step | ||
| 271 | (id 'substitutes) | ||
| 272 | (description (G_ "Substitute server discovery")) | ||
| 273 | (compute (lambda _ | ||
| 274 | ((installer-substitutes-page current-installer))))) | ||
| 275 | |||
| 269 | ;; Prompt for users (name, group and home directory). | 276 | ;; Prompt for users (name, group and home directory). |
| 270 | (installer-step | 277 | (installer-step |
| 271 | (id 'user) | 278 | (id 'user) |
diff --git a/gnu/installer/newt.scm b/gnu/installer/newt.scm index a1cbeca49a1..4f7fc6f4dcc 100644 --- a/gnu/installer/newt.scm +++ b/gnu/installer/newt.scm | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #:use-module (gnu installer newt page) | 30 | #:use-module (gnu installer newt page) |
| 31 | #:use-module (gnu installer newt partition) | 31 | #:use-module (gnu installer newt partition) |
| 32 | #:use-module (gnu installer newt services) | 32 | #:use-module (gnu installer newt services) |
| 33 | #:use-module (gnu installer newt substitutes) | ||
| 33 | #:use-module (gnu installer newt timezone) | 34 | #:use-module (gnu installer newt timezone) |
| 34 | #:use-module (gnu installer newt user) | 35 | #:use-module (gnu installer newt user) |
| 35 | #:use-module (gnu installer newt utils) | 36 | #:use-module (gnu installer newt utils) |
| @@ -101,6 +102,9 @@ problem. The backtrace is displayed below. Please report it by email to \ | |||
| 101 | (define (network-page) | 102 | (define (network-page) |
| 102 | (run-network-page)) | 103 | (run-network-page)) |
| 103 | 104 | ||
| 105 | (define (substitutes-page) | ||
| 106 | (run-substitutes-page)) | ||
| 107 | |||
| 104 | (define (hostname-page) | 108 | (define (hostname-page) |
| 105 | (run-hostname-page)) | 109 | (run-hostname-page)) |
| 106 | 110 | ||
| @@ -130,6 +134,7 @@ problem. The backtrace is displayed below. Please report it by email to \ | |||
| 130 | (locale-page locale-page) | 134 | (locale-page locale-page) |
| 131 | (menu-page menu-page) | 135 | (menu-page menu-page) |
| 132 | (network-page network-page) | 136 | (network-page network-page) |
| 137 | (substitutes-page substitutes-page) | ||
| 133 | (timezone-page timezone-page) | 138 | (timezone-page timezone-page) |
| 134 | (hostname-page hostname-page) | 139 | (hostname-page hostname-page) |
| 135 | (user-page user-page) | 140 | (user-page user-page) |
diff --git a/gnu/installer/newt/substitutes.scm b/gnu/installer/newt/substitutes.scm new file mode 100644 index 00000000000..938cb1a53be --- /dev/null +++ b/gnu/installer/newt/substitutes.scm | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | ||
| 2 | ;;; Copyright © 2020 Mathieu Othacehe <othacehe@gnu.org> | ||
| 3 | ;;; | ||
| 4 | ;;; This file is part of GNU Guix. | ||
| 5 | ;;; | ||
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | ||
| 7 | ;;; under the terms of the GNU General Public License as published by | ||
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | ||
| 9 | ;;; your option) any later version. | ||
| 10 | ;;; | ||
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | ||
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | ;;; GNU General Public License for more details. | ||
| 15 | ;;; | ||
| 16 | ;;; You should have received a copy of the GNU General Public License | ||
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | (define-module (gnu installer newt substitutes) | ||
| 20 | #:use-module (gnu installer substitutes) | ||
| 21 | #:use-module (gnu installer utils) | ||
| 22 | #:use-module (guix i18n) | ||
| 23 | #:use-module (newt) | ||
| 24 | #:use-module (ice-9 match) | ||
| 25 | #:export (run-substitutes-page)) | ||
| 26 | |||
| 27 | (define* (run-substitutes-page) | ||
| 28 | (match (current-clients) | ||
| 29 | (() | ||
| 30 | (case (choice-window | ||
| 31 | (G_ "Substitute server discovery.") | ||
| 32 | (G_ "Enable") (G_ "Disable") | ||
| 33 | (G_ " By turning this option on, you allow Guix to fetch \ | ||
| 34 | substitutes (pre-built binaries) during installation from servers \ | ||
| 35 | discovered on your local area network (LAN) in addition to the official \ | ||
| 36 | server. This can increase download throughput. | ||
| 37 | |||
| 38 | There are no security risks: only genuine substitutes may be retrieved from \ | ||
| 39 | those servers. However, eavesdroppers on your LAN may be able to see what \ | ||
| 40 | software you are installing.")) | ||
| 41 | ((1) (enable-discovery)) | ||
| 42 | ((2) (disable-discovery)))) | ||
| 43 | (_ #f))) | ||
diff --git a/gnu/installer/proxy.scm b/gnu/installer/proxy.scm index befaf3ab0ae..86c827294e0 100644 --- a/gnu/installer/proxy.scm +++ b/gnu/installer/proxy.scm | |||
| @@ -17,15 +17,11 @@ | |||
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 18 | 18 | ||
| 19 | (define-module (gnu installer proxy) | 19 | (define-module (gnu installer proxy) |
| 20 | #:use-module (gnu installer utils) | ||
| 20 | #:use-module (gnu services herd) | 21 | #:use-module (gnu services herd) |
| 21 | #:export (set-http-proxy | 22 | #:export (set-http-proxy |
| 22 | clear-http-proxy)) | 23 | clear-http-proxy)) |
| 23 | 24 | ||
| 24 | (define-syntax-rule (with-silent-shepherd exp ...) | ||
| 25 | (parameterize ((shepherd-message-port | ||
| 26 | (%make-void-port "w"))) | ||
| 27 | exp ...)) | ||
| 28 | |||
| 29 | (define (set-http-proxy proxy) | 25 | (define (set-http-proxy proxy) |
| 30 | (with-silent-shepherd | 26 | (with-silent-shepherd |
| 31 | (with-shepherd-action 'guix-daemon | 27 | (with-shepherd-action 'guix-daemon |
diff --git a/gnu/installer/record.scm b/gnu/installer/record.scm index 6ebd87f6a65..0b34318c457 100644 --- a/gnu/installer/record.scm +++ b/gnu/installer/record.scm | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | installer-locale-page | 33 | installer-locale-page |
| 34 | installer-menu-page | 34 | installer-menu-page |
| 35 | installer-network-page | 35 | installer-network-page |
| 36 | installer-substitutes-page | ||
| 36 | installer-timezone-page | 37 | installer-timezone-page |
| 37 | installer-hostname-page | 38 | installer-hostname-page |
| 38 | installer-user-page | 39 | installer-user-page |
| @@ -73,6 +74,8 @@ | |||
| 73 | (menu-page installer-menu-page) | 74 | (menu-page installer-menu-page) |
| 74 | ;; procedure void -> void | 75 | ;; procedure void -> void |
| 75 | (network-page installer-network-page) | 76 | (network-page installer-network-page) |
| 77 | ;; procedure void -> void | ||
| 78 | (substitutes-page installer-substitutes-page) | ||
| 76 | ;; procedure (zonetab) -> posix-timezone | 79 | ;; procedure (zonetab) -> posix-timezone |
| 77 | (timezone-page installer-timezone-page) | 80 | (timezone-page installer-timezone-page) |
| 78 | ;; procedure void -> void | 81 | ;; procedure void -> void |
diff --git a/gnu/installer/substitutes.scm b/gnu/installer/substitutes.scm new file mode 100644 index 00000000000..c9a7418f89e --- /dev/null +++ b/gnu/installer/substitutes.scm | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | ;;; GNU Guix --- Functional package management for GNU | ||
| 2 | ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com> | ||
| 3 | ;;; | ||
| 4 | ;;; This file is part of GNU Guix. | ||
| 5 | ;;; | ||
| 6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | ||
| 7 | ;;; under the terms of the GNU General Public License as published by | ||
| 8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | ||
| 9 | ;;; your option) any later version. | ||
| 10 | ;;; | ||
| 11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | ||
| 12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | ;;; GNU General Public License for more details. | ||
| 15 | ;;; | ||
| 16 | ;;; You should have received a copy of the GNU General Public License | ||
| 17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | |||
| 19 | (define-module (gnu installer substitutes) | ||
| 20 | #:use-module (gnu installer utils) | ||
| 21 | #:use-module (gnu services herd) | ||
| 22 | #:export (enable-discovery | ||
| 23 | disable-discovery)) | ||
| 24 | |||
| 25 | (define (enable-discovery) | ||
| 26 | (with-silent-shepherd | ||
| 27 | (with-shepherd-action 'guix-daemon | ||
| 28 | ('discover "on") | ||
| 29 | result | ||
| 30 | result))) | ||
| 31 | |||
| 32 | (define (disable-discovery) | ||
| 33 | (with-silent-shepherd | ||
| 34 | (with-shepherd-action 'guix-daemon | ||
| 35 | ('discover "off") | ||
| 36 | result | ||
| 37 | result))) | ||
| 38 | |||
| 39 | ;; Local Variables: | ||
| 40 | ;; eval: (put 'with-silent-shepherd 'scheme-indent-function 0) | ||
| 41 | ;; End: | ||
diff --git a/gnu/installer/utils.scm b/gnu/installer/utils.scm index a7fa66a199e..bb97bc5560d 100644 --- a/gnu/installer/utils.scm +++ b/gnu/installer/utils.scm | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | 18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 19 | 19 | ||
| 20 | (define-module (gnu installer utils) | 20 | (define-module (gnu installer utils) |
| 21 | #:use-module (gnu services herd) | ||
| 21 | #:use-module (guix utils) | 22 | #:use-module (guix utils) |
| 22 | #:use-module (guix build utils) | 23 | #:use-module (guix build utils) |
| 23 | #:use-module (guix i18n) | 24 | #:use-module (guix i18n) |
| @@ -43,7 +44,9 @@ | |||
| 43 | with-server-socket | 44 | with-server-socket |
| 44 | current-server-socket | 45 | current-server-socket |
| 45 | current-clients | 46 | current-clients |
| 46 | send-to-clients)) | 47 | send-to-clients |
| 48 | |||
| 49 | with-silent-shepherd)) | ||
| 47 | 50 | ||
| 48 | (define* (read-lines #:optional (port (current-input-port))) | 51 | (define* (read-lines #:optional (port (current-input-port))) |
| 49 | "Read lines from PORT and return them as a list." | 52 | "Read lines from PORT and return them as a list." |
| @@ -233,3 +236,9 @@ accepting socket." | |||
| 233 | 236 | ||
| 234 | (current-clients (reverse remainder)) | 237 | (current-clients (reverse remainder)) |
| 235 | exp) | 238 | exp) |
| 239 | |||
| 240 | (define-syntax-rule (with-silent-shepherd exp ...) | ||
| 241 | "Evaluate EXP while discarding shepherd messages." | ||
| 242 | (parameterize ((shepherd-message-port | ||
| 243 | (%make-void-port "w"))) | ||
| 244 | exp ...)) | ||
diff --git a/gnu/local.mk b/gnu/local.mk index f94725b1e57..4cca7671a84 100644 --- a/gnu/local.mk +++ b/gnu/local.mk | |||
| @@ -717,6 +717,7 @@ INSTALLER_MODULES = \ | |||
| 717 | %D%/installer/record.scm \ | 717 | %D%/installer/record.scm \ |
| 718 | %D%/installer/services.scm \ | 718 | %D%/installer/services.scm \ |
| 719 | %D%/installer/steps.scm \ | 719 | %D%/installer/steps.scm \ |
| 720 | %D%/installer/substitutes.scm \ | ||
| 720 | %D%/installer/tests.scm \ | 721 | %D%/installer/tests.scm \ |
| 721 | %D%/installer/timezone.scm \ | 722 | %D%/installer/timezone.scm \ |
| 722 | %D%/installer/user.scm \ | 723 | %D%/installer/user.scm \ |
| @@ -733,6 +734,7 @@ INSTALLER_MODULES = \ | |||
| 733 | %D%/installer/newt/page.scm \ | 734 | %D%/installer/newt/page.scm \ |
| 734 | %D%/installer/newt/partition.scm \ | 735 | %D%/installer/newt/partition.scm \ |
| 735 | %D%/installer/newt/services.scm \ | 736 | %D%/installer/newt/services.scm \ |
| 737 | %D%/installer/newt/substitutes.scm \ | ||
| 736 | %D%/installer/newt/timezone.scm \ | 738 | %D%/installer/newt/timezone.scm \ |
| 737 | %D%/installer/newt/user.scm \ | 739 | %D%/installer/newt/user.scm \ |
| 738 | %D%/installer/newt/utils.scm \ | 740 | %D%/installer/newt/utils.scm \ |
diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 77012974112..a6b9e3d9523 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #:use-module ((guix store) #:select (%store-prefix)) | 34 | #:use-module ((guix store) #:select (%store-prefix)) |
| 35 | #:use-module (gnu installer) | 35 | #:use-module (gnu installer) |
| 36 | #:use-module (gnu system locale) | 36 | #:use-module (gnu system locale) |
| 37 | #:use-module (gnu services avahi) | ||
| 37 | #:use-module (gnu services dbus) | 38 | #:use-module (gnu services dbus) |
| 38 | #:use-module (gnu services networking) | 39 | #:use-module (gnu services networking) |
| 39 | #:use-module (gnu services shepherd) | 40 | #:use-module (gnu services shepherd) |
| @@ -335,6 +336,10 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m | |||
| 335 | ;; The usual services. | 336 | ;; The usual services. |
| 336 | (syslog-service) | 337 | (syslog-service) |
| 337 | 338 | ||
| 339 | ;; Use the Avahi daemon to discover substitute servers on the local | ||
| 340 | ;; network. It can be faster than fetching from remote servers. | ||
| 341 | (service avahi-service-type) | ||
| 342 | |||
| 338 | ;; The build daemon. Register the default substitute server key(s) | 343 | ;; The build daemon. Register the default substitute server key(s) |
| 339 | ;; as trusted to allow the installation process to use substitutes by | 344 | ;; as trusted to allow the installation process to use substitutes by |
| 340 | ;; default. | 345 | ;; default. |
| @@ -435,6 +440,7 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m | |||
| 435 | (host-name "gnu") | 440 | (host-name "gnu") |
| 436 | (timezone "Europe/Paris") | 441 | (timezone "Europe/Paris") |
| 437 | (locale "en_US.utf8") | 442 | (locale "en_US.utf8") |
| 443 | (name-service-switch %mdns-host-lookup-nss) | ||
| 438 | (bootloader (bootloader-configuration | 444 | (bootloader (bootloader-configuration |
| 439 | (bootloader grub-bootloader) | 445 | (bootloader grub-bootloader) |
| 440 | (target "/dev/sda"))) | 446 | (target "/dev/sda"))) |
diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index 5afb13ffdb1..1aec3bef3c0 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in | |||
| @@ -25,6 +25,7 @@ gnu/installer/newt/network.scm | |||
| 25 | gnu/installer/newt/page.scm | 25 | gnu/installer/newt/page.scm |
| 26 | gnu/installer/newt/partition.scm | 26 | gnu/installer/newt/partition.scm |
| 27 | gnu/installer/newt/services.scm | 27 | gnu/installer/newt/services.scm |
| 28 | gnu/installer/newt/substitutes.scm | ||
| 28 | gnu/installer/newt/timezone.scm | 29 | gnu/installer/newt/timezone.scm |
| 29 | gnu/installer/newt/user.scm | 30 | gnu/installer/newt/user.scm |
| 30 | gnu/installer/newt/utils.scm | 31 | gnu/installer/newt/utils.scm |
