Message ID | 20432b68d12d95a23ae3713e8a904bf9dfc003e1.camel@telenet.be |
---|---|
State | New |
Headers | show |
Series | [bug#46214] DRAFT: narinfo hooks for ‘guix publish’ | expand |
Context | Check | Description |
---|---|---|
cbaines/submitting builds | success | |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | fail | View Laminar job |
cbaines/issue | success | View issue |
I've began writing tests, will post all patches here (hook code, tests, service-extension code for guix-publish-service-type and system tests) once they are completed.
On 31.01.21 12:11, Maxime Devos wrote: > Hello Guix! > > I've a proposal to make ‘guix publish’ somewhat extensible. > The draft patch allows for passing a list of ‘hooks’ to guix > publish, with "guix publish --hooks=FILE-WITH-HOOKS.scm > --hooks=MORE-HOOKS.go". "guix publish" then will consult > this list of hooks at some points. > > I've defined a ‘narinfo-hook’, which allows adding extra > key value pairs to the generated narinfos. See the last > patch that adds a ‘hook.scm’ file for a silly example > that includes a random number and some arbitrary strings. I didn't looked really into the code, but would this also allow hooks like baking the nar-file and write it into the cache? Or is it only for the narinfos?
Sorry for the late response, for some reason your mail didn't end up in my inbox. A reminder for what my goal is: I am attempting to serve substitutes via a P2P system. Ludovic has a patch for substitutes over IPFS, myself I'm planning to write a patch for substitutes over GNUnet. This patch aims to define a simple ‘hook’ into ‘guix publish’ for adding the IPFS or GNUnet URI. On Mon, 2021-02-01 at 23:22 +0100, Jonathan Brielmaier wrote: > > On 31.01.21 12:11, Maxime Devos wrote: > > [...] > > I've defined a ‘narinfo-hook’, which allows adding extra > > key value pairs to the generated narinfos. [...] > I didn't looked really into the code, but would this also allow hooks > like baking the nar-file and write it into the cache? Or is it only for > the narinfos? This patch is only for the generation of the narinfos. (I would like to eventually write a hook that publishes the store item via GNUnet and embeds the URI in the narinfo, but there isn't yet a corresponding hook mechanism on the substituter side.) That said, other hook types could be defined with additional patches, though I don't know what use that would serve. Greetings, Maxime.
From 61c681cbe0b29b31587e71a905f34f0f12757a13 Mon Sep 17 00:00:00 2001 From: Maxime Devos <maximedevos@telenet.be> Date: Sun, 31 Jan 2021 11:06:46 +0100 Subject: [PATCH 2/2] DRAFT: add hook example TODO: should be located elsewere. --- hook.scm | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 hook.scm diff --git a/hook.scm b/hook.scm new file mode 100644 index 0000000000..7b81c8d761 --- /dev/null +++ b/hook.scm @@ -0,0 +1,27 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be> +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. +(use-modules (guix scripts publish)) + +(list + (narinfo-hook + (lambda (pathinfo . rest) + `(("LuckyNumber" . ,(random 1000)) + ("Stuff" . ,(object->string pathinfo))))) + (narinfo-hook + (lambda (pathinfo . rest) + `(("Cool" . "Beans"))))) -- 2.30.0