diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 84b40e7b9b..c4dc668b82 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -3882,39 +3882,40 @@ (define-public nerd-dictation
       (license license:gpl2+))))
 
 (define (nerd-dictation-gexp input-name output-name bash nerd-dictation)
-  #~(begin
-      (use-modules (guix build utils))
-      (let* ((exe (string-append %output "/bin/nerd-dictation"))
-             (nerd-dictation-exe
-              #$(file-append nerd-dictation "/bin/nerd-dictation")))
-        (mkdir-p (dirname exe))
-        (call-with-output-file exe
-          (lambda (port)
-            (format port "#!~a
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (use-modules (guix build utils))
+
+        (let* ((exe (string-append #$output "/bin/nerd-dictation"))
+               (nerd-dictation-exe
+                #$(file-append nerd-dictation "/bin/nerd-dictation")))
+          (mkdir-p (dirname exe))
+          (call-with-output-file exe
+            (lambda (port)
+              (format port "#!~a
 if [ \"$1\" = begin ]
   then
     exec ~a $@ --input=~a --simulate-input-tool=~a
   else
     exec ~a $@
 fi"
-                    #$(file-append bash "/bin/bash")
-                    nerd-dictation-exe
-                    #$input-name
-                    #$output-name
-                    nerd-dictation-exe)))
-        (chmod exe #o555))))
+                      #$(file-append bash "/bin/bash")
+                      nerd-dictation-exe
+                      #$input-name
+                      #$output-name
+                      nerd-dictation-exe)))
+          (chmod exe #o555)))))
 
 (define-public nerd-dictation/xdotool
   (package
     (inherit nerd-dictation)
     (name "nerd-dictation-xdotool")
     (build-system trivial-build-system)
-    (arguments (list
-                #:modules '((guix build utils))
-                #:builder
-                (nerd-dictation-gexp "PAREC" "XDOTOOL"
-                                     (this-package-input "bash-minimal")
-                                     (this-package-input "nerd-dictation"))))
+    (arguments
+     (list #:builder
+           (nerd-dictation-gexp "PAREC" "XDOTOOL"
+                                (this-package-input "bash-minimal")
+                                (this-package-input "nerd-dictation"))))
     (inputs (list bash-minimal nerd-dictation))
     (propagated-inputs (list pulseaudio xdotool))))
 
@@ -3922,36 +3923,33 @@ (define-public nerd-dictation/sox-xdotool
   (package
     (inherit nerd-dictation/xdotool)
     (name "nerd-dictation-sox-xdotool")
-    (arguments (list
-                #:modules '((guix build utils))
-                #:builder
-                (nerd-dictation-gexp "SOX" "XDOTOOL"
-                                     (this-package-input "bash-minimal")
-                                     (this-package-input "nerd-dictation"))))
+    (arguments
+     (list #:builder
+           (nerd-dictation-gexp "SOX" "XDOTOOL"
+                                (this-package-input "bash-minimal")
+                                (this-package-input "nerd-dictation"))))
     (propagated-inputs (list sox xdotool))))
 
 (define-public nerd-dictation/sox-ydotool
   (package
     (inherit nerd-dictation/xdotool)
     (name "nerd-dictation-sox-ydotool")
-    (arguments (list
-                #:modules '((guix build utils))
-                #:builder
-                (nerd-dictation-gexp "SOX" "YDOTOOL"
-                                     (this-package-input "bash-minimal")
-                                     (this-package-input "nerd-dictation"))))
+    (arguments
+     (list #:builder
+           (nerd-dictation-gexp "SOX" "YDOTOOL"
+                                (this-package-input "bash-minimal")
+                                (this-package-input "nerd-dictation"))))
     (propagated-inputs (list sox ydotool))))
 
 (define-public nerd-dictation/sox-wtype
   (package
     (inherit nerd-dictation/xdotool)
     (name "nerd-dictation-sox-wtype")
-    (arguments (list
-                #:modules '((guix build utils))
-                #:builder
-                (nerd-dictation-gexp "SOX" "WTYPE"
-                                     (this-package-input "bash-minimal")
-                                     (this-package-input "nerd-dictation"))))
+    (arguments
+     (list #:builder
+           (nerd-dictation-gexp "SOX" "WTYPE"
+                                (this-package-input "bash-minimal")
+                                (this-package-input "nerd-dictation"))))
     (propagated-inputs (list sox wtype))))
 
 (define-public python-brian2
