From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id +AwzIjGWSGCgLAAA0tVLHw (envelope-from ) for ; Wed, 10 Mar 2021 09:49:37 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id +AT5HTGWSGCnPgAAB5/wlQ (envelope-from ) for ; Wed, 10 Mar 2021 09:49:37 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E4CF02A60E for ; Wed, 10 Mar 2021 10:49:36 +0100 (CET) Received: from localhost ([::1]:46994 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lJvTE-0004QH-33 for larch@yhetil.org; Wed, 10 Mar 2021 04:49:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJvT3-0004PT-19 for guix-devel@gnu.org; Wed, 10 Mar 2021 04:49:25 -0500 Received: from mail-40130.protonmail.ch ([185.70.40.130]:45373) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lJvSz-00024W-S1 for guix-devel@gnu.org; Wed, 10 Mar 2021 04:49:24 -0500 Date: Wed, 10 Mar 2021 09:49:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail; t=1615369752; bh=XxX887qm/F31+MKBLGg9yL1oMiNwC6N657AGRqcHbvE=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=ACWHtmSafJDAnD31phiPr4RRsPs4RX8Ix7RhcKLewFAGpeIg9dp2Uk9xT7q8V/CJY WgT5lSaMtMYw9h1VNteFtEMElvd6cYuRV41qO0rvYAoY9vr8h4FkUmQwWXotO8Tsww D0AgZ/JpKlSpK81m/8B/PjAJgQfAIwjUW3Wwie0c= To: Pierre Neidhardt From: raid5atemyhomework Cc: "guix-devel@gnu.org" , Mathieu Othacehe Subject: Re: Adding Substitute Mirrors page to installer Message-ID: <-WVvn-rIc2HXdunUeEp6YfVQ9WkU-JsP_sAdLNK4ebx5YUTZ0-lSxWF2MGWOTGpqCvfil-JSAW1n-_82UQlRSXM5Qmb2ajaTYsa_EFUJ6o4=@protonmail.com> In-Reply-To: <87blbsah0x.fsf@ambrevar.xyz> References: <87blbsah0x.fsf@ambrevar.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.40.130; envelope-from=raid5atemyhomework@protonmail.com; helo=mail-40130.protonmail.ch X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: raid5atemyhomework Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1615369777; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=XxX887qm/F31+MKBLGg9yL1oMiNwC6N657AGRqcHbvE=; b=BTnTj2Ks9KegKcQje5strcCVbfFavRpVoVyBP36muAcfUmCBAcPVxv+WfAZrnNSU5YTToT gwTwB9IDO2cHE4JjfgfW2/B9pJQYEKgumzkQA3pwBqJz+shkbOXE7hVcktGszIZ/PGmV0r 7LkfdExe8tUwG0/n/N1LgOV6uTWPoecj1XrHM8qapeoEYa1Fv8071BFoiMY24HUOhFgn26 4DRPI3byxagl7G/+keMqarQyySSwnTuss0TX2UyJMF9CBwjOGKqWqEzczzRO8QYN0WJ/T6 XBtHJVoO/qIQ/k/SK6NGahjsWpsWQywpMd4rxywFLLicDgOCqZxM1KhvUgnYig== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615369777; a=rsa-sha256; cv=none; b=H4YhCGz2WtbE/vcCyl6CBIfKnKWMCkqqExwQ2Z86sd/aYeHKeJd7KXmSqcaZOTIRis/v75 n6VhW9CrBMfQdVU080iOLQyvYZKuR8F6G8EGhCIyqqlE3PjKacsaM9OzTAZp/Nz1S9Ega0 83kzQDlBP76F28w6GJEos/VWBxM/8twBz+bRNAwny5nL0fAe+ixKiIHs+C4kpQawujCHn8 3OHWVz32xOLYIB1X0ykWCW8K1K1Lv9RS9VFZXp/cWElPwGXKGAYBPXpr2ZpCE7SiTPrJ6d Uni+LQywiVDb7nk2izBgtEQSZ4dcabUuBuZZJWzKeZjB2gzZmqWhg8zp9Kj3AQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail header.b=ACWHtmSa; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Spam-Score: -3.08 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=protonmail.com header.s=protonmail header.b=ACWHtmSa; dmarc=pass (policy=quarantine) header.from=protonmail.com; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Migadu-Queue-Id: E4CF02A60E X-Spam-Score: -3.08 X-Migadu-Scanner: scn0.migadu.com X-TUID: ZRy7YTuBEhpC Hello, Below I have a patch that adds a page for substitute mirrors. Limitation is that the substitute mirror is only used after installation co= mpletes. During installation the guix daemon still loads from the Berlin s= erver. Also, channel is still the default Guix channel (which is fairly sl= ow as well from some places). Testing done: * Create an install image by `./pre-inst-env guix system image -t iso9660 g= nu/system/install.scm` on a patched Guix. * Create a new VM and install using the created install image. * Select the SJTU mirror. * Complete installation (also notice that during install, the mirror is *no= t* used, which could be confusing to users). * On installation completion, reboot VM, then `guix pull` on root. * Check that `guix pull` gets substitutes from SJTU mirror. The ability to also use the same mirror *during* install rather than after = it would be very nice. After all, the guix daemon has to be restarted duri= ng installation in the meantime anyway, so on restart it should be possible= to switch the `substitute-urls`. However the complications are: * The `(gnu installer service)` module inherently assumes that services are= completely orthogonal to everything else being configured in the installat= ion. I'm not sure what the best way to extract the substitute mirror selec= tion would be. * The installation image has to do a local `guix system reconfigure` of its= elf so that its shepherd points the guix daemon to a new mirror, so that th= e guix daemon restart in `install-system` of `(gnu installer final)` will r= efer to a new mirror. > I agree that we need a convenient way to add mirrors, it can be critical > to users who get low throughput from Berlin. Indeed. > > To that I'd add the option to add channels straight from the installer. > Not sure it belongs to a separate change set, maybe we can hit two birds > we one stone here. If you mean mirrors of the official Guix channel, this would be nice. However, channels are not described in the `operating-system` declaration. = Thus, we need to create channel by extra mechanism in installer. This can= probably be done by hooking somehow into `install-final` as well, as it cr= eates the `/mnt` mountpoint for installing. If you mean other non-Guix channels, the only channels I know of that are n= ot Guix cannot be named here, so --- are there any channels that *can* be n= amed in official documentation about Guix? Thanks raid5atemyhomework >From af7e4d1336ed9010a31011d2fbae2a27fdaca237 Mon Sep 17 00:00:00 2001 From: raid5atemyhomework Date: Wed, 10 Mar 2021 09:21:42 +0000 Subject: [PATCH] gnu: Add substitute mirrors page to installer. * gnu/installer/services.scm (system-service) [snippet-type]: New field. (%system-services): Add substitute mirrors. (service-list-service?): New procedure. (modify-services-service?): New procedure. (system-services->configuration): Add support for services with `'modify-services` snippets. * gnu/installer/newt/services.scm (run-substitute-mirror-page): New procedure. (run-services-page): Call `run-substitute-mirror-page`. --- gnu/installer/newt/services.scm | 26 +++++++++++++- gnu/installer/services.scm | 62 ++++++++++++++++++++++++++++----- 2 files changed, 78 insertions(+), 10 deletions(-) diff --git a/gnu/installer/newt/services.scm b/gnu/installer/newt/services.= scm index 74f28e41ba..0fd5d3f2de 100644 --- a/gnu/installer/newt/services.scm +++ b/gnu/installer/newt/services.scm @@ -92,6 +92,29 @@ client may be enough for a server.") (condition (&installer-step-abort))))))) +(define (run-substitute-mirror-page) + (let ((title (G_ "Substitute mirror"))) + (run-listbox-selection-page + #:title title + #:info-text (G_ "Choose a server to get substitutes from. + +Depending on your location, the official substitutes server can be slow; \ +in that case, using a mirror may be faster.") + #:info-textbox-width 70 + #:listbox-height 8 + #:listbox-items (filter (lambda (service) + (eq? 'substitute-mirror + (system-service-type service))) + %system-services) + #:listbox-item->text (compose G_ system-service-name) + #:sort-listbox-items? #f + #:button-text (G_ "Exit") + #:button-callback-procedure + (lambda _ + (raise + (condition + (&installer-step-abort))))))) + (define (run-services-page) (let ((desktop (run-desktop-environments-cbt-page))) ;; When the user did not select any desktop services, and thus didn't = get @@ -100,4 +123,5 @@ client may be enough for a server.") (run-networking-cbt-page) (if (null? desktop) (list (run-network-management-page)) - '())))) + '()) + (list (run-substitute-mirror-page))))) diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm index ec5ea30594..34d1e6f0de 100644 --- a/gnu/installer/services.scm +++ b/gnu/installer/services.scm @@ -41,6 +41,8 @@ (type system-service-type) ;'desktop | 'networking (recommended? system-service-recommended? ;Boolean (default #f)) + (snippet-type system-service-snippet-type ;'service-list | 'modify= -services + (default 'service-list)) (snippet system-service-snippet ;list of sexps (default '())) (packages system-service-packages ;list of sexps @@ -118,7 +120,31 @@ (system-service (name (G_ "DHCP client (dynamic IP address assignment)")) (type 'network-management) - (snippet '((service dhcp-client-service-type))))))) + (snippet '((service dhcp-client-service-type)))) + + ;; Substitute mirrors. + (system-service + ;; We should give the full URI of the servers, so that + ;; the user has the opportunity to ping it or wget + ;; from it to at least manually evaluate speed. + (name (G_ "https://ci.guix.gnu.org (Berlin, official Guix substitut= e server)")) + (type 'substitute-mirror)) + (system-service + (name (G_ "https://mirror.sjtu.edu.cn/guix (China, SJTU)")) + (type 'substitute-mirror) + (snippet-type 'modify-services) + (snippet '((guix-service-type config =3D> + (guix-configuration + (inherit config) + (substitute-urls + ;; cons* is better here, but we u= se + ;; (append (list ..) ...) in serv= ices + ;; below, so use the same for + ;; consistency. + (append + (list + "https://mirror.sjtu.edu.cn/g= uix") + %default-substitute-urls)))))))= ))) (define (desktop-system-service? service) "Return true if SERVICE is a desktop environment service." @@ -128,15 +154,33 @@ "Return true if SERVICE is a desktop environment service." (eq? 'networking (system-service-type service))) +(define (service-list-service? service) + (eq? 'service-list (system-service-snippet-type service))) + +(define (modify-services-service? service) + (eq? 'modify-services (system-service-snippet-type service))) + (define (system-services->configuration services) "Return the configuration field for SERVICES." - (let* ((snippets (append-map system-service-snippet services)) - (packages (append-map system-service-packages services)) - (desktop? (find desktop-system-service? services)) - (base (if desktop? - '%desktop-services - '%base-services))) - (if (null? snippets) + (let* ((service-list-services (filter service-list-service? + services)) + (service-list-snippets (append-map system-service-snippet + service-list-services)) + (modify-services-services (filter modify-services-service? + services)) + (modify-services-snippets (append-map system-service-snippet + modify-services-services)) + (packages (append-map system-service-packages + services)) + (desktop? (find desktop-system-service? services= )) + (base-variable (if desktop? + '%desktop-services + '%base-services)) + (base (if (null? modify-services-snippets) + base-variable + `(modify-services ,base-variable + ,@modify-services-snippets)))) + (if (null? service-list-snippets) `(,@(if (null? packages) '() `((packages (append (list ,@packages) @@ -146,7 +190,7 @@ '() `((packages (append (list ,@packages) %base-packages)))) - (services (append (list ,@snippets + (services (append (list ,@service-list-snippets ,@(if desktop? ;; XXX: Assume 'keyboard-layout' i= s in -- 2.30.1