GNU bug report logs - #62589
Help with patch with delayed evaluation

Previous Next

Package: guix;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Sat, 1 Apr 2023 10:00:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62589 in the body.
You can then email your comments to 62589 AT debbugs.gnu.org in the normal way.

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

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


Report forwarded to bug-guix <at> gnu.org:
bug#62589; Package guix. (Sat, 01 Apr 2023 10:00:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Graves <ngraves <at> ngraves.fr>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sat, 01 Apr 2023 10:00:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: bug-guix <at> gnu.org
Subject: Help with patch with delayed evaluation
Date: Sat, 01 Apr 2023 11:58:49 +0200
Hi Guix!

I'm struggling with the definition of the variants of the nerd-dictation
package. I'm sending a commit here.

I get the following error messages:
sox/wtype: unbound variable
while (gnu packages audio) and (gnu packages freedesktop) are indeed
imported.

Originally, I wasn't using delayed evaluation, but I thought it might
help, but it doesn't.  I've tried to rebuild my local installation
totally (make clean-go, make clean, then bootstrap from there), but it
doesn't work better.

Thanks if you can help! 

-- 
Best regards,
Nicolas Graves




Information forwarded to bug-guix <at> gnu.org:
bug#62589; Package guix. (Sat, 01 Apr 2023 10:06:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 62589 <at> debbugs.gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants.
Date: Sat,  1 Apr 2023 12:05:09 +0200
* gnu/packages/machine-learning.scm (nerd-dictation):
Avoid inputs pulseaudio and ydotool when not necessary.
Factor out wrapper make-nerd-dictation-package.
Add package variants :
- nerd-dictation/xdotool
- nerd-dictation/sox-xdotool
- nerd-dictation/sox-ydotool
- nerd-dictation/sox-wtype
---
 gnu/packages/machine-learning.scm | 88 +++++++++++++++++++++----------
 1 file changed, 60 insertions(+), 28 deletions(-)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 6c78b14fc6..16a5c1a7c4 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2020 Edouard Klein <edk <at> beaver-labs.com>
 ;;; Copyright © 2020, 2021, 2022, 2023 Vinicius Monego <monego <at> posteo.net>
 ;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2022, 2023 Nicolas Graves <ngraves <at> ngraves.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -63,6 +64,7 @@ (define-module (gnu packages machine-learning)
   #:use-module (gnu packages cran)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages dejagnu)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gl)
@@ -106,6 +108,7 @@ (define-module (gnu packages machine-learning)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
+  #:use-module (srfi srfi-45)
   #:use-module (ice-9 match))
 
 (define-public fann
@@ -3864,7 +3867,6 @@ (define-public nerd-dictation
            (add-after 'unpack 'chdir
              (lambda _ (chdir "package/python"))))))
       (propagated-inputs (list python-vosk))
-      (inputs (list pulseaudio xdotool))
       (home-page "https://github.com/ideasman42/nerd-dictation")
       (synopsis "Offline speech-to-text for desktop Linux")
       (description "\
@@ -3876,38 +3878,68 @@ (define-public nerd-dictation
 @code{nerd-dictation begin} and @code{nerd-dictation end} commands.")
       (license license:gpl3+))))
 
