From: Tomas Volf <~@wolfsden.cz>
To: 45mg <45mg.writes@gmail.com>
Cc: "Guix Devel" <guix-devel@gnu.org>,
"Christopher Baines" <mail@cbaines.net>,
"Ian Eure" <ian@retrospec.tv>,
"František Boháček" <bohacfr2@fel.cvut.cz>
Subject: Re: Docs: Clarify use-cases of `guix-for-channels`?
Date: Sat, 28 Dec 2024 13:56:23 +0100 [thread overview]
Message-ID: <87ttao2cg8.fsf@wolfsden.cz> (raw)
In-Reply-To: <87ed1scm8k.fsf@gmail.com> (45mg.writes@gmail.com's message of "Sat, 28 Dec 2024 02:14:51 -0500")
[-- Attachment #1: Type: text/plain, Size: 5906 bytes --]
Hi,
45mg <45mg.writes@gmail.com> writes:
> Hi Tomas,
>
> I finally understand that it's my use of `guix-for-channels` that's
> making it pull when I reconfigure. So, my issue is solved by removing
> the `(guix)` field from the `(guix-configuration)` form in the
> configuration I posted.
>
> All I was trying to do was specify additional channels in my system
> configuration, without having to write anything in
> ~/.config/guix/channels.scm (I prefer for everything related to my
> system configuration to be tracked by git in a single root-owned
> directory). It looks like I only need the `(channels)` field of
> `(guix-configuration)` for that. Is that correct?
Yes, I believe so. Setting the (channels) field will create
/etc/guix/channels.scm file, which, in absence of
~/.config/guix/channels.scm, will be used.
>
> This would have been obvious to me if I had understood what
> `guix-for-channels` is actually /for/ from the start. The only reason I
> ended up using it in the first place is that I was reading through
> '(guix) Channels' to understand how to configure additional ones, and
> then I saw this in '(guix) Customizing the System-Wide Guix':
>
>> 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 (*note ‘channels’ field of ‘guix-configuration’:
>> guix-configuration-channels.).
>
> If I had really been paying close attention, I would have noticed
> phrasing like '/maybe/ you will want', and realised that using
> `guix-for-channels` is /optional/. But since this subsection is under
> the 'Channels' section of the manual, which explains the basics of using
> channels - and does not provide any other snippet explaining how to
> configure channels in the system configuration file - I assumed that the
> code snippet quoted above is THE Official Way™ to configure additional
> channels directly in the system configuration, without using
> ~/.config/guix/channels.scm; and copied it near-verbatim.
>
> I think this could be clarified a little, so that other people who are
> in a hurry to set things up for the first time don't make the same
> mistake as me, and then think that Guix needs an internet connection
> just to reconfigure the system.
>
> I could write a patch to the manual for this. Here's what I'm proposing
> to do:
>
> - Add a snippet to '(guix) Specifying Additional Channels', explaining
> how to configure additional channels within the system configuration
> file (as per the second paragraph of this message).
The (channels) field is fairly new, so it is well possible some
documentation might be missing. The suggested addition might be useful,
but the thing is, it is not really required. Usually you would use the
~/.config/guix/channels.scm, since guix pull is per user. So it should
be clearly stated that (channels) are to be used if you intend to set
default channels for every user on the machine.
>
> - In '(guix) Customizing the System-Wide Guix', explain more clearly
> where `guix-for-channels` would be useful. As I understand it, the
> main use-case is for fresh system installations where running `guix
> pull` would be a hassle, such as on an installer ISO. Are there other
> significant use-cases?
Sure there are, guix pull is fairly slow operation, so any system that
does not have guix pull done as part of normal workflow might benefit
from setting the (guix) field to a custom guix (produced for example by
guix-for-channels). I set the (guix) field for all systems except my
laptop.
> Any other reasons why one might want to use it on their main system,
> despite the hassle of it pulling every time and not caching the
> derivation?
There is a workaround[0], however I would not recommend using it on any
system that actually guix-pulls.
> (We should also document that limitation, unless it's likely to
> change in the near future.)
However I agree the current limitation should be documented (and so
should be bug #74396).
Tomas
0: https://wolfsden.cz/blog/post/what-goes-into-guix-shaped-hole.html
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]
prev parent reply other threads:[~2024-12-28 12:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-25 14:44 Why does `system reconfigure` need to `pull`? 45mg
2024-12-26 18:41 ` Ian Eure
2024-12-26 21:48 ` Christopher Baines
2024-12-27 19:58 ` 45mg
2024-12-27 21:29 ` Tomas Volf
2024-12-28 7:14 ` Docs: Clarify use-cases of `guix-for-channels`? 45mg
2024-12-28 12:56 ` Tomas Volf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ttao2cg8.fsf@wolfsden.cz \
--to=~@wolfsden.cz \
--cc=45mg.writes@gmail.com \
--cc=bohacfr2@fel.cvut.cz \
--cc=guix-devel@gnu.org \
--cc=ian@retrospec.tv \
--cc=mail@cbaines.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).