From patchwork Sun Oct 5 23:49:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tomas Volf <~@wolfsden.cz> X-Patchwork-Id: 43436 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 4CCCD27BC4B; Mon, 6 Oct 2025 00:50:34 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,DMARC_NONE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS autolearn=ham autolearn_force=no version=4.0.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id B655927BC49 for ; Mon, 6 Oct 2025 00:50:33 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v5YUg-0006N5-E0; Sun, 05 Oct 2025 19:50:22 -0400 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 1v5YUV-0006Mi-4d for guix-patches@gnu.org; Sun, 05 Oct 2025 19:50:13 -0400 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 1v5YUR-0001vv-89; Sun, 05 Oct 2025 19:50:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=wDK/Rt9Rj7NAU1oJJJv5/fupeeYbRKWokC602SivUyg=; b=fOO5yb3sF9CMVtbwKA71s6RGwLd0Xe3lFR0IVEsWuQMYZxaSbuoCxJWsmBo0/VWl79TvZI3y6gMdlkzvkZ7exF6M7ApvcHgeMT8QrjHoXlrKk+cZk54ijaYWkm2cn+CtXMaw3IGb69eHxplBwCNtfR9zkyhLAl+Hqxb+jJGNSYk7oCAktJVsO3vXb3Go0ge7S6YTzbL6ZxhohgrD7UsAlidYwJrQUkWn+1AQk1pFWzKTtlbUJyXxar+YV9VcuzrevhK5oZTIXBSr8wuYGJoqcRNnHJIRuJAkxuPH0p48gXPsq3MMRelJfszIWh3+WCL9QM2lsFsGohoUZEXXsFaTag==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1v5YUM-0000CY-IN; Sun, 05 Oct 2025 19:50:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#79577] [PATCH v2] monad-repl: Add "build-options" command. References: <2e0138e328c5ea94cf90b8b7cd63ed8b30252012.1759670383.git.~@wolfsden.cz> In-Reply-To: <2e0138e328c5ea94cf90b8b7cd63ed8b30252012.1759670383.git.~@wolfsden.cz> Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, gabriel@erlikon.ch, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, maxim@guixotic.coop, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sun, 05 Oct 2025 23:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 79577 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 79577@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz>, Christopher Baines , Gabriel Wicki , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Gabriel Wicki , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 79577-submit@debbugs.gnu.org id=B79577.1759708151702 (code B ref 79577); Sun, 05 Oct 2025 23:50:02 +0000 Received: (at 79577) by debbugs.gnu.org; 5 Oct 2025 23:49:11 +0000 Received: from localhost ([127.0.0.1]:53403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1v5YTW-0000BF-PR for submit@debbugs.gnu.org; Sun, 05 Oct 2025 19:49:11 -0400 Received: from wolfsden.cz ([37.205.8.62]:42386) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1v5YTT-0000B5-4U for 79577@debbugs.gnu.org; Sun, 05 Oct 2025 19:49:08 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 33E85327C6D; Sun, 5 Oct 2025 23:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1759708145; bh=9GOGf1dGcE4YYe95vjHlP7MuHJDq7ch9ytr4LRDJjgQ=; h=From:To:Cc:Subject:Date; b=quB30kFFAAPLC0nJtPpIz1HSQDwkOLjHJPmDUKzGeu3p8GpSfpRy84MSJlc9bhw0g p46RZ0CbEn5oryITVSIIXyIhnj2NO10t514TVF30e3KlkN5K/NRyFy9XuEIhedQFdr KZlp6/umJ9JHlI8PUG3UErlinDyAvM/4PqX2mI7uhWrkcRGXLDzLTYhqcrV5NophBn 6eSbxGadhyKxf8Hq7BzsQO7zPco/VN9cyN+qH9sjvuCvyM/T34RdR2AcwRLLGR2nwx q/eew2aj2bfs5FJ0ezUFY3OW/2MJ6dTlKFUO+InlvknvnDZp2NOCP8vlhdQ5DT6zX3 /AxnDsHRWRH6+BNQna9Kwdo0WE1gKCY9fMLYevjmHu/I19Xky0CkyvQ1rQA3U4pPEr OuWO6GIXWadJhc6OC6tjo1uFBIwNRC9nUG5DNgSNN3IStsNUxMuG9jZttHwsbmtZVK oC7gFjgAxd8IasMVw8+oHth8G0mLYsM1mwIFgJkVa6v3MkZTrutQyRki9DCgmIEAP8 M+yWeqk1lv+bqkMld8mufva0wG+0LJur99s0qikGZL84I2yGWBPXinY4QfZtD7FTwu vZMm87xuwZMZU8nZKCj6SsLUUdM5/LVomwATKbkzdTTDqHdrDBcrpYzlav3wibtmG+ qduDqoGOMcUJYPMcIeDeHp8I= Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 5EB24327D1E; Sun, 5 Oct 2025 23:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1759708144; bh=9GOGf1dGcE4YYe95vjHlP7MuHJDq7ch9ytr4LRDJjgQ=; h=From:To:Cc:Subject:Date; b=wOEc0ulAuuBAspgEyGLX5Dg3/N8kcQCI8/Mzt4yjBvbscqdy9xNwsWTRk0WWiJKsD JrjEHzNIfOJmsBHB+xzhAaI7KMjB1SE1vEMwvMdoGPYehG/FjoNh7P+chIPWGM4ytZ jbJ5jvTQd8tIcOoIr8w4pEx1KCae5kqCzQ0EDqQjji1dgQ3VG6zng6qSmWaPWOqyuP LQVqh3Cqna0zv1d+99EYogSjcWPX/wR3o4zla74XxUk64foiWML/zn+k81Bm2yK9hI de+vTFXcrrOpbg205ulzC3Mtm/4rFVcCeYiinoIRqSK2YtVpM5MOigzLWSMFy9T3hj aRO6HbWjz1SXpveZmLEv78n3cH2WXASbVcfJ0qCG4yRYet3ZfgFNAItvf4TRVb14oH ICrAEG98WKavDHlb+VOZRjcpzA8vNNt0H/tNGRxyLCkfESiAe9A/cgXyMLf6EbwM/Q LJIoeTGenRWe9KE0EEtLAUm9BosjzYz+mqrbuGccvFIT6uq82Rw3OdMKrUmDgQlaxd Bjz9/ADQsWypRH2aCbK3JV/vw6LUuVZhpIa2XVhX1yv3DdgfPPuZoYCPuws5XeDqnT FAyabDdp/v1jghDCmmE9m9Ss0lo+6GpQM8WTmXhJyzVWtaDXuq/Xtcu1LbtUg5pWUH 9/RoPwwylK1Z1h5xboqkFvyw= From: Tomas Volf <~@wolfsden.cz> Date: Mon, 6 Oct 2025 01:49:00 +0200 Message-ID: X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches There currently was no way to disable build offload for ,build from inside the REPL. Since offloaded builds sometimes do not error report entirely correctly, it is useful to be able to switch to local builds. This commit adds new ,build-options meta command, which allows to specify build options, including #:offload?. * guix/monad-repl.scm (%build-options): New variable. (evaluate/print-with-store, package-argument-command): Use it. (build-options): New meta command to set it. * doc/guix.texi (Using Guix Interactively): Document it. --- doc/guix.texi | 10 ++++++++++ guix/monad-repl.scm | 34 ++++++++++++++++++++++++++-------- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 3fd2a13968..5c82445619 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13204,6 +13204,16 @@ Using Guix Interactively output file name(s). @end deffn +@deffn {REPL command} build-options @var{options} +Set build options for rest of the REPL commands to @var{options}. Must +be a list of keywords with values accepted by procedure +@code{(@@ (guix store) set-build-options)}. An example would be: + +@example +,build-options '(#:offload? #f) +@end example +@end deffn + @deffn {REPL command} lower @var{object} Lower @var{object} into a derivation or store file name and return it. @end deffn diff --git a/guix/monad-repl.scm b/guix/monad-repl.scm index d6b39112b7..db4fe3c699 100644 --- a/guix/monad-repl.scm +++ b/guix/monad-repl.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014-2016, 2022-2023 Ludovic Courtès +;;; Copyright © 2025 Tomas Volf <~@wolfsden.cz> ;;; ;;; This file is part of GNU Guix. ;;; @@ -81,13 +82,18 @@ (define %build-verbosity ;; Current build verbosity level. 1) +(define %build-options + ;; Additional build options. + '()) + (define* (evaluate/print-with-store mvalue #:key build?) "Run monadic value MVALUE in the store monad and print its value." (with-store store - (set-build-options store - #:print-build-trace #t - #:print-extended-build-trace? #t - #:multiplexed-build-output? #t) + (apply set-build-options store + #:print-build-trace #t + #:print-extended-build-trace? #t + #:multiplexed-build-output? #t + %build-options) (with-status-verbosity %build-verbosity (let* ((guile (or (%guile-for-build) (default-guile-derivation store))) @@ -130,6 +136,17 @@ (define-meta-command ((build guix) repl (form)) (evaluate/print-with-store (lower-object (repl-eval repl form)) #:build? #t)) +(define-meta-command ((build-options guix) repl (opts)) + "build-options OPTIONS +Set build options to OPTIONS. Print previous value (to allow easy restore). + +Must be a list of keywords with values accepted by procedure +(@ (guix store) set-build-options). An example would be: + + ,build-options '(#:offload? #f)" + (repl-print repl %build-options) + (set! %build-options (repl-eval repl opts))) + (define-meta-command ((enter-store-monad guix) repl) "enter-store-monad Enter a REPL for values in the store monad." @@ -172,10 +189,11 @@ (define (package-argument-command repl form keyword default) (define phases (parameterize ((%graft? #f)) (with-store store - (set-build-options store - #:print-build-trace #t - #:print-extended-build-trace? #t - #:multiplexed-build-output? #t) + (apply set-build-options store + #:print-build-trace #t + #:print-extended-build-trace? #t + #:multiplexed-build-output? #t + %build-options) (run-with-store store (mlet %store-monad ((exp (bag->derivation bag*))) (if (gexp? exp)