* The `channels' field of `operating-system' record
@ 2024-04-07 16:05 Tomas Volf
2024-04-10 15:17 ` Ludovic Courtès
0 siblings, 1 reply; 10+ messages in thread
From: Tomas Volf @ 2024-04-07 16:05 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 2993 bytes --]
Hello,
yesterday I had to debug a really weird problem. I had a extra-special-file in
my system configuration used to create /etc/guix/channels.scm, but it was not
working, the channels file contained something completely else then I put into
it. In particular, this sequence in the configuration:
(extra-special-file "/etc/guix/channels.scm" file/channels.scm)
(extra-special-file "/etc/guix/xxx" file/channels.scm)
(extra-special-file "/etc/guix/yyy" file/channels.scm)
Produced this on the file system:
channels.scm -> /gnu/store/icw828kvva25ns9p0y0np7lp3c7xl0n6-channels.scm
xxx -> /gnu/store/w3gip7zqrqxbp8kaplq6kia85i5c4fh8-channels.scm
yyy -> /gnu/store/w3gip7zqrqxbp8kaplq6kia85i5c4fh8-channels.scm
Notice that, despite being created by the exact same code, the store items
differs.
After ~2 hours of digging I realized this is caused by the changes in
883e69cdfd226c8f40b6e3b76ce0740b59857de6.
I see couple of issues here (in no particular order, questions prefixed with Q):
* My configuration file just *silently* stopped working.
That is not great for obvious reasons.
* There is no news entry
I did not realize it stopped working for some time (but it explains few weird
issues I had lately) until I tried to install completely new system where I
actually went to check it works as expected.
* Broken default behavior.
Currently, out of the box, extra-special-file with "/etc/guix/channels.scm" just
does not do anything. No error, no warning. That is pretty unexpected.
* There is no terse way to turn it off
Currently my configuration contains this:
(modify-services %base-services
(guix-service-type
config => (guix-configuration
(inherit config)
(channels #f))))
That is 5 lines instead of single token %base-services just to restore the
original non-broken behavior. Would be nice to have guix-extension for this
turning it into 2 lines.
* Q: Is there an easy way to fill (channels)?
After I learned that (channels) is a thing, I wanted to use it, but did not find
any simple way how to do so. My channels are in channels.scm produced by `guix
describe --format=channels', and I do not see any simple way to pass the content
of that file into (channels). No, it does not accept (local-file). I tried
just (read)-ing it, but that too does not work.
I could steal the code from scripts/pull.scm, but that cannot be the intended
way, right? So how should I do this? What procedure did I failed to find?
* Q: Is the default value right?
Currently it defaults to %default-channels, which causes all this magic. Would
it not be better to default to #f, so that it would do nothing magical out of
the box and would be backwards compatible? You could still turn it on by
(Somehow? See above.) providing desired value.
Have a nice day,
Tomas Volf
--
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: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* The `channels' field of `operating-system' record
@ 2024-04-09 4:06 Nathan Dehnel
2024-04-09 4:16 ` Marek Paśnikowski
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Nathan Dehnel @ 2024-04-09 4:06 UTC (permalink / raw)
To: ~, guix-devel
I don't think you're supposed to edit /etc/guix/channels.scm directly,
I think it's generated by guix system reconfigure.
https://gitlab.com/nonguix/nonguix/-/issues/33
I have ~/.config/guix/channels.scm generated by putting
home-channels-service-type in my guix home config.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The `channels' field of `operating-system' record
2024-04-09 4:06 The `channels' field of `operating-system' record Nathan Dehnel
@ 2024-04-09 4:16 ` Marek Paśnikowski
2024-04-09 12:28 ` Tomas Volf
2024-04-09 12:29 ` Tomas Volf
2024-04-09 12:33 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2 siblings, 1 reply; 10+ messages in thread
From: Marek Paśnikowski @ 2024-04-09 4:16 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 718 bytes --]
09.04.2024 06:06:00 CEST Nathan Dehnel:
> I don't think you're supposed to edit /etc/guix/channels.scm directly,
> I think it's generated by guix system reconfigure.
> https://gitlab.com/nonguix/nonguix/-/issues/33
> I have ~/.config/guix/channels.scm generated by putting
> home-channels-service-type in my guix home config.
Now that you mentioned it — is this not root user’s channel list, and
one is not supposed to use guix as root?
I use home-channels-service-type and the only issue with this solution
is that it requires a 'guix home reconfigure' before the new channels
can be used in 'guix pull'. Though one could also use the -C flag to
a channels.scm file including the list of channels.
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The `channels' field of `operating-system' record
2024-04-09 4:16 ` Marek Paśnikowski
@ 2024-04-09 12:28 ` Tomas Volf
0 siblings, 0 replies; 10+ messages in thread
From: Tomas Volf @ 2024-04-09 12:28 UTC (permalink / raw)
To: Marek Paśnikowski; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]
On 2024-04-09 06:16:12 +0200, Marek Paśnikowski wrote:
> 09.04.2024 06:06:00 CEST Nathan Dehnel:
> > I don't think you're supposed to edit /etc/guix/channels.scm directly,
> > I think it's generated by guix system reconfigure.
> > https://gitlab.com/nonguix/nonguix/-/issues/33
> > I have ~/.config/guix/channels.scm generated by putting
> > home-channels-service-type in my guix home config.
>
> Now that you mentioned it — is this not root user’s channel list, and
> one is not supposed to use guix as root?
Not really, it is a system-wide channel list. Root's channel list would be
/root/.config/guix/channels.scm.
>
> I use home-channels-service-type and the only issue with this solution
> is that it requires a 'guix home reconfigure' before the new channels
> can be used in 'guix pull'. Though one could also use the -C flag to
> a channels.scm file including the list of channels.
The /etc/... one has advantage of applying to all users. Which is nice.
Have a nice day,
Tomas Volf
--
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: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The `channels' field of `operating-system' record
2024-04-09 4:06 The `channels' field of `operating-system' record Nathan Dehnel
2024-04-09 4:16 ` Marek Paśnikowski
@ 2024-04-09 12:29 ` Tomas Volf
2024-04-09 12:33 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2 siblings, 0 replies; 10+ messages in thread
From: Tomas Volf @ 2024-04-09 12:29 UTC (permalink / raw)
To: Nathan Dehnel; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
On 2024-04-08 23:06:00 -0500, Nathan Dehnel wrote:
> I don't think you're supposed to edit /etc/guix/channels.scm directly,
Is this documented anywhere? I used the code for over a year and it worked just
fine. I cannot find any instruction to not touch it anywhere in the info
manual.
> I think it's generated by guix system reconfigure.
> https://gitlab.com/nonguix/nonguix/-/issues/33
> I have ~/.config/guix/channels.scm generated by putting
> home-channels-service-type in my guix home config.
--
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: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The `channels' field of `operating-system' record
2024-04-09 4:06 The `channels' field of `operating-system' record Nathan Dehnel
2024-04-09 4:16 ` Marek Paśnikowski
2024-04-09 12:29 ` Tomas Volf
@ 2024-04-09 12:33 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
2 siblings, 0 replies; 10+ messages in thread
From: Felix Lechner via Development of GNU Guix and the GNU System distribution. @ 2024-04-09 12:33 UTC (permalink / raw)
To: Nathan Dehnel, ~, guix-devel
Hi Nathan,
On Mon, Apr 08 2024, Nathan Dehnel wrote:
> I don't think you're supposed to edit /etc/guix/channels.scm directly,
> I think it's generated by guix system reconfigure.
As Ludo' pointed out on Mastodon recently [1] the system channels can
also be customized, if needed. [2]
Kind regards
Felix
[1] https://toot.aquilenet.fr/@civodul/112235132695871431
[2] https://guix.gnu.org/manual/devel/en/html_node/Customizing-the-System_002dWide-Guix.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The `channels' field of `operating-system' record
2024-04-07 16:05 Tomas Volf
@ 2024-04-10 15:17 ` Ludovic Courtès
2024-04-15 22:04 ` Tomas Volf
2024-05-08 23:16 ` Tomas Volf
0 siblings, 2 replies; 10+ messages in thread
From: Ludovic Courtès @ 2024-04-10 15:17 UTC (permalink / raw)
To: guix-devel
Hello,
Tomas Volf <~@wolfsden.cz> skribis:
> After ~2 hours of digging I realized this is caused by the changes in
> 883e69cdfd226c8f40b6e3b76ce0740b59857de6.
>
> I see couple of issues here (in no particular order, questions prefixed with Q):
>
> * My configuration file just *silently* stopped working.
>
> That is not great for obvious reasons.
>
> * There is no news entry
Oops, my apologies; the change felt pretty innocuous when I merged it,
but in hindsight, it seems clear that a news entry was warranted.
Lesson learned.
We can still add that news entry, though fewer people will see it now.
Thoughts?
> * Broken default behavior.
>
> Currently, out of the box, extra-special-file with "/etc/guix/channels.scm" just
> does not do anything. No error, no warning. That is pretty unexpected.
Yes, why is that? At first sight, that’s because ‘extra-special-file’
does things at activation time; there’s no check happening at
configuration time.
It was really meant for /bin/sh, /usr/bin/env, and similar. The reason
its effect is silently dismissed in this case is, I think, because its
activation runs before the /etc activation. So it’s really bad luck.
I’m not sure what to do here, apart from maybe recommending against
broad use of this service.
> * There is no terse way to turn it off
>
> Currently my configuration contains this:
>
> (modify-services %base-services
> (guix-service-type
> config => (guix-configuration
> (inherit config)
> (channels #f))))
Hmm right. You do want to create /etc/guix/channels.scm though, right?
(Since you had it initially.)
> * Q: Is there an easy way to fill (channels)?
>
> After I learned that (channels) is a thing, I wanted to use it, but did not find
> any simple way how to do so. My channels are in channels.scm produced by `guix
> describe --format=channels', and I do not see any simple way to pass the content
> of that file into (channels). No, it does not accept (local-file). I tried
> just (read)-ing it, but that too does not work.
That would be: (guix-configuration … (channels (load "channels.scm"))).
> * Q: Is the default value right?
>
> Currently it defaults to %default-channels, which causes all this magic. Would
> it not be better to default to #f, so that it would do nothing magical out of
> the box and would be backwards compatible? You could still turn it on by
> (Somehow? See above.) providing desired value.
Yes, we could change the default to #f: it’s equivalent to
‘%default-channels’ but wouldn’t cause the undesirable side effect you
experienced.
Do you want to prepare a patch (or two)? :-)
Thanks for your feedback, and apologies again for the inconvenience!
Ludo’.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The `channels' field of `operating-system' record
2024-04-10 15:17 ` Ludovic Courtès
@ 2024-04-15 22:04 ` Tomas Volf
2024-04-19 20:10 ` Ludovic Courtès
2024-05-08 23:16 ` Tomas Volf
1 sibling, 1 reply; 10+ messages in thread
From: Tomas Volf @ 2024-04-15 22:04 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 6946 bytes --]
On 2024-04-10 17:17:27 +0200, Ludovic Courtès wrote:
> Hello,
>
> Tomas Volf <~@wolfsden.cz> skribis:
>
> > After ~2 hours of digging I realized this is caused by the changes in
> > 883e69cdfd226c8f40b6e3b76ce0740b59857de6.
> >
> > I see couple of issues here (in no particular order, questions prefixed with Q):
> >
> > * My configuration file just *silently* stopped working.
> >
> > That is not great for obvious reasons.
> >
> > * There is no news entry
>
> Oops, my apologies; the change felt pretty innocuous when I merged it,
> but in hindsight, it seems clear that a news entry was warranted.
> Lesson learned.
>
> We can still add that news entry, though fewer people will see it now.
>
> Thoughts?
Sorry for the late response, I have sadly been somewhat busy. I see, so even if
you add the news entry now, only people who had not yet pulled the commit in
question would see it. If that is the case, there is probably not much of a
reason to do it now.
>
> > * Broken default behavior.
> >
> > Currently, out of the box, extra-special-file with "/etc/guix/channels.scm" just
> > does not do anything. No error, no warning. That is pretty unexpected.
>
> Yes, why is that? At first sight, that’s because ‘extra-special-file’
> does things at activation time; there’s no check happening at
> configuration time.
>
> It was really meant for /bin/sh, /usr/bin/env, and similar. The reason
> its effect is silently dismissed in this case is, I think, because its
> activation runs before the /etc activation. So it’s really bad luck.
>
> I’m not sure what to do here, apart from maybe recommending against
> broad use of this service.
I will re-phrase the above into a documentation patch.
>
> > * There is no terse way to turn it off
> >
> > Currently my configuration contains this:
> >
> > (modify-services %base-services
> > (guix-service-type
> > config => (guix-configuration
> > (inherit config)
> > (channels #f))))
>
> Hmm right. You do want to create /etc/guix/channels.scm though, right?
> (Since you had it initially.)
Yes, I do want to create it, but with (channels #f) the (extra-special-file)
works again. ^_^
>
> > * Q: Is there an easy way to fill (channels)?
> >
> > After I learned that (channels) is a thing, I wanted to use it, but did not find
> > any simple way how to do so. My channels are in channels.scm produced by `guix
> > describe --format=channels', and I do not see any simple way to pass the content
> > of that file into (channels). No, it does not accept (local-file). I tried
> > just (read)-ing it, but that too does not work.
>
> That would be: (guix-configuration … (channels (load "channels.scm"))).
That does not seems to work, I am getting this error:
/tmp $ guix system build os.scm
;;; compiling /tmp/channels.scm
;;; /tmp/channels.scm:1:7: warning: possibly unbound variable `channel'
;;; /tmp/channels.scm:2:9: warning: possibly unbound variable `name'
;;; /tmp/channels.scm:3:9: warning: possibly unbound variable `url'
;;; /tmp/channels.scm:4:9: warning: possibly unbound variable `branch'
;;; /tmp/channels.scm:5:9: warning: possibly unbound variable `commit'
;;; /tmp/channels.scm:7:9: warning: possibly unbound variable `introduction'
;;; /tmp/channels.scm:8:11: warning: possibly unbound variable `make-channel-introduction'
;;; /tmp/channels.scm:10:13: warning: possibly unbound variable `openpgp-fingerprint'
;;; compiled /home/wolf/.cache/guile/ccache/3.0-LE-8-4.6/tmp/channels.scm.go
Backtrace:
In guix/scripts/system.scm:
1306:4 19 (_)
In ice-9/boot-9.scm:
1752:10 18 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In guix/store.scm:
661:37 17 (thunk)
1300:8 16 (call-with-build-handler #<procedure 7f9cf8f76de0 at guix/ui.scm:1222:2 (con…> …)
2180:25 15 (run-with-store #<store-connection 256.100 7f9cfc3f4370> _ #:guile-for-build _ …)
In guix/scripts/system.scm:
848:2 14 (_ _)
722:8 13 (_ #<store-connection 256.100 7f9cfc3f4370>)
In gnu/system.scm:
1300:19 12 (operating-system-derivation _)
837:11 11 (operating-system-services #<<operating-system> kernel: #<package linux-libre…>)
In /tmp/os.scm:
19:12 10 (services #<<operating-system> kernel: #<package linux-libre@6.8.5 gnu/packag…>)
In gnu/services.scm:
383:23 9 (%modify-services (#<<service> type: #<service-type login 7f9cfbd70840> v…> …) …)
In srfi/srfi-1.scm:
460:18 8 (fold #<procedure 7f9cfc0759e0 at gnu/services.scm:383:29 (service services)> …)
In gnu/services.scm:
384:37 7 (_ #<<service> type: #<service-type guix 7f9cfbd92240> value: #<<guix-config…> …)
354:28 6 (apply-clauses _ #<<service> type: #<service-type guix 7f9cfbd92240> value: …> …)
In /tmp/os.scm:
23:36 5 (_ #<<service> type: #<service-type guix 7f9cfbd92240> value: #<<guix-configu…>)
In ice-9/boot-9.scm:
2836:4 4 (save-module-excursion #<procedure 7f9cf8536cf0 at ice-9/boot-9.scm:4393:3 ()>)
4388:12 3 (_)
In /tmp/channels.scm:
1:7 2 (_)
In ice-9/boot-9.scm:
1685:16 1 (raise-exception _ #:continuable? _)
1685:16 0 (raise-exception _ #:continuable? _)
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
error: channel: unbound variable
But after some experimentation (and looking into pull.scm), it seems what I need
is this:
(use-modules (guix ui))
(use-modules (guix channels))
and
(channels (load* "channels.scm"
(make-user-module '((guix channels)))))
Which, while not exactly obvious, does work.
Maybe it would be best to extract (load-channels) from pull.scm into
guix/channels.scm, exporting it? (Since for example the above is missing error
checking code from (load-channels)).
>
> > * Q: Is the default value right?
> >
> > Currently it defaults to %default-channels, which causes all this magic. Would
> > it not be better to default to #f, so that it would do nothing magical out of
> > the box and would be backwards compatible? You could still turn it on by
> > (Somehow? See above.) providing desired value.
>
> Yes, we could change the default to #f: it’s equivalent to
> ‘%default-channels’ but wouldn’t cause the undesirable side effect you
> experienced.
>
> Do you want to prepare a patch (or two)? :-)
I will try to get to it over the weekend.
>
> Thanks for your feedback, and apologies again for the inconvenience!
No worries, these things happen ^_^
>
> Ludo’.
>
Tomas
--
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: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The `channels' field of `operating-system' record
2024-04-15 22:04 ` Tomas Volf
@ 2024-04-19 20:10 ` Ludovic Courtès
0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2024-04-19 20:10 UTC (permalink / raw)
To: guix-devel
Hi,
Tomas Volf <~@wolfsden.cz> skribis:
> On 2024-04-10 17:17:27 +0200, Ludovic Courtès wrote:
[...]
>> Yes, why is that? At first sight, that’s because ‘extra-special-file’
>> does things at activation time; there’s no check happening at
>> configuration time.
>>
>> It was really meant for /bin/sh, /usr/bin/env, and similar. The reason
>> its effect is silently dismissed in this case is, I think, because its
>> activation runs before the /etc activation. So it’s really bad luck.
>>
>> I’m not sure what to do here, apart from maybe recommending against
>> broad use of this service.
>
> I will re-phrase the above into a documentation patch.
Great.
>> That would be: (guix-configuration … (channels (load "channels.scm"))).
>
> That does not seems to work, I am getting this error:
>
> /tmp $ guix system build os.scm
> ;;; compiling /tmp/channels.scm
> ;;; /tmp/channels.scm:1:7: warning: possibly unbound variable `channel'
[...]
> But after some experimentation (and looking into pull.scm), it seems what I need
> is this:
>
> (use-modules (guix ui))
> (use-modules (guix channels))
>
> and
>
> (channels (load* "channels.scm"
> (make-user-module '((guix channels)))))
Or simpler: use (guix channels) in your OS config so you can use
(load "channels.scm").
(‘load’ evaluates code in the current module.)
> Maybe it would be best to extract (load-channels) from pull.scm into
> guix/channels.scm, exporting it? (Since for example the above is missing error
> checking code from (load-channels)).
Yes, good idea, we can do that.
Thanks for your feedback!
Ludo’.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: The `channels' field of `operating-system' record
2024-04-10 15:17 ` Ludovic Courtès
2024-04-15 22:04 ` Tomas Volf
@ 2024-05-08 23:16 ` Tomas Volf
1 sibling, 0 replies; 10+ messages in thread
From: Tomas Volf @ 2024-05-08 23:16 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 522 bytes --]
On 2024-04-10 17:17:27 +0200, Ludovic Courtès wrote:
> Yes, we could change the default to #f: it’s equivalent to
> ‘%default-channels’ but wouldn’t cause the undesirable side effect you
> experienced.
>
> Do you want to prepare a patch (or two)? :-)
Well it took me approximately forever to get to, but finally:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70839
Cheers,
T.
--
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: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-05-08 23:17 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-09 4:06 The `channels' field of `operating-system' record Nathan Dehnel
2024-04-09 4:16 ` Marek Paśnikowski
2024-04-09 12:28 ` Tomas Volf
2024-04-09 12:29 ` Tomas Volf
2024-04-09 12:33 ` Felix Lechner via Development of GNU Guix and the GNU System distribution.
-- strict thread matches above, loose matches on Subject: below --
2024-04-07 16:05 Tomas Volf
2024-04-10 15:17 ` Ludovic Courtès
2024-04-15 22:04 ` Tomas Volf
2024-04-19 20:10 ` Ludovic Courtès
2024-05-08 23:16 ` Tomas Volf
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).