GNU bug report logs - #80034
[PATCH] monad-repl: Add "build-mode" command.

Previous Next

Package: guix-patches;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Fri, 19 Dec 2025 11:39:01 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 80034 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix <at> cbaines.net, gabriel <at> erlikon.ch, ludo <at> gnu.org, maxim <at> guixotic.coop, morgan.arnold <at> proton.me, ngraves <at> ngraves.fr, rutherther <at> ditigal.xyz, zimon.toutoune <at> gmail.com, guix-patches <at> gnu.org:
bug#80034; Package guix-patches. (Fri, 19 Dec 2025 11:39:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to guix <at> cbaines.net, gabriel <at> erlikon.ch, ludo <at> gnu.org, maxim <at> guixotic.coop, morgan.arnold <at> proton.me, ngraves <at> ngraves.fr, rutherther <at> ditigal.xyz, zimon.toutoune <at> gmail.com, guix-patches <at> gnu.org. (Fri, 19 Dec 2025 11:39:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: guix-patches <at> gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH] monad-repl: Add "build-mode" command.
Date: Fri, 19 Dec 2025 12:37:19 +0100
I expect this will not be used often, but it is sometimes useful to play with
the build of a package without modifying the definition (so usually the build
does nothing, hence 'check to the rescue).

* guix/monad-repl.scm (%build-mode): New variable.
(evaluate/print-with-store): Use it.
(build-mode): New meta command to set it.
* doc/guix.texi (Using Guix Interactively): Document it.
---
 doc/guix.texi       |  6 ++++++
 guix/monad-repl.scm | 19 ++++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index a2e2a8e5dfd..80479ff52e2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -13270,6 +13270,12 @@ Using Guix Interactively
 to @code{--no-grafts} argument to @code{guix build}.
 @end deffn
 
+@deffn {REPL command} build-mode @var{mode}
+Set build mode to use for the build.  Valid options are @code{'normal},
+@code{'check} and @code{'repair}.  Last two correspond to the
+@code{--check} and @code{--repair} arguments to @code{guix build}.
+@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 dcb00988fe8..abb5371e725 100644
--- a/guix/monad-repl.scm
+++ b/guix/monad-repl.scm
@@ -86,6 +86,10 @@ (define %build-options
   ;; Additional build options.
   '())
 
+(define %build-mode
+  ;; Current build mode.
+  (build-mode normal))
+
 (define* (evaluate/print-with-store mvalue #:key build?)
   "Run monadic value MVALUE in the store monad and print its value."
   (with-store store
@@ -102,7 +106,7 @@ (define* (evaluate/print-with-store mvalue #:key build?)
                            (mlet %store-monad ((obj mvalue))
                              (if (derivation? obj)
                                  (mbegin %store-monad
-                                   (built-derivations (list obj))
+                                   (built-derivations (list obj) %build-mode)
                                    (return
                                     (match (derivation->output-paths obj)
                                       (((_ . files) ...) files))))
@@ -154,6 +158,19 @@ (define-meta-command ((graft? guix) repl (graft?))
 Set whether grafts should be performed."
   (%graft? (repl-eval repl graft?)))
 
+(define-meta-command ((build-mode guix) repl (mode))
+  "build-mode MODE
+Set build mode to MODE.
+
+Valid values: 'normal, 'check, 'repair."
+  (set! %build-mode (match (repl-eval repl mode)
+                      ('normal (build-mode normal))
+                      ('check  (build-mode check))
+                      ('repair (build-mode repair))
+                      (_
+                       (format #t ";; ERROR: Invalid mode.~%")
+                       %build-mode))))
+
 (define-meta-command ((enter-store-monad guix) repl)
   "enter-store-monad
 Enter a REPL for values in the store monad."
-- 
2.52.0





This bug report was last modified today.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.