unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Emmanuel Agullo <emmanuel.agullo@inria.fr>
To: Ludovic Courtes <ludovic.courtes@inria.fr>
Cc: guix-devel@gnu.org
Subject: Re: Fetching a channel set over HTTP
Date: Fri, 19 Jan 2024 10:54:49 +0100 (CET)	[thread overview]
Message-ID: <1287658595.12723884.1705658089921.JavaMail.zimbra@inria.fr> (raw)
In-Reply-To: <87mst1br6p.fsf@inria.fr>

Hello Ludo, hello Guix,

Thank you once again for the snippet and thank you also for sharing 
with the guix community the idea of integrating it!

Nothing to add except that it would be awesome! (And maybe if it
was not explicit enough: another possible application is that it would 
be a convenient way to set up a tunable rolling-release only slightly
delayed to ensure one can follow the latest guix(/channels) 
commit(s) for which binaries (or a subset of them) are available.)

Best regards,

Manu

----- Mail original -----
> De: "Ludovic Courtes" <ludovic.courtes@inria.fr>
> À: guix-devel@gnu.org
> Cc: "Emmanuel Agullo" <emmanuel.agullo@inria.fr>
> Envoyé: Vendredi 19 Janvier 2024 10:36:30
> Objet: Fetching a channel set over HTTP

> 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’.


      reply	other threads:[~2024-01-19 17:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19  9:36 Fetching a channel set over HTTP Ludovic Courtès
2024-01-19  9:54 ` Emmanuel Agullo [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=1287658595.12723884.1705658089921.JavaMail.zimbra@inria.fr \
    --to=emmanuel.agullo@inria.fr \
    --cc=guix-devel@gnu.org \
    --cc=ludovic.courtes@inria.fr \
    /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).