-(define-public nerd-dictation/wayland
-  (package
-    (inherit nerd-dictation)
-    (name "nerd-dictation-wayland")
-    (inputs (list bash-minimal nerd-dictation))
-    (propagated-inputs (list ydotool sox))
-    (build-system trivial-build-system)
-    (arguments
-     (list
-      #:modules '((guix build utils))
-      #:builder
-      #~(begin
-          (use-modules (guix build utils))
-          (let* ((exe (string-append #$output "/bin/nerd-dictation"))
-                 (original-exe #$(file-append nerd-dictation
-                                              "/bin/nerd-dictation"))
-                 (bash #$(this-package-input "bash-minimal"))
-                 (bash-exe (string-append bash "/bin/bash")))
-            (mkdir-p (dirname exe))
-            (call-with-output-file exe
-              (lambda (port)
-                (format port "#!~a
+(define* (make-nerd-dictation-package
+          input-tool output-tool
+          #:key (nerd-dictation-package nerd-dictation))
+  "Construct a nerd-dictation package for OUTPUT-TOOL."
+  (match-let* (((input-name output-name)
+                (map (lambda (tool)
+                       (lazy
+                        (delay (package-name (force tool)))))
+                     (list input-tool output-tool))))
+    (package
+      (inherit nerd-dictation-package)
+      (name (string-append "nerd-dictation-"
+                           (if (equal? (force input-name) "sox")
+                               "sox-"
+                              "")
+                           (force output-name)))
+      (build-system trivial-build-system)
+      (arguments
+       (list
+        #:modules '((guix build utils))
+        #:builder
+        #~(begin
+            (use-modules (guix build utils))
+            (let* ((exe (string-append #$output "/bin/nerd-dictation"))
+                   (original-exe #$(file-append
+                                    (this-package-input "nerd-dictation")
+                                    "/bin/nerd-dictation"))
+                   (bash #$(this-package-input "bash-minimal"))
+                   (bash-exe (string-append bash "/bin/bash")))
+              (mkdir-p (dirname exe))
+              (call-with-output-file exe
+                (lambda (port)
+                  (format port "#!~a
 if [ \"$1\" = begin ]
   then
-    exec ~a $@ --input=SOX --simulate-input-tool=YDOTOOL
+    exec ~a $@ --input=~a --simulate-input-tool=~a
   else
     exec ~a $@
 fi"
-                        bash-exe
-                        original-exe
-                        original-exe)))
-            (chmod exe #o555)))))))
+                          bash-exe
+                          original-exe
+                          (if (equal? #$(force input-name) "pulseaudio")
+                              "parec"
+                              (string-upcase #$(force input-name)))
+                          (string-upcase #$(force output-name))
+                          original-exe)))
+              (chmod exe #o555)))))
+      (inputs (list bash-minimal nerd-dictation-package))
+      (propagated-inputs (list (force input-tool) (force output-tool))))))
+
+;; More variants are possible, but wayland without pipewire seems unlikely.
+(define-public nerd-dictation/xdotool
+  (make-nerd-dictation-package (delay pulseaudio) (delay xdotool)))
+
+(define-public nerd-dictation/sox-xdotool
+  (make-nerd-dictation-package (delay sox) (delay xdotool)))
+
+(define-public nerd-dictation/sox-ydotool
+  (make-nerd-dictation-package (delay sox) (delay ydotool)))
+
+(define-public nerd-dictation/sox-wtype
+  (make-nerd-dictation-package (delay sox) (delay wtype)))
 
 (define-public python-brian2
   (package
-- 
2.39.2





Information forwarded to bug-guix <at> gnu.org:
bug#62589; Package guix. (Sat, 01 Apr 2023 10:29:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Nicolas Graves <ngraves <at> ngraves.fr>
Cc: 62589 <at> debbugs.gnu.org
Subject: Re: bug#62589: Help with patch with delayed evaluation
Date: Sat, 01 Apr 2023 12:28:36 +0200
Hi,

Nicolas Graves <ngraves <at> ngraves.fr> skribis:

> +(define* (make-nerd-dictation-package
> +          input-tool output-tool
> +          #:key (nerd-dictation-package nerd-dictation))
> +  "Construct a nerd-dictation package for OUTPUT-TOOL."
> +  (match-let* (((input-name output-name)
> +                (map (lambda (tool)
> +                       (lazy
> +                        (delay (package-name (force tool)))))
> +                     (list input-tool output-tool))))
> +    (package
> +      (inherit nerd-dictation-package)
> +      (name (string-append "nerd-dictation-"
> +                           (if (equal? (force input-name) "sox")
> +                               "sox-"
> +                              "")
> +                           (force output-name)))

I don’t understand the details of what the patch does, but as a rule of
thumb, make sure you only ever inherit from packages defined in the same
module.

Perhaps that’s what was going wrong?

HTH,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#62589; Package guix. (Sat, 01 Apr 2023 10:59:02 GMT) Full text and rfc822 format available.

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

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, 62589 <at> debbugs.gnu.org
Subject: Re: bug#62589: Help with patch with delayed evaluation
Date: Sat, 01 Apr 2023 12:58:55 +0200
On 2023-04-01 12:28, Ludovic Courtès wrote:

> Hi,
>
> Nicolas Graves <ngraves <at> ngraves.fr> skribis:
>
>> +(define* (make-nerd-dictation-package
>> +          input-tool output-tool
>> +          #:key (nerd-dictation-package nerd-dictation))
>> +  "Construct a nerd-dictation package for OUTPUT-TOOL."
>> +  (match-let* (((input-name output-name)
>> +                (map (lambda (tool)
>> +                       (lazy
>> +                        (delay (package-name (force tool)))))
>> +                     (list input-tool output-tool))))
>> +    (package
>> +      (inherit nerd-dictation-package)
>> +      (name (string-append "nerd-dictation-"
>> +                           (if (equal? (force input-name) "sox")
>> +                               "sox-"
>> +                              "")
>> +                           (force output-name)))
>
> I don’t understand the details of what the patch does, but as a rule of
> thumb, make sure you only ever inherit from packages defined in the same
> module.

The patch defines a helper for defining variants of nerd-dictation. It
now supports wtype and I wasn't totally satisfied by international
support for ydotool, so I wanted to switch, but copying it make a lot of
repeated code.

I already defined such a helper with Liliana Marie Prinkler with
make-emacs-eval-in-repl, but this time I don't understand this error.

Josselin was suggesting a module import cycle, (gnu packages
machine-learning) is imported in (gnu packages audio), the error might
come from there. 

>
> Perhaps that’s what was going wrong?

I've tried inheriting from the above package direclty, doesn't seem to
be that.

>
> HTH,
> Ludo’.

-- 
Best regards,
Nicolas Graves




Information forwarded to bug-guix <at> gnu.org:
bug#62589; Package guix. (Sat, 01 Apr 2023 15:28:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>, 62589 <at> debbugs.gnu.org
Subject: Re: bug#62589: Help with patch with delayed evaluation
Date: Sat, 01 Apr 2023 17:27:38 +0200
On 2023-04-01 12:58, Nicolas Graves wrote:

> On 2023-04-01 12:28, Ludovic Courtès wrote:
>
>> Hi,
>>
>> Nicolas Graves <ngraves <at> ngraves.fr> skribis:
>>
>>> +(define* (make-nerd-dictation-package
>>> +          input-tool output-tool
>>> +          #:key (nerd-dictation-package nerd-dictation))
>>> +  "Construct a nerd-dictation package for OUTPUT-TOOL."
>>> +  (match-let* (((input-name output-name)
>>> +                (map (lambda (tool)
>>> +                       (lazy
>>> +                        (delay (package-name (force tool)))))
>>> +                     (list input-tool output-tool))))
>>> +    (package
>>> +      (inherit nerd-dictation-package)
>>> +      (name (string-append "nerd-dictation-"
>>> +                           (if (equal? (force input-name) "sox")
>>> +                               "sox-"
>>> +                              "")
>>> +                           (force output-name)))
>>
>> I don’t understand the details of what the patch does, but as a rule of
>> thumb, make sure you only ever inherit from packages defined in the same
>> module.
>
> The patch defines a helper for defining variants of nerd-dictation. It
> now supports wtype and I wasn't totally satisfied by international
> support for ydotool, so I wanted to switch, but copying it make a lot of
> repeated code.
>
> I already defined such a helper with Liliana Marie Prinkler with
> make-emacs-eval-in-repl, but this time I don't understand this error.
>
> Josselin was suggesting a module import cycle, (gnu packages
> machine-learning) is imported in (gnu packages audio), the error might
> come from there. 
>
>>
>> Perhaps that’s what was going wrong?
>
> I've tried inheriting from the above package direclty, doesn't seem to
> be that.
>
>>
>> HTH,
>> Ludo’.

After thinking and experimenting, I think what I'm trying to do is not
possible in this file. This is for a record if someone has the same kind
of issue in the future. 

When I include sox or wtype as a regular input, it works fine. But it
doesn't work when called from another function, I think the issue is
indeed the same as when inheriting from a package.

Now, there is the counterexample of the make-emacs-eval-in-repl
function. IIUC, this example works with delayed evaluation because all
the packages it calls are defined *in the same file*. To test this, on
way could be to test inheritance on a package defined in the same file
but after the inheriting package definition. IIRC, it doesn't work, but
might when using delayed evaluation.

This aside, the packages I'm trying to load are outside the file, and
this is probably the reason why it works for make-emacs-eval-in-repl and
not this function.

I will try to circumvent the issue by factorising less, maybe just the
gexp, but not propagated-inputs. 

-- 
Best regards,
Nicolas Graves




Information forwarded to bug-guix <at> gnu.org:
bug#62589; Package guix. (Sat, 01 Apr 2023 17:33:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 62589 <at> debbugs.gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants.
Date: Sat,  1 Apr 2023 19:32:39 +0200
* gnu/packages/machine-learning.scm (nerd-dictation):
Avoid inputs pulseaudio and ydotool when not necessary.
Factor out wrapper make-nerd-dictation-package.
Add package variants :
- nerd-dictation/xdotool
- nerd-dictation/sox-xdotool
- nerd-dictation/sox-ydotool
- nerd-dictation/sox-wtype
---
 gnu/packages/machine-learning.scm | 97 ++++++++++++++++++++++---------
 1 file changed, 69 insertions(+), 28 deletions(-)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 6c78b14fc6..4383f3fef3 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2020 Edouard Klein <edk <at> beaver-labs.com>
 ;;; Copyright © 2020, 2021, 2022, 2023 Vinicius Monego <monego <at> posteo.net>
 ;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2022, 2023 Nicolas Graves <ngraves <at> ngraves.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -63,6 +64,7 @@ (define-module (gnu packages machine-learning)
   #:use-module (gnu packages cran)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages dejagnu)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages gl)
@@ -3864,7 +3866,6 @@ (define-public nerd-dictation
            (add-after 'unpack 'chdir
              (lambda _ (chdir "package/python"))))))
       (propagated-inputs (list python-vosk))
-      (inputs (list pulseaudio xdotool))
       (home-page "https://github.com/ideasman42/nerd-dictation")
       (synopsis "Offline speech-to-text for desktop Linux")
       (description "\
@@ -3876,38 +3877,78 @@ (define-public nerd-dictation
 @code{nerd-dictation begin} and @code{nerd-dictation end} commands.")
       (license license:gpl3+))))
 
-(define-public nerd-dictation/wayland
-  (package
-    (inherit nerd-dictation)
-    (name "nerd-dictation-wayland")
-    (inputs (list bash-minimal nerd-dictation))
-    (propagated-inputs (list ydotool sox))
-    (build-system trivial-build-system)
-    (arguments
-     (list
-      #:modules '((guix build utils))
-      #:builder
-      #~(begin
-          (use-modules (guix build utils))
-          (let* ((exe (string-append #$output "/bin/nerd-dictation"))
-                 (original-exe #$(file-append nerd-dictation
-                                              "/bin/nerd-dictation"))
-                 (bash #$(this-package-input "bash-minimal"))
-                 (bash-exe (string-append bash "/bin/bash")))
-            (mkdir-p (dirname exe))
-            (call-with-output-file exe
-              (lambda (port)
-                (format port "#!~a
+(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
 if [ \"$1\" = begin ]
   then
-    exec ~a $@ --input=SOX --simulate-input-tool=YDOTOOL
+    exec ~a $@ --input=~a --simulate-input-tool=~a
   else
     exec ~a $@
 fi"
-                        bash-exe
-                        original-exe
-                        original-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"))))
+    (inputs (list bash-minimal nerd-dictation))
+    (propagated-inputs (list pulseaudio xdotool))))
+
+(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"))))
+    (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"))))
+    (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"))))
+    (propagated-inputs (list sox wtype))))
 
 (define-public python-brian2
   (package
-- 
2.39.2





Information forwarded to bug-guix <at> gnu.org:
bug#62589; Package guix. (Mon, 17 Apr 2023 15:42:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 62589 <at> debbugs.gnu.org
Subject: Re: bug#62589: Help with patch with delayed evaluation
Date: Mon, 17 Apr 2023 17:41:24 +0200
Hey Ludo,

I've managed to do what I wanted here, just a little reminder if you can
review this ;) 

-- 
Best regards,
Nicolas Graves




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 24 Apr 2023 20:54:01 GMT) Full text and rfc822 format available.

Notification sent to Nicolas Graves <ngraves <at> ngraves.fr>:
bug acknowledged by developer. (Mon, 24 Apr 2023 20:54:02 GMT) Full text and rfc822 format available.

Message #28 received at 62589-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Nicolas Graves <ngraves <at> ngraves.fr>
Cc: 62589-done <at> debbugs.gnu.org
Subject: Re: bug#62589: Help with patch with delayed evaluation
Date: Mon, 24 Apr 2023 22:53:07 +0200
[Message part 1 (text/plain, inline)]
Hi Nicolas,

Nicolas Graves <ngraves <at> ngraves.fr> skribis:

> * gnu/packages/machine-learning.scm (nerd-dictation):
> Avoid inputs pulseaudio and ydotool when not necessary.
> Factor out wrapper make-nerd-dictation-package.
> Add package variants :
> - nerd-dictation/xdotool
> - nerd-dictation/sox-xdotool
> - nerd-dictation/sox-ydotool
> - nerd-dictation/sox-wtype
> ---
>  gnu/packages/machine-learning.scm | 97 ++++++++++++++++++++++---------
>  1 file changed, 69 insertions(+), 28 deletions(-)

Applied with the changes below (using ‘with-imported-modules’ instead of
passing #:modules, and #$output instead of the now-deprecated
‘%output’).

I also tweaked the commit log according to our conventions.

Thank you,
Ludo’.

[Message part 2 (text/x-patch, inline)]
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

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 23 May 2023 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 23 days ago.

Previous Next


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