GNU bug report logs -
#49610
[PATCH 0/2] Add channels field to guix-configuration
Previous Next
Reported by: Brice Waegeneire <brice <at> waegenei.re>
Date: Sat, 17 Jul 2021 20:59:01 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi Antero,
Antero Mejr <antero <at> mailbox.org> 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,
‘channels’ is now a list of channel (as the name suggests) rather than a
file-like. It’s a tradeoff: on one hand it’s less expressive (that
prevents users from sticking arbitrary Scheme code in there), but OTOH
it’s 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 ‘channels-file’ field.
Pushed as 883e69cdfd226c8f40b6e3b76ce0740b59857de6.
Thanks!
Ludo’.
[Message part 2 (text/x-patch, 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* <guix-configuration>
(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)
This bug report was last modified 1 year and 42 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.