From patchwork Sun Dec 3 09:31:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saku Laesvuori X-Patchwork-Id: 57247 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 DB8AC27BBEA; Sun, 3 Dec 2023 09:34:14 +0000 (GMT) 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=ham 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 96FF227BBE2 for ; Sun, 3 Dec 2023 09:34:13 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r9irK-0000Oe-JA; Sun, 03 Dec 2023 04:33:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r9irJ-0000Nq-5B for guix-patches@gnu.org; Sun, 03 Dec 2023 04:33:53 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r9irI-0005AI-QC for guix-patches@gnu.org; Sun, 03 Dec 2023 04:33:52 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r9irS-00057l-AY for guix-patches@gnu.org; Sun, 03 Dec 2023 04:34:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#67598] [PATCH] gnu: services: guix: Allow gexps evaluating to a list of build-machines Resent-From: Saku Laesvuori Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 03 Dec 2023 09:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 67598 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 67598@debbugs.gnu.org Cc: Saku Laesvuori X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170159603619681 (code B ref -1); Sun, 03 Dec 2023 09:34:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Dec 2023 09:33:56 +0000 Received: from localhost ([127.0.0.1]:59135 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9irL-00057M-Sj for submit@debbugs.gnu.org; Sun, 03 Dec 2023 04:33:56 -0500 Received: from lists.gnu.org ([2001:470:142::17]:49412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r9irK-000577-0M for submit@debbugs.gnu.org; Sun, 03 Dec 2023 04:33:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r9ir3-0000JV-St for guix-patches@gnu.org; Sun, 03 Dec 2023 04:33:38 -0500 Received: from vmi571514.contaboserver.net ([75.119.130.101] helo=mail.laesvuori.fi) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r9iqv-00051r-R1 for guix-patches@gnu.org; Sun, 03 Dec 2023 04:33:36 -0500 Received: from X-kone.lan (88-113-24-127.elisa-laajakaista.fi [88.113.24.127]) by mail.laesvuori.fi (Postfix) with ESMTPSA id 182AA3400B0; Sun, 3 Dec 2023 10:33:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=laesvuori.fi; s=mail; t=1701596006; bh=++gTLDjUeMhNPmQ8bCUP6w82kkqkL5RAJHkPZAZAQBA=; h=From:To:Cc:Subject:Date; b=GnFVB9HHjtlVoK2UMiS/OfEF7mpgjDxvgqAS/5y7rLk8czfiHfOReWWGyT+BxOnp0 CIt3ULrEh42CIVafP0Vgfm+3dnEwZlkfTEEq7D7zWIWv9E7H8y1I7aJLvRSAD4vMNb 8I/0IcWai2lFOims5OCowYv3RpvoFOd9fJNeJ/WY= Date: Sun, 3 Dec 2023 11:31:42 +0200 Message-ID: <4cb4eac27ae7990eb9c79bcea0c05dbdbe0bdf37.1701595902.git.saku@laesvuori.fi> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=75.119.130.101; envelope-from=saku@laesvuori.fi; helo=mail.laesvuori.fi X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham 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: , Reply-to: Saku Laesvuori X-ACL-Warn: , Saku Laesvuori via Guix-patches X-Patchwork-Original-From: Saku Laesvuori via Guix-patches via From: Saku Laesvuori Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/services/base.scm (guix-machines-files-installation): Handle machines being a mixed list of build-machines and lists of build-machines. * doc/guix.texi: Document it. Change-Id: Ie404562ca0b564413233c3a624046da831893dc3 --- This enables doing things like the DNS-SD example mentioned in '2.4.2 Using the Offload Facility' directly from the operating-system declaration. doc/guix.texi | 9 ++++++--- gnu/services/base.scm | 8 +++++++- 2 files changed, 13 insertions(+), 4 deletions(-) base-commit: cd46757c1a0f886848fbb6828c028dd2a2532767 diff --git a/doc/guix.texi b/doc/guix.texi index 1fd2e21608..3e599742c3 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19316,7 +19316,8 @@ Base Services @anchor{guix-configuration-build-machines} @item @code{build-machines} (default: @code{#f}) This field must be either @code{#f} or a list of gexps evaluating to a -@code{build-machine} record (@pxref{Daemon Offload Setup}). +@code{build-machine} record or to a list of @code{build-machine} records +(@pxref{Daemon Offload Setup}). When it is @code{#f}, the @file{/etc/guix/machines.scm} file is left untouched. Otherwise, the list of of gexps is written to @@ -19329,7 +19330,8 @@ Base Services (guix-configuration (build-machines (list #~(build-machine (name "foo.example.org") @dots{}) - #~(build-machine (name "bar.example.org") @dots{})))) + #~(list (build-machine (name "bar.example.org") @dots{}) + (build-machine (name "foobaz.example.org") @dots{}))))) @end lisp Additional build machines may be added @i{via} the @code{guix-extension} @@ -19385,7 +19387,8 @@ Base Services A list of strings where each element is a substitute URL. @item @code{build-machines} (default: @code{'()}) -A list of gexps that evaluate to @code{build-machine} records +A list of gexps that evaluate to @code{build-machine} records or to a list of +@code{build-machine} records. (@pxref{Daemon Offload Setup}). Using this field, a service may add new build machines to receive builds diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 82c6940780..beb710f95c 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -1765,7 +1765,13 @@ (define (guix-machines-files-installation machines) (mkdir-p (dirname machines-file))) ;; Installed the declared machines file. - (symlink #+(scheme-file "machines.scm" machines) + (symlink #+(scheme-file "machines.scm" + `(apply append + (map (lambda (entry) + (if (list? entry) + entry + (list entry))) + ,machines))) machines-file)))) (define-record-type*