From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id kO3tL1pj/WWvdgAAe85BDQ:P1 (envelope-from ) for ; Fri, 22 Mar 2024 11:54:18 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id kO3tL1pj/WWvdgAAe85BDQ (envelope-from ) for ; Fri, 22 Mar 2024 11:54:18 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=FU6OeqJ0; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1711104858; a=rsa-sha256; cv=none; b=HPXqOHbFgy0iwdL9/DBDQHnAuLBC+5ohwgIcucrpi8pMiTdmbI3zOgP3An0bWeKRvP+jxs 3Nko+Doe5n3EVXw8rbW4BP/zVvLoRoNYirSxGHPfyDKoU91IFjAmIBH2EK1XWk+BlLIoSs lCoZiQ+0K357TCFrYe7HS9sq6smakke3lgT8GTAXqZilN2bdpb4TmcWc/4xofKJ5QXrVoG uMWSttVWwBjKWv2j1y6NNW2urIgGTCtS+Kdk3OZ6tbmdWWrkTgSWhFdjzkQ2jEqhCASDRE nN6gKXVPPDfRmaO1bbV2gqeYL4SsOLGKJ9DGijDJkBtYcPlG2kqKJP6B4QaWqw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=FU6OeqJ0; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1711104858; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=lCFIaJmKM40OCvPEp178HOWZwgWKKJ2OUQxrL8os+1E=; b=esdwGvYptk5f8RfdBn5PqbZ//6ARRTHr4FLZxGtUx1gUyskiIaDO5rXlaJEOvpa4Hg5Bx1 2OR/aCUIQ9hSxYoe2hsCNI4uxzDqgzhdIxlRsm803Jy+9kB32bTbck0VgbZpA45efZryS3 b6aWxAsv2kNSDCu3hZ9mDzrSu4JbVzW5T4/0KQBE0emBlJ10M4UsBlyRyIDQUHj/7Rc/hw HesKVjTr35JtHnb2GIRYvxnvjdCbw9AbuAG9weeRdxrRhqCfXZtKmdxnIpjRkrpM0keN1T WhLzx+Gc+SmDvF4Vxowal7QzNt+MA8ueEcX35s31vWRwlAzxfLVIcLkinZk7Vg== 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 71F4E26C81 for ; Fri, 22 Mar 2024 11:54:18 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rncWb-0000eQ-D7; Fri, 22 Mar 2024 06:53:25 -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 1rncWY-0000c3-6m for guix-patches@gnu.org; Fri, 22 Mar 2024 06:53:22 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rncWX-000518-V9 for guix-patches@gnu.org; Fri, 22 Mar 2024 06:53:21 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rncXC-0001Wk-2N for guix-patches@gnu.org; Fri, 22 Mar 2024 06:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49610] [PATCH v4 1/2] services: guix: Add channels field. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 22 Mar 2024 10:54: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: Antero Mejr Cc: 49610@debbugs.gnu.org, zimon.toutoune@gmail.com Received: via spool by 49610-submit@debbugs.gnu.org id=B49610.17111048395839 (code B ref 49610); Fri, 22 Mar 2024 10:54:02 +0000 Received: (at 49610) by debbugs.gnu.org; 22 Mar 2024 10:53:59 +0000 Received: from localhost ([127.0.0.1]:42559 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rncX8-0001W0-HN for submit@debbugs.gnu.org; Fri, 22 Mar 2024 06:53:59 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rncX2-0001Ul-Jo for 49610@debbugs.gnu.org; Fri, 22 Mar 2024 06:53:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rncNn-0003ZI-IK; Fri, 22 Mar 2024 06:44:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=lCFIaJmKM40OCvPEp178HOWZwgWKKJ2OUQxrL8os+1E=; b=FU6OeqJ0oH1zIT4Wik0j HtzVv2XIFKKpqLkBPzmRwZ+IdM+ldCUckqAifNnlIQi+GaVLOyBAtzhE5mh70uQqEbzYv8Cj1emrN nv2iobX67gm8/fx3jwV1/h5QCdxq9EKsRThA638olDcPb6+yMnst83Zga0wlbx0h84cy2ke2BFmh4 pOUPEi6agAWMiWURHkZrzksY1HhaNf93BlIFC7EpTMZR1hMaDqQWyI05w5RrVG/NeE1fRLRfcm/Xx GL9SpeEfnu2W0EgCFB8ds+olvTudavW9jGIHUkCe+8vM9GD9m9qrG+zMW4uVoiDqp+bb3JtrjdpEw Il3+SZfGcSPARw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <20230526162606.6747-1-antero@mailbox.org> (Antero Mejr's message of "Fri, 26 May 2023 16:26:05 +0000") References: <20210717205819.380-1-brice@waegenei.re> <20230526162606.6747-1-antero@mailbox.org> Date: Fri, 22 Mar 2024 11:44:14 +0100 Message-ID: <87sf0isg01.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -6.23 X-Spam-Score: -6.23 X-Migadu-Queue-Id: 71F4E26C81 X-TUID: 071rL1EvxBjF --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Antero, Antero Mejr skribis: > * 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. Rebased and finally applied! However, I took the liberty to make the changes below. Essentially, =E2=80=98channels=E2=80=99 is now a list of channel (as the name suggests) = rather than a file-like. It=E2=80=99s a tradeoff: on one hand it=E2=80=99s less expressi= ve (that prevents users from sticking arbitrary Scheme code in there), but OTOH it=E2=80=99s easier to use. If that is deemed too rigid, we can revisit that and either allow for file-like objects or for gexps, or add a separate =E2=80=98channels-file=E2= =80=99 field. Pushed as 883e69cdfd226c8f40b6e3b76ce0740b59857de6. Thanks! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/doc/guix.texi b/doc/guix.texi index 5c974f2ea4..e419b8d1a4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4727,7 +4727,9 @@ Invoking guix pull is passed; @item the system-wide @file{/etc/guix/channels.scm} file, unless @option{-q} -is passed; +is passed (on Guix System, this file can be declared in the operating +system configuration, @pxref{guix-configuration-channels, +@code{channels} field of @code{guix-configuration}}); @item the built-in default channels specified in the @code{%default-channels} variable. @@ -19806,10 +19808,11 @@ Base Services 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. +@anchor{guix-configuration-channels} @item @code{channels} (default: @code{%default-channels}) -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}. +List of channels to be specified in @file{/etc/guix/channels.scm}, which +is what @command{guix pull} uses by default (@pxref{Invoking guix +pull}). @quotation Note When reconfiguring a system, the existing @file{/etc/guix/channels.scm} diff --git a/gnu/services/base.scm b/gnu/services/base.scm index dcd66b8064..cd61df718e 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -83,7 +83,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) + #:autoload (guix channels) (%default-channels channel->code) #:use-module (guix gexp) #:use-module (guix records) #:use-module (guix modules) @@ -98,7 +98,6 @@ (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 @@ -1743,17 +1742,13 @@ (define (substitute-key-authorization keys guix) ;; 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)))))) +(define (install-channels-file channels) + "Return a gexp with code to install CHANNELS, a list of channels, in +/etc/guix/channels.scm." + (define channels-file + (scheme-file "channels.scm" + `(list ,@(map channel->code 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)) @@ -1828,7 +1823,7 @@ (define-record-type* (generate-substitute-key? guix-configuration-generate-substitute-key? (default #t)) ;Boolean (channels guix-configuration-channels ;file-like - (default %default-channels-file)) + (default %default-channels)) (chroot-directories guix-configuration-chroot-directories ;list of file-like/strings (default '())) (max-silent-time guix-configuration-max-silent-time ;integer @@ -2040,7 +2035,7 @@ (define (guix-activation config) #~#f) ;; ... and /etc/guix/channels.scm... - #$(install-channels-file channels) + #$(and channels (install-channels-file channels)) ;; ... and /etc/guix/machines.scm. #$(if (guix-build-machines config) --=-=-=--