From: "Ludovic Courtès" <ludovic.courtes@inria.fr>
To: <guix-devel@gnu.org>
Cc: Emmanuel Agullo <emmanuel.agullo@inria.fr>
Subject: Fetching a channel set over HTTP
Date: Fri, 19 Jan 2024 10:36:30 +0100 [thread overview]
Message-ID: <87mst1br6p.fsf@inria.fr> (raw)
Hello Guix!
My colleague Emmanuel Agullo came up with an interesting use case and
suggestion that we got around to play with. If you paste the following
snippet as ~/.config/guix/channels.scm:
--8<---------------cut here---------------start------------->8---
(use-modules (guix http-client)
(json)
(guix channels))
(define-syntax alist-let
(syntax-rules ()
((_ alist (variable rest ...) body ...)
(let ((variable (assoc-ref alist (symbol->string 'variable))))
(alist-let alist (rest ...) body ...)))
((_ alist () body ...)
(begin body ...))))
(define (alist->channel-introduction alist)
(alist-let alist (signer commit)
(make-channel-introduction commit
(openpgp-fingerprint signer))))
(define (alist->channel alist)
(alist-let alist (name url branch commit introduction)
(channel (name (string->symbol name))
(url url)
(branch branch)
(commit commit)
(introduction
(and=> introduction alist->channel-introduction)))))
(pk 'channels
(map alist->channel
(vector->list
(json->scm
(http-fetch/cached
"https://people.bordeaux.inria.fr/lcourtes/tmp/channels.json")))))
--8<---------------cut here---------------end--------------->8---
… then anytime you run ‘guix pull’, you’ll actually get the channels I
published in that ‘channels.json’ file (generated by
‘guix describe -f json’).
Since it’s JSON, you’re not executing arbitrary code; the authentication
and downgrade prevention mechanisms are in effect too, although the file
could direct you to unauthenticated third-party channels (authentication
is always required for the ‘guix’ channel itself) and there’s no
downgrade prevention if you’re using ‘time-machine’ rather than ‘pull’.
The use cases are:
1. Within a team, everyone would default to downloading an agreed-upon
channels file. Someone in the team is responsible for keeping that
file up-to-date etc.
2. One could define a “stable distro” by publishing such a file:
they’d pin channels to specific commits and change those commits
only when the packages they care about have been tested.
3. As someone distributing software, you could publish such a file and
provide simple instructions to deploy the software.
4. Cuirass, qa.guix, etc. could publish a channels file for each
issue, branch, or jobset so that users can trivially reproduce it.
What if we exposed the snippet above (1) as a ‘download-channels’
procedure, say, and (2) at the CLI level?
guix time-machine -C https://example.org/channels.json -- …
Thoughts?
Ludo’.
next reply other threads:[~2024-01-19 9:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 9:36 Ludovic Courtès [this message]
2024-01-19 9:54 ` Fetching a channel set over HTTP Emmanuel Agullo
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=87mst1br6p.fsf@inria.fr \
--to=ludovic.courtes@inria.fr \
--cc=emmanuel.agullo@inria.fr \
--cc=guix-devel@gnu.org \
/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).