From patchwork Wed Apr 13 18:54:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Justin Veilleux X-Patchwork-Id: 38562 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 EEA2127BBEA; Wed, 13 Apr 2022 19:55:39 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED 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 6893827BBE9 for ; Wed, 13 Apr 2022 19:55:39 +0100 (BST) Received: from localhost ([::1]:36552 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nei9S-0000Rw-GW for patchwork@mira.cbaines.net; Wed, 13 Apr 2022 14:55:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nei8s-0000RN-Ch for guix-patches@gnu.org; Wed, 13 Apr 2022 14:55:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60140) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nei8s-0001GI-2x for guix-patches@gnu.org; Wed, 13 Apr 2022 14:55:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nei8s-0003qH-1B for guix-patches@gnu.org; Wed, 13 Apr 2022 14:55:02 -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: Wed, 13 Apr 2022 18:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54918 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 54918@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164987605714702 (code B ref -1); Wed, 13 Apr 2022 18:55:01 +0000 Received: (at submit) by debbugs.gnu.org; 13 Apr 2022 18:54:17 +0000 Received: from localhost ([127.0.0.1]:54037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nei89-0003p3-4p for submit@debbugs.gnu.org; Wed, 13 Apr 2022 14:54:17 -0400 Received: from lists.gnu.org ([209.51.188.17]:52278) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nei87-0003ow-Jg for submit@debbugs.gnu.org; Wed, 13 Apr 2022 14:54:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nei87-0000PE-C4 for guix-patches@gnu.org; Wed, 13 Apr 2022 14:54:15 -0400 Received: from [37.120.193.124] (port=41002 helo=mail.cock.li) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nei84-0001Cw-Sm for guix-patches@gnu.org; Wed, 13 Apr 2022 14:54:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cock.li; s=mail; t=1649876047; bh=U1oPkSARRXUa1KTiLiawKoyY6Q4jK+A/j/eblBDAdHU=; h=Date:To:From:Subject:From; b=cXf6KN0czrfUqUHUzbOe1fMfajVmSMwtMqepJrCT7b95AmJ/oI2c20MopmyPezhNc 9/tRQjsVJB25e7secvZmrkQyT9TmJ2NYNErY42UhkHL4HPUlk36fDXzh27aKrCDNcp FMQCRUALuxU1E3uhUDwXdQ9Ttf4GicD7Pvbv4I5uzQ3wRtlrdGUWEwYGH7l6iaQVpK 1S35GZeIYAuVYGWv+Lqs2FEF0JIE20ozXfxK+0NiU3rBOrNsGFRfyHBrFlG4C9BEF0 zR/l3DFZYw5xTwOYDBlmFbl8bG4f8+MZwbY6MMH+CQXA+rwlc6/HeTd5b88/YEpk6w FreuAgesVerLQ== Message-ID: <7c216565-f087-5d0a-bcea-66fe7c8a0295@cock.li> Date: Wed, 13 Apr 2022 14:54:05 -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: en-US From: Justin Veilleux X-Host-Lookup-Failed: Reverse DNS lookup failed for 37.120.193.124 (failed) Received-SPF: pass client-ip=37.120.193.124; envelope-from=terramorpha@cock.li; helo=mail.cock.li X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H2=-0.001, RDNS_NONE=0.793, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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 I noticed that the extension mechanism for guix-service-type don't expose authorized keys and substitute-urls. I want to create a service to easily set up new channels with their associated substitutes server, but I have to go through modify-services. I realize that this change isn't trivial as it breaks some people's os.scm and requires updating the documentation, but I think it is a very low hanging fruit in terms of functionality. Maybe there is a reason why things are the way they are, I would greatly appreciate comments. Cheers. From 229ccde84a2183d31860c9616820763ddf2ac5f1 Mon Sep 17 00:00:00 2001 From: terramorpha Date: Mon, 11 Apr 2022 00:30:07 -0400 Subject: [PATCH] first commit --- gnu/services/base.scm | 50 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 5d7c69a9cd..5d779eec1a 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 gexps + (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