diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 644993101e253eff8d962ed05cec118122660574..bd97d56dcecac22408e17675fbdff3a10804a85b 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -219,16 +219,15 @@ (define %transformations
 
 (define %transformation-options
   ;; The command-line interface to the above transformations.
-  (list (option '("with-source") #t #f
-                (lambda (opt name arg result . rest)
-                  (apply values
-                         (cons (alist-cons 'with-source arg result)
-                               rest))))
-        (option '("with-input") #t #f
-                (lambda (opt name arg result . rest)
-                  (apply values
-                         (cons (alist-cons 'with-input arg result)
-                               rest))))))
+  (let ((parser (lambda (symbol)
+                  (lambda (opt name arg result . rest)
+                    (apply values
+                           (alist-cons symbol arg result)
+                           rest)))))
+    (list (option '("with-source") #t #f
+                  (parser 'with-source))
+          (option '("with-input") #t #f
+                  (parser 'with-input)))))
 
 (define (show-transformation-options-help)
   (display (_ "