From patchwork Sun Oct 5 13:19:43 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: 43433 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 6FC2F27BC49; Sun, 5 Oct 2025 14:23:38 +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=unavailable 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 037AD27BC4A for ; Sun, 5 Oct 2025 14:23:37 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v5Ohq-00032A-Kw; Sun, 05 Oct 2025 09:23:18 -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 1v5Oho-00031w-4f for guix-patches@gnu.org; Sun, 05 Oct 2025 09:23:17 -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 1v5Ohm-0001Wo-Uf; Sun, 05 Oct 2025 09:23:14 -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:Subject; bh=BrM2X7rrX4nnYmi4jpRCtI7Ctznv4gO7VVbLsCOBtZ8=; b=RV+VvnMiF2FXDrEwgJ3gjM2pinOTm7MUvibH5q1SxkupvDUUiTv4QvvOfe4gOxHNX7ypJrXw/NaL1pEyHNg6kNT2SqxwW1zHaYSgUqi/dGw06/fOx/seHsniDeRd4/zhEJ7XtabSwPYkgH7/vylmO9yHM8KOWmPTnohuIfM7Yd47bbcBd/j3ppByjwd2Sq5KAb/BeFukIGxy7DgzrAq7vFyr3QKL+GN+zM/sm0KK4/vsCxKER1ta6/ZwUvjTw4yt69+1j9pLC4n2c0T3BS9ROAA3Un3nso6cN6JEFJLZZZGQPQS+DUzu1aN9fvizy5pz17yxUHdBK99NubiSez026g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1v5Ohb-000628-8S; Sun, 05 Oct 2025 09:23:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#79577] [PATCH] monad-repl: Add "build-options" command. 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 13:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 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-To: guix-patches@gnu.org 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 submit@debbugs.gnu.org id=B.175967053622990 (code B ref -1); Sun, 05 Oct 2025 13:23:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Oct 2025 13:22:16 +0000 Received: from localhost ([127.0.0.1]:51725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1v5Ogq-0005yj-5G for submit@debbugs.gnu.org; Sun, 05 Oct 2025 09:22:16 -0400 Received: from lists.gnu.org ([2001:470:142::17]:47370) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1v5Ogn-0005yT-5D for submit@debbugs.gnu.org; Sun, 05 Oct 2025 09:22:13 -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 <~@wolfsden.cz>) id 1v5Ogh-0002zH-QN for guix-patches@gnu.org; Sun, 05 Oct 2025 09:22:07 -0400 Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1v5Ogf-0001Uc-3S for guix-patches@gnu.org; Sun, 05 Oct 2025 09:22:07 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 8733D3263E7; Sun, 5 Oct 2025 13:21:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1759670519; bh=mUz/fLdZeV1NOhe5lAYPjrLzfU3M67R4vSv3vzd0y+o=; h=From:To:Cc:Subject:Date; b=YJVLlbDiioNUV70QQwYdN3gv66lI3P75hGrwp8vem6eTMcRNIk4i02waKTulga0by m4sWBF93HlXPsWsWaCQ40u6+2x0JqfM1aKEoJah4wUoC2ZNdcOft5aNNNAT1S078SM LhmoRLm4oWbKeYuT89LYcnBNc5DLaJk7CsPmNBqVB2gDuieNePckJ4rW8mCY744IUw j48FI7CotupwrQmqZRqxWz3k0wGNH2vx/cBJ2MufSCqljYD/1roigiQwhJtvGtHH4z Jl9fkiJfZhIMmA2j/GthrbWZjMhJhI4jrjvOabEdZGAS1wDluMZ1zJxwyJlw7INl4D Eq1YHAc+DDcqdAhVMIj8vFH3rYxIPhRAkIWIDDQBV+Or1hLVqm4fcjW6VsnHkvkhxL e0qZ1rHgnudXgzFtryy51FglDVsDuXXIsoTO24zuYdACmIMV0JnEwmZdxZ/Aaw4/1e 0LoQnknV9WN4j6f3EUuqyPaRs1ri2UVIEeYY/nUociVu17KQtqVbYQHqPzE8uTPJQ9 qa3BEnD5aSupBD8t9zW5K8KgTY9jTu8IgGG5iJn7RsruEfSfkxHbpOwHXzpj5VRaxV b+THvtG54qu/+kd9Bh7F3TC3A/QrulF6cqf3266HxwN5hDXdnFVi8VOyWckKW1F08B U3mYF4yz3Kksqi289+FPl70o= Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id AC9BC325F5B; Sun, 5 Oct 2025 13:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1759670518; bh=mUz/fLdZeV1NOhe5lAYPjrLzfU3M67R4vSv3vzd0y+o=; h=From:To:Cc:Subject:Date; b=I6jptE/utOgxTfmYjdtYVmZOcSHVtybO1kG5ujxyJ8q1viAQC3a+rG5lMyY6/uy10 e85B2i2dCbN0Rcm66I65U5Xa1ecEcElgAfiSWh48+ILqEjbbjzlesQKshDRPmeFbyP rHjKpf7+xibf51MDhxICTGOiGK8AFDChMRmhzzHYSE69A0LMsb5O1l/FruvhClGtkc fZFtjj0NqkQJBIKQBn2qryEHf/fta6IqWUK9wTlAo6oQg7vUhYy1j1Ud0xaJoj2boK 4h0D+ApSzXgF4h1JpdFgEvwXJJRA4Zhy5micG++MuGpy8YrUb6rHLW9i0epUOwy1EW fuY4KhlLAF6ovhhQYhf3yXr2YCLD3ZOAFCtMsseD46bNmul+6DNVPdMO5W5iA4fbAS MqljrbarJRH9XHEqtXRZjku4Ltt/VuZN2TYf96H4e4XJVi+3AKSC02jryR/cDZ2m3K AdgebAaDUvbIa8PsfhuqZYgGNjw/iLRQaQtnS1mTiu0DqtvULgbr6Yt7ef9zVkhWOK PHmv5bzxdv6+nUJZCt1hzhl6zJ/WgLC8YRkpi0Z4YQRnEJ5bjLj0zIKeBv8MH0tNed atCYbMEvBk+cXlq8IsjuwdG2E8qrHGNRZiFb6lQlLoCpa+GmMTVXyTKNxfg2wGP+31 M9dV+lgUbDJTIQWMYyGz/YSY= From: Tomas Volf <~@wolfsden.cz> Date: Sun, 5 Oct 2025 15:19:43 +0200 Message-ID: <2e0138e328c5ea94cf90b8b7cd63ed8b30252012.1759670383.git.~@wolfsden.cz> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz; helo=wolfsden.cz 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: , 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 | 35 +++++++++++++++++++++++++++-------- 2 files changed, 37 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..60bdd029f5 100644 --- a/guix/monad-repl.scm +++ b/guix/monad-repl.scm @@ -1,3 +1,5 @@ +;;; Copyright (C) 2024 Tomas Volf <~@wolfsden.cz> +;;; SPDX-License-Identifier: AGPL-3.0-only ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014-2016, 2022-2023 Ludovic Courtès ;;; @@ -81,13 +83,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 +137,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 +190,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)