Next: Channel Authentication, Previous: Replicating Guix, Up: 频道 [Contents][Index]
If you’re running Guix System or building system images with it, maybe you
will want to customize the system-wide guix
it
provides—specifically, /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 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:
(use-modules (gnu packages package-management) (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 ;; … (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)))))))
The resulting operating system will have both the guix
and the
guix-science
channels visible by default. The channels
field
of guix-configuration
above further ensures that
/etc/guix/channels.scm, which is used by guix pull
,
specifies the same set of channels (see channels
field of guix-configuration
).
The (gnu packages package-management)
module exports the
guix-for-channels
procedure, described below.
Return a package corresponding to channels.
The result is a “regular” package, which can be used in
guix-configuration
as shown above or in any other place that expects
a package.