From patchwork Fri May 26 16:26:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antero Mejr X-Patchwork-Id: 50347 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C7CB627BBE9; Fri, 26 May 2023 17:27:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C4D6D27BBE2 for ; Fri, 26 May 2023 17:27:09 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2aHR-0005op-5S; Fri, 26 May 2023 12:27:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2aHO-0005oB-UB for guix-patches@gnu.org; Fri, 26 May 2023 12:27:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q2aHO-00062I-Lz for guix-patches@gnu.org; Fri, 26 May 2023 12:27:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2aHO-0003AJ-IG for guix-patches@gnu.org; Fri, 26 May 2023 12:27:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49610] [PATCH v4 1/2] services: guix: Add channels field. References: <20210717205819.380-1-brice@waegenei.re> In-Reply-To: <20210717205819.380-1-brice@waegenei.re> Resent-From: Antero Mejr Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 26 May 2023 16:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49610 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49610@debbugs.gnu.org Cc: ludo@gnu.org, zimon.toutoune@gmail.com Received: via spool by 49610-submit@debbugs.gnu.org id=B49610.168511838712109 (code B ref 49610); Fri, 26 May 2023 16:27:02 +0000 Received: (at 49610) by debbugs.gnu.org; 26 May 2023 16:26:27 +0000 Received: from localhost ([127.0.0.1]:50674 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2aGo-000399-B2 for submit@debbugs.gnu.org; Fri, 26 May 2023 12:26:27 -0400 Received: from mout-p-202.mailbox.org ([80.241.56.172]:42264) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2aGm-00038r-SI for 49610@debbugs.gnu.org; Fri, 26 May 2023 12:26:25 -0400 Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4QSVfX6Rclz9ssc; Fri, 26 May 2023 18:26:12 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1685118372; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=CpDr/hktiK8QND3jK5avAN6/G0ZGs5l4s3+hJ7rcWWo=; b=GrGt3yk2BwOF1z/Mc85CXhNeblB+KoEiOP2qGhYednpe21bBnb17C4BZQ0TZITQfQXbiIc BcK4Du7+lRcvqMfLnWOKiKNcDC7pb8/ppdZk/jeZsFobqJK/FoIHOS/8TxoRYmDCm5kFUD MmRz9kO0ffNHs2m5NLuQkHLzCEYTLO1+tb+gSmtwYONyBFhGmJ1dE17f2L1RMx2pRXd6k9 fop7R49zEt8k4w6K4pHumOpqe/CJGKr04JyhD0gTLTJqdH+gn/C6uLq+MOSO453FQZeEJg 36NFrxdVFkCI0EK6BHWSNo2dQvSUqzRrm+hXopyZDmciaU5rqwI4CeSjaYUShw== Date: Fri, 26 May 2023 16:26:05 +0000 Message-Id: <20230526162606.6747-1-antero@mailbox.org> MIME-Version: 1.0 X-MBO-RS-META: uyijabr1utymf1zz9mcfmc7ny4xzo9e3 X-MBO-RS-ID: 5cde06eba5612d44fd5 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Antero Mejr X-ACL-Warn: , Antero Mejr via Guix-patches X-Patchwork-Original-From: Antero Mejr via Guix-patches via From: Antero Mejr Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * doc/guix.texi (Base Services): Document 'guix-configuration-channels' field. * gnu/services/base.scm (install-channels-file): New procedure. (%default-channels-file): New variable. (guix-configuration): Add channels field. (guix-activation): Use 'install-channels-file' procedure. --- doc/guix.texi | 13 +++++++++++++ gnu/services/base.scm | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 31dc33fb97..9ebdf70d81 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18858,6 +18858,19 @@ few seconds when enough entropy is available and is only done once; you might want to turn it off for instance in a virtual machine that does not need it and where the extra boot time is a problem. +@item @code{channels} (default: @code{%default-channels-file}) +File-like object containing a list of channels to be used by +@command{guix pull}, by default. The file-like object is symlinked to +@file{/etc/guix/channels.scm}. + +@quotation Note +When reconfiguring a system, the existing @file{/etc/guix/channels.scm} +file is backed up as @file{/etc/guix/channels.scm.bak} if it was +determined to be a manually modified file. This is to facilitate +migration from earlier versions, which allowed for in-place +modifications to @file{/etc/guix/channels.scm}. +@end quotation + @item @code{max-silent-time} (default: @code{0}) @itemx @code{timeout} (default: @code{0}) The number of seconds of silence and the number of seconds of activity, diff --git a/gnu/services/base.scm b/gnu/services/base.scm index c5b06b57e8..ee0c4880f9 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -80,6 +80,7 @@ (define-module (gnu services base) #:use-module ((gnu build file-systems) #:select (mount-flags->bit-mask swap-space->flags-bit-mask)) + #:use-module (guix channels) #:use-module (guix gexp) #:use-module (guix records) #:use-module (guix modules) @@ -93,6 +94,7 @@ (define-module (gnu services base) #:use-module (srfi srfi-35) #:use-module (ice-9 match) #:use-module (ice-9 format) + #:use-module (ice-9 pretty-print) #:re-export (user-processes-service-type ;backwards compatibility %default-substitute-urls) #:export (fstab-service-type @@ -207,6 +209,7 @@ (define-module (gnu services base) guix-configuration-use-substitutes? guix-configuration-substitute-urls guix-configuration-generate-substitute-key? + guix-configuration-channels guix-configuration-extra-options guix-configuration-log-file guix-configuration-environment @@ -1739,6 +1742,35 @@ (define acl-file #$%acl-file) ;; Installed the declared ACL. (symlink #+default-acl acl-file)))) +(define %default-channels-file + ;; File-like object containing the default list of channels. + (plain-file "channels.scm" + (with-output-to-string + (lambda _ + (pretty-print (map channel->code %default-channels)))))) + +;; FIXME: Should this gexp be built before boot, like +;; substitute-key-authorization does? +(define (install-channels-file channels-file) + "Return a gexp with code to install CHANNELS-FILE, a file-like object." + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + + ;; If channels.scm already exists, move it out of the way. Create a + ;; backup if it's a regular file: it's likely that the user + ;; manually defined it. + (if (file-exists? "/etc/guix/channels.scm") + (if (and (symbolic-link? "/etc/guix/channels.scm") + (store-file-name? (readlink "/etc/guix/channels.scm"))) + (delete-file "/etc/guix/channels.scm") + (rename-file "/etc/guix/channels.scm" + "/etc/guix/channels.scm.bak")) + (mkdir-p "/etc/guix")) + + ;; Installed the declared channels. + (symlink #+channels-file "/etc/guix/channels.scm")))) + (define %default-authorized-guix-keys ;; List of authorized substitute keys. (list (file-append guix "/share/guix/berlin.guix.gnu.org.pub") @@ -1763,6 +1795,8 @@ (define-record-type* (default %default-substitute-urls)) (generate-substitute-key? guix-configuration-generate-substitute-key? (default #t)) ;Boolean + (channels guix-configuration-channels ;file-like + (default %default-channels-file)) (chroot-directories guix-configuration-chroot-directories ;list of file-like/strings (default '())) (max-silent-time guix-configuration-max-silent-time ;integer @@ -1949,7 +1983,7 @@ (define (guix-accounts config) (define (guix-activation config) "Return the activation gexp for CONFIG." (match-record config - (guix generate-substitute-key? authorize-key? authorized-keys) + (guix generate-substitute-key? authorize-key? authorized-keys channels) #~(begin ;; Assume that the store has BUILD-GROUP as its group. We could ;; otherwise call 'chown' here, but the problem is that on a COW overlayfs, @@ -1963,7 +1997,9 @@ (define (guix-activation config) #$(if authorize-key? (substitute-key-authorization authorized-keys guix) - #~#f)))) + #~#f) + + #$(install-channels-file channels)))) (define-record-type* guix-extension make-guix-extension From patchwork Fri May 26 16:26:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antero Mejr X-Patchwork-Id: 50348 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A6EA027BBE9; Fri, 26 May 2023 17:27:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id F2A7F27BBE2 for ; Fri, 26 May 2023 17:27:22 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q2aHR-0005ox-Ff; Fri, 26 May 2023 12:27:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q2aHP-0005oF-Ai for guix-patches@gnu.org; Fri, 26 May 2023 12:27:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q2aHP-00062N-2c for guix-patches@gnu.org; Fri, 26 May 2023 12:27:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q2aHO-0003AQ-V0 for guix-patches@gnu.org; Fri, 26 May 2023 12:27:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49610] [PATCH v4 2/2] doc: guix.texi: Clarify wording in Channels section. Resent-From: Antero Mejr Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 26 May 2023 16:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49610 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49610@debbugs.gnu.org Cc: ludo@gnu.org, zimon.toutoune@gmail.com Received: via spool by 49610-submit@debbugs.gnu.org id=B49610.168511838912118 (code B ref 49610); Fri, 26 May 2023 16:27:02 +0000 Received: (at 49610) by debbugs.gnu.org; 26 May 2023 16:26:29 +0000 Received: from localhost ([127.0.0.1]:50676 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2aGr-00039O-7P for submit@debbugs.gnu.org; Fri, 26 May 2023 12:26:29 -0400 Received: from mout-p-103.mailbox.org ([80.241.56.161]:34986) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q2aGn-00038v-Ru for 49610@debbugs.gnu.org; Fri, 26 May 2023 12:26:26 -0400 Received: from smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-103.mailbox.org (Postfix) with ESMTPS id 4QSVfZ22SFz9sdC; Fri, 26 May 2023 18:26:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1685118374; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LUrsRyESr6tffv4DXqW4KsWj3SpGZ7eYDT4jcccOZHs=; b=Bjxe3h3xP/tQPb2rLcUKgKE6EN5srM3yU3Kqw1ImdYr8GfXMdbsGKoR0cz8rRq1B4iImwl o92zB8x2yR0jg3MW30qb7ug0CGWHHv5BLnO28SN34tBt2e93HAJoyMtvoJAUQ1Ymx+xqcz 5JEJNfCJT18raxI3k4cZRymhxydbOw8AP3ar7Zm2L5NqpnOCwPByo3NAB4upS2mIeNDRQM rgOQ+x/O+f3EtQ2I+JNikxzoHqMMcA5Xp2qCiYFuaU28nvbB+4zScOW0eNKVtiidH3nTAz LM2I2AQdGl/BVJCXjO4u39nDzIC3P9cm48NegVbeMrzu0fMQ/rWn6z91Vfju5g== Date: Fri, 26 May 2023 16:26:06 +0000 Message-Id: <20230526162606.6747-2-antero@mailbox.org> In-Reply-To: <20230526162606.6747-1-antero@mailbox.org> References: <20230526162606.6747-1-antero@mailbox.org> MIME-Version: 1.0 X-MBO-RS-ID: 415eb2f7e095857f755 X-MBO-RS-META: 65srwmh73y3cj9dywsy858cgg5k3fus4 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Antero Mejr X-ACL-Warn: , Antero Mejr via Guix-patches X-Patchwork-Original-From: Antero Mejr via Guix-patches via From: Antero Mejr Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * doc/guix.texi (Channels): Specify that '/etc/guix/channels.scm' contains channels configuration. --- doc/guix.texi | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 9ebdf70d81..643a36358d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5396,14 +5396,15 @@ $ wget -O - \ @cindex configuration of @command{guix pull} Guix and its package collection are updated by running @command{guix pull} (@pxref{Invoking guix pull}). By default @command{guix pull} downloads and -deploys Guix itself from the official GNU@tie{}Guix repository. This can be -customized by defining @dfn{channels} in the -@file{~/.config/guix/channels.scm} file. A channel specifies a URL and branch -of a Git repository to be deployed, and @command{guix pull} can be instructed -to pull from one or more channels. In other words, channels can be used -to @emph{customize} and to @emph{extend} Guix, as we will see below. -Guix is able to take into account security concerns and deal with authenticated -updates. +deploys Guix itself from the official GNU@tie{}Guix repository. A +channel specifies a URL and branch customized by defining @dfn{channels} +in the @file{~/.config/guix/channels.scm} file, and/or the +@file{/etc/guix/channels.scm} file and/or the built-in default specified +in the @code{%default-channels} variable. Guix honors the channels file +in that previous order (@xref{Invoking guix pull}). In other words, +channels can be used to @emph{customize} and to @emph{extend} Guix, as +we will see below. Guix is able to take into account security concerns +and deal with authenticated updates. @menu * Specifying Additional Channels:: Extending the package collection.