From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id uK27BjWc/WUHkwAAe85BDQ:P1 (envelope-from ) for ; Fri, 22 Mar 2024 15:56:53 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id uK27BjWc/WUHkwAAe85BDQ (envelope-from ) for ; Fri, 22 Mar 2024 15:56:53 +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=L+qxo95y; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1711119412; 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: content-transfer-encoding:content-transfer-encoding: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=NVYmcLpqxop05d5wEdrGzU0qvtiUzjTjaPqHhk18IqM=; b=YI9wjYDtM+NGhlgbnagUDnfrmQ02FRSdMPvcUSvTl1QgkQ01XSM9CtCxWrpGjHFU8TdB/P +VYNg4+I3B+ud0W8md+dckBhWUvA8Vymi2H+06TC2RbCjEIeGqhCwFVkxnzvYtzfz2FJlT 8UB3VcGr9R1CR/QKy+ceoCgZQDcO8nepuEXmFuGZcUaUtqlN6iLVf52tRTHMfW0gf/kp9B RShVi08OGnRw0kEk2TojGmiS5aQyULto6AazU7yjaMVtsCLoxww+FA4fz/PI6DXGlpNO66 NVpCeInH/kQp6NCNpBoSKmi3yt6A769kH6Qg8iDMguUJA0irmq3S24QcqtaDCA== 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=L+qxo95y; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1711119412; a=rsa-sha256; cv=none; b=YndrYcTl1GjN/OU9pJWySqJK3qL9AZX3WQeQECvk81S47gyCcvCk8RuT4SEe+34432Ywmv Au1eE7fb2OXYIqmmn/kN2zVl65kLE/YjKuDkRKABJmNNWoNNTndh5AjnxxEs0bG0ObZkB/ C8ZrS9CC5wdzfRyWh5AHbmnGVJhaRZ0Tnge9vqT14sS7H+d1pjb6h+xbVibFRyAern/jN/ G7CBTJHv70NuO7eWZ42Li8sqBFJxk/DXAmNZmm1+7mQfKOUX2xEIyfNQPC5PkZ5aPq6ayz 8/5aYroiSthHn9rZSHUsKiKWeKpoELBfmsurVC4ElraNNPzvbJp4YiazTsfcCw== 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 AFEB344CD1 for ; Fri, 22 Mar 2024 15:56:51 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rngJl-0000su-4y; Fri, 22 Mar 2024 10:56: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 1rngJh-0000rV-K9 for guix-patches@gnu.org; Fri, 22 Mar 2024 10:56:21 -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 1rngJh-0006Dx-8I for guix-patches@gnu.org; Fri, 22 Mar 2024 10:56:21 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rngKL-0001R4-Qd for guix-patches@gnu.org; Fri, 22 Mar 2024 10:57:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69940] [PATCH 2/2] gnu: guix: Define =?UTF-8?Q?=E2=80=98guix-for-channels=E2=80=99?= and document its use. 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 14:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69940 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69940@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 69940-submit@debbugs.gnu.org id=B69940.17111194145490 (code B ref 69940); Fri, 22 Mar 2024 14:57:01 +0000 Received: (at 69940) by debbugs.gnu.org; 22 Mar 2024 14:56:54 +0000 Received: from localhost ([127.0.0.1]:58529 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rngKD-0001QP-OK for submit@debbugs.gnu.org; Fri, 22 Mar 2024 10:56:54 -0400 Received: from eggs.gnu.org ([209.51.188.92]:35852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rngK8-0001Pe-TF for 69940@debbugs.gnu.org; Fri, 22 Mar 2024 10:56:49 -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 1rnfdc-0004N0-C2; Fri, 22 Mar 2024 10:12:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=NVYmcLpqxop05d5wEdrGzU0qvtiUzjTjaPqHhk18IqM=; b=L+qxo95ybN6VKEduY0lr ABSXPM++4ImFYR7PpLITP9B6VAMIR+rjsKk2HsYnOCYd1B3MFgEC+t+XBchhIYwfhk8o8OyKbp26n hsf+DEFnVHe+aPB0POTrw7YZTmlFsqbvsqgCXbKeIi1vx41G+9jM2OJQ01iflYf17b4sLMNRimTbY E+9A+Vi1wU3wGWQCmvV0iBE2FgEptSTnixRAI06wz5v+XQ9jGV1tZw0ewcoA7ouukAmRCicU5/0NM t5tE0NjD1KdBn3xwq7SFXj9WYthZXFEnPlGfYjLMoz8CosEvlkO1fkQstHovahrYnLpFVegjrdJ+7 biNNBjU/VZl01g==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 22 Mar 2024 15:12:30 +0100 Message-ID: <58fefa1f778d9ead96b669ac258ec978f79d1da2.1711115625.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-Queue-Id: AFEB344CD1 X-Spam-Score: -6.23 X-Migadu-Spam-Score: -6.23 X-Migadu-Scanner: mx11.migadu.com X-TUID: l5UIejg1lyV6 From: Ludovic Courtès * gnu/packages/package-management.scm (guix-for-channels): New procedure. * doc/guix.texi (Customizing the System-Wide Guix): New section. (Base Services): Add cross-reference. Change-Id: Ied51c3bf9bf08dfc629bb3f0a152eb20b869a636 --- doc/guix.texi | 62 ++++++++++++++++++++++++++++- gnu/packages/package-management.scm | 14 ++++++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 07dc6e24a8..a2d5ef3ffd 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5514,6 +5514,7 @@ Channels * Specifying Additional Channels:: Extending the package collection. * Using a Custom Guix Channel:: Using a customized Guix. * Replicating Guix:: Running the @emph{exact same} Guix. +* Customizing the System-Wide Guix:: Default channels on Guix System. * Channel Authentication:: How Guix verifies what it fetches. * Channels with Substitutes:: Using channels with available substitutes. * Creating a Channel:: How to write your custom channel. @@ -5671,6 +5672,64 @@ Replicating Guix will---some sort of ``meta reproducibility'' capabilities, if you will. @xref{Inferiors}, for another way to take advantage of these super powers. +@node Customizing the System-Wide Guix +@section Customizing the System-Wide Guix + +@cindex system-wide Guix, customization +@cindex channels, for the default Guix +If you're running Guix System or building system images with it, maybe +you will want to customize the system-wide @command{guix} it +provides---specifically, @file{/run/current-system/profile/bin/guix}. +For example, you might want to provide additional channels or to pin its +revision. + +This can be done using the @code{guix-for-channels} procedure, which +returns a package for the given channels, and using it as part of your +operating system configuration, as in this example: + +@lisp +(use-modules (guix channels)) + +(define my-channels + ;; Channels that should be available to + ;; /run/current-system/profile/bin/guix. + (append + (list (channel + (name 'guix-science) + (url "https://github.com/guix-science/guix-science") + (branch "master"))) + %default-channels)) + +(operating-system + ;; @dots{} + (services + ;; Change the package used by 'guix-service-type'. + (modify-services %base-services + (guix-service-type + config => (guix-configuration + (inherit config) + (channels my-channels) + (guix (guix-for-channels my-channels))))))) +@end lisp + +The resulting operating system will have both the @code{guix} and the +@code{guix-science} channels visible by default. The @code{channels} +field of @code{guix-configuration} above further ensures that +@file{/etc/guix/channels.scm}, which is used by @command{guix pull}, +specifies the same set of channels (@pxref{guix-configuration-channels, +@code{channels} field of @code{guix-configuration}}). + +The @code{(gnu packages package-management)} module exports the +@code{guix-for-channels} procedure, described below. + +@deffn {Procedure} guix-for-channels @var{channels} +Return a package corresponding to @var{channels}. + +The result is a ``regular'' package, which can be used in +@code{guix-configuration} as shown above or in any other place that +expects a package. +@end deffn + @node Channel Authentication @section Channel Authentication @@ -19734,7 +19793,8 @@ Base Services @table @asis @item @code{guix} (default: @var{guix}) -The Guix package to use. +The Guix package to use. @xref{Customizing the System-Wide Guix} to +learn how to provide a package with a pre-configured set of channels. @item @code{build-group} (default: @code{"guixbuild"}) Name of the group for build user accounts. diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm index e9dd7427d3..c59f8b2bba 100644 --- a/gnu/packages/package-management.scm +++ b/gnu/packages/package-management.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013-2023 Ludovic Courtès +;;; Copyright © 2013-2024 Ludovic Courtès ;;; Copyright © 2015, 2017, 2020, 2021, 2022, 2023 Ricardo Wurmus ;;; Copyright © 2017 Muriithi Frederick Muriuki ;;; Copyright © 2017, 2018 Oleg Pykhalov @@ -649,6 +649,18 @@ (define-public guix-minimal (modify-inputs (package-propagated-inputs guix) (delete "guile-ssh")))))) +(define-public (guix-for-channels channels) + "Return a package corresponding to CHANNELS." + (package + (inherit guix) + (source (find guix-channel? channels)) + (build-system channel-build-system) + (arguments + `(#:channels ,(remove guix-channel? channels))) + (inputs '()) + (native-inputs '()) + (propagated-inputs '()))) + (define-public current-guix-package ;; This parameter allows callers to override the package that 'current-guix' ;; returns. This is useful when 'current-guix' cannot compute it by itself, -- 2.41.0