From patchwork Sun May 1 15:35:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Justin Veilleux X-Patchwork-Id: 39041 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 7AE1527BBEA; Sun, 1 May 2022 16:37:29 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D8F0127BBE9 for ; Sun, 1 May 2022 16:37:28 +0100 (BST) Received: from localhost ([::1]:35776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlBdY-0001sF-2q for patchwork@mira.cbaines.net; Sun, 01 May 2022 11:37:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48274) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlBd8-0001rr-9G for guix-patches@gnu.org; Sun, 01 May 2022 11:37:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40072) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nlBd8-0006Do-1A for guix-patches@gnu.org; Sun, 01 May 2022 11:37:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nlBd7-0005fs-Ry for guix-patches@gnu.org; Sun, 01 May 2022 11:37:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54918] [WIP] make guix-service-type more extendable Resent-From: Justin Veilleux Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 01 May 2022 15:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54918 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Ludovic =?utf-8?q?Court=C3=A8s?= Cc: 54918@debbugs.gnu.org Received: via spool by 54918-submit@debbugs.gnu.org id=B54918.165141939721780 (code B ref 54918); Sun, 01 May 2022 15:37:01 +0000 Received: (at 54918) by debbugs.gnu.org; 1 May 2022 15:36:37 +0000 Received: from localhost ([127.0.0.1]:33969 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlBci-0005fE-Ge for submit@debbugs.gnu.org; Sun, 01 May 2022 11:36:36 -0400 Received: from [37.120.193.124] (port=40476 helo=mail.cock.li) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nlBcg-0005ez-Cw for 54918@debbugs.gnu.org; Sun, 01 May 2022 11:36:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cock.li; s=mail; t=1651419388; bh=S/D+j2NPOZ8jToy4Y1kSKBYGpVT13l8xhlPgrJy6ghk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=rvRkivQgIZzK11X/BU/tt+eTWsNtLw2I24uS5kDXNZeQ3Sm9/BOvg4LbBU7dzre8g scUqDMuWU7PXre6jLpTLLxHXN8whhcj6PbKv3wi0qbBN3KEMugzLGRgFeAoWXhn/bU OBRZqDA4Tq22v+4pGvJE7Y52LfzA7jI7049jq897afDuoLwW6F2mkfjS/TZ03jJWfB vSJzwWQU5BhmdKdH3zNQ3MuBVjOVBmBhoC/tKc4cBIV3AGaB0p+JL+VRsJ16zrflmF Lk9LYq9sQ7bMOX8iZqiWizodMf5jF1NRMSkB8rpYp9H7im+QAf3bmqNGNUbkYmoY2d qhN8351QmYQSg== Message-ID: <20a5e363-ccd7-1e1a-482b-6bbb169afecc@cock.li> Date: Sun, 1 May 2022 11:35:40 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Content-Language: fr References: <7c216565-f087-5d0a-bcea-66fe7c8a0295@cock.li> <87wnf64pu8.fsf@gnu.org> From: Justin Veilleux In-Reply-To: <87wnf64pu8.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Hi, I updated the documentation (to the best of my abilities, I've never written texinfo). For the changelog, I'm not familiar with the format for bigger changes, could you point me to the relevant documentation? Cheers From 314f6f1c8cb1057e6880f1776d096a615c2c5a30 Mon Sep 17 00:00:00 2001 From: terramorpha Date: Mon, 11 Apr 2022 00:30:07 -0400 Subject: [PATCH] commit message --- doc/guix.texi | 21 ++++++++++++++++++ gnu/services/base.scm | 50 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 54793c9648..910183a8d2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -102,6 +102,7 @@ Copyright @copyright{} 2021 Sarah Morgensen@* Copyright @copyright{} 2021 Josselin Poiret@* Copyright @copyright{} 2022 Remco van 't Veer@* Copyright @copyright{} 2022 Aleksandr Vityazev@* +Copyright @copyright{} 2022 Justin Veilleux@* Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or @@ -17147,6 +17148,26 @@ A directory path where the @command{guix-daemon} will perform builds. @end table @end deftp +@anchor{guix-extension-type} +@deftp {Data Type} guix-extension + +This data type represents the parameters of the Guix build daemon that +are extendable. This is the type of the object that must be used within +a guix service extension. +@xref{Service Composition}, for more information. + +@table @asis +@item @code{authorized-keys} (default: @code{'()}) +A list of file-like objects where each element contains a public key. + +@item @code{substitute-urls} (default: @code{'()}) +A list of strings where each element is a substitute URL. + +@item @code{chroot-directories} (default: @code{'()}) +A list of file-like objects or strings pointing to additional directories the build daemon can use. +@end table +@end deftp + @deffn {Scheme Procedure} udev-service [#:udev @var{eudev} #:rules @code{'()}] Run @var{udev}, which populates the @file{/dev} directory dynamically. udev rules can be provided as a list of files through the @var{rules} diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 5d7c69a9cd..fc799cb806 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2021 Hui Lu ;;; Copyright © 2021, 2022 Maxim Cournoyer ;;; Copyright © 2022 Guillaume Le Vaillant +;;; Copyright © 2022 Justin Veilleux ;;; ;;; This file is part of GNU Guix. ;;; @@ -187,6 +188,12 @@ (define-module (gnu services base) guix-configuration-extra-options guix-configuration-log-file + guix-extension + guix-extension? + guix-extension-authorized-keys + guix-extension-substitute-urls + guix-extension-chroot-directories + guix-service-type guix-publish-configuration guix-publish-configuration? @@ -1788,6 +1795,25 @@ (define* (references-file item #:optional (name "references")) #:references-graphs (("graph" ,item)))) (plain-file name "()"))) +(define-record-type* + guix-extension make-guix-extension + guix-extension? + (authorized-keys guix-extension-authorized-keys ;list of file-like + (default '())) + (substitute-urls guix-extension-substitute-urls ;list of strings + (default '())) + (chroot-directories guix-extension-chroot-directories ;list of file-like/strings + (default '()))) + +(define (guix-extension-merge a b) + (guix-extension + (authorized-keys (append (guix-extension-authorized-keys a) + (guix-extension-authorized-keys b))) + (substitute-urls (append (guix-extension-substitute-urls a) + (guix-extension-substitute-urls b))) + (chroot-directories (append (guix-extension-chroot-directories a) + (guix-extension-chroot-directories b))))) + (define guix-service-type (service-type (name 'guix) @@ -1798,30 +1824,34 @@ (define guix-service-type (service-extension profile-service-type (compose list guix-configuration-guix)))) - ;; Extensions can specify extra directories to add to the build chroot. - (compose concatenate) - (extend (lambda (config directories) + ;; Extensions can specify extra directories to add to the build chroot, + ;; extra substitute urls and extra authorized keys + (compose (lambda (args) (fold guix-extension-merge (guix-extension) args))) + (extend (lambda (config extension) (guix-configuration (inherit config) + (authorized-keys (append (guix-extension-authorized-keys extension) + (guix-configuration-authorized-keys config))) + (substitute-urls (append (guix-extension-substitute-urls extension) + (guix-configuration-substitute-urls config))) (chroot-directories - (append (guix-configuration-chroot-directories config) - directories))))) + (append (guix-extension-chroot-directories extension) + (guix-configuration-chroot-directories config)))))) (default-value (guix-configuration)) (description "Run the build daemon of GNU@tie{}Guix, aka. @command{guix-daemon}."))) - (define-record-type* guix-publish-configuration make-guix-publish-configuration guix-publish-configuration? - (guix guix-publish-configuration-guix ;file-like + (guix guix-publish-configuration-guix ;file-like (default guix)) - (port guix-publish-configuration-port ;number + (port guix-publish-configuration-port ;number (default 80)) - (host guix-publish-configuration-host ;string + (host guix-publish-configuration-host ;string (default "localhost")) - (advertise? guix-publish-advertise? ;boolean + (advertise? guix-publish-advertise? ;boolean (default #f)) (compression guix-publish-configuration-compression (thunked) -- 2.34.0