[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Loading Channels from a file
From: |
Phil Beadling |
Subject: |
Loading Channels from a file |
Date: |
Sat, 16 Oct 2021 22:24:40 +0100 |
Hi,
I have what I fear may be more of Guile question than a Guix question - but
the context is Guix, so here goes!
If I want to do the following - let's say I'm interested in playing around
with Guix programatically, as it existed on the 3rd October. The following
works perfectly well and can be passed into "guix repl -- my-script.scm".
(define my-inferior
(inferior-for-channels my-channels))
Obviously I need to provide a channel definition - to do this I cut and
paste my copy of the channels.scm from the 3rd October directly into a
variable my-channels in the same script and use as per above.
(define my-channels
(list (channel ;; channel describing the snapshot of Guix itself
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(commit
"20bc9ecc204a610a0d5fa8b88c74421f57dbaf3b") ;; 03/10
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
(openpgp-fingerprint
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))
(channel
(name 'guix-science)
(url "https://github.com/guix-science/guix-science.git")
(commit
"b574aa67743cd4f138fd32efb7c116342f360625") ;; 03/10
(introduction
(make-channel-introduction
"b1fe5aaff3ab48e798a4cce02f0212bc91f423dc"
(openpgp-fingerprint
"CA4F 8CF4 37D7 478F DA05 5FD4 4213 7701 1A37 8446"))))))
So far no surprises. I'd like to make this script a bit more generic so I
want to be able to pass in the channel.scm file as a command line
parameter. So I've come up with this:
(define my-channels2 (call-with-input-file (option-ref options 'channel #f)
read))
The "(option-ref options 'channel #f)" is just returning a command line
option --channel which is a string of the form "/path/to/my/channels.scm" -
this bit of the code I've tested to death (even replacing the a hardcoded
string to be sure) - it's not the problem.
If I (display my-channels2) it looks correct, but I notice that unlike
(display my-channels) it hasn't evaluated each channel into a channel
structure.
my-channels2 looks like this:
(list (channel (name (quote guix)) (url
https://git.savannah.gnu.org/git/guix.git)....
But my-channels looks like this:
(#<<channel> name: guix url: "https://git.savannah.gnu.org/git/guix.git
".....
It will probably come as no surprise that when I try to feed my-channels2
into inferior-for-channels, I'm getting a type mismatch:
In procedure struct-vtable: Wrong type argument in position 1 (expecting
struct): list
I'm clearly missing something trivial to get the channel definition loaded
from a file into a form the same as when it's hardcoded directly into my
Scheme script.
Can anyone point me in the right direction?
Cheers,
Phil.
- Loading Channels from a file,
Phil Beadling <=