all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#62589: Help with patch with delayed evaluation
@ 2023-04-01  9:58 Nicolas Graves via Bug reports for GNU Guix
  2023-04-01 10:05 ` bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants Nicolas Graves via Bug reports for GNU Guix
  2023-04-01 17:32 ` bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants Nicolas Graves via Bug reports for GNU Guix
  0 siblings, 2 replies; 8+ messages in thread
From: Nicolas Graves via Bug reports for GNU Guix @ 2023-04-01  9:58 UTC (permalink / raw)
  To: 62589


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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants.
  2023-04-01  9:58 bug#62589: Help with patch with delayed evaluation Nicolas Graves via Bug reports for GNU Guix
@ 2023-04-01 10:05 ` Nicolas Graves via Bug reports for GNU Guix
  2023-04-01 10:28   ` bug#62589: Help with patch with delayed evaluation Ludovic Courtès
  2023-04-01 17:32 ` bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants Nicolas Graves via Bug reports for GNU Guix
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Graves via Bug reports for GNU Guix @ 2023-04-01 10:05 UTC (permalink / raw)
  To: 62589; +Cc: ngraves

* 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@beaver-labs.com>
 ;;; Copyright © 2020, 2021, 2022, 2023 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022, 2023 Nicolas Graves <ngraves@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





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#62589: Help with patch with delayed evaluation
  2023-04-01 10:05 ` bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants Nicolas Graves via Bug reports for GNU Guix
@ 2023-04-01 10:28   ` Ludovic Courtès
  2023-04-01 10:58     ` Nicolas Graves via Bug reports for GNU Guix
  2023-04-17 15:41     ` Nicolas Graves via Bug reports for GNU Guix
  0 siblings, 2 replies; 8+ messages in thread
From: Ludovic Courtès @ 2023-04-01 10:28 UTC (permalink / raw)
  To: Nicolas Graves; +Cc: 62589

Hi,

Nicolas Graves <ngraves@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’.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#62589: Help with patch with delayed evaluation
  2023-04-01 10:28   ` bug#62589: Help with patch with delayed evaluation Ludovic Courtès
@ 2023-04-01 10:58     ` Nicolas Graves via Bug reports for GNU Guix
  2023-04-01 15:27       ` Nicolas Graves via Bug reports for GNU Guix
  2023-04-17 15:41     ` Nicolas Graves via Bug reports for GNU Guix
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Graves via Bug reports for GNU Guix @ 2023-04-01 10:58 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Josselin Poiret, 62589

On 2023-04-01 12:28, Ludovic Courtès wrote:

> Hi,
>
> Nicolas Graves <ngraves@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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#62589: Help with patch with delayed evaluation
  2023-04-01 10:58     ` Nicolas Graves via Bug reports for GNU Guix
@ 2023-04-01 15:27       ` Nicolas Graves via Bug reports for GNU Guix
  0 siblings, 0 replies; 8+ messages in thread
From: Nicolas Graves via Bug reports for GNU Guix @ 2023-04-01 15:27 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Josselin Poiret, 62589

On 2023-04-01 12:58, Nicolas Graves wrote:

> On 2023-04-01 12:28, Ludovic Courtès wrote:
>
>> Hi,
>>
>> Nicolas Graves <ngraves@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




^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants.
  2023-04-01  9:58 bug#62589: Help with patch with delayed evaluation Nicolas Graves via Bug reports for GNU Guix
  2023-04-01 10:05 ` bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants Nicolas Graves via Bug reports for GNU Guix
@ 2023-04-01 17:32 ` Nicolas Graves via Bug reports for GNU Guix
  2023-04-24 20:53   ` bug#62589: Help with patch with delayed evaluation Ludovic Courtès
  1 sibling, 1 reply; 8+ messages in thread
From: Nicolas Graves via Bug reports for GNU Guix @ 2023-04-01 17:32 UTC (permalink / raw)
  To: 62589; +Cc: ngraves

* 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@beaver-labs.com>
 ;;; Copyright © 2020, 2021, 2022, 2023 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2020, 2021, 2022, 2023 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022, 2023 Nicolas Graves <ngraves@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





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#62589: Help with patch with delayed evaluation
  2023-04-01 10:28   ` bug#62589: Help with patch with delayed evaluation Ludovic Courtès
  2023-04-01 10:58     ` Nicolas Graves via Bug reports for GNU Guix
@ 2023-04-17 15:41     ` Nicolas Graves via Bug reports for GNU Guix
  1 sibling, 0 replies; 8+ messages in thread
From: Nicolas Graves via Bug reports for GNU Guix @ 2023-04-17 15:41 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 62589


Hey Ludo,

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

-- 
Best regards,
Nicolas Graves




^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#62589: Help with patch with delayed evaluation
  2023-04-01 17:32 ` bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants Nicolas Graves via Bug reports for GNU Guix
@ 2023-04-24 20:53   ` Ludovic Courtès
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2023-04-24 20:53 UTC (permalink / raw)
  To: Nicolas Graves; +Cc: 62589-done

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

Hi Nicolas,

Nicolas Graves <ngraves@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’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 4725 bytes --]

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-04-24 20:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-01  9:58 bug#62589: Help with patch with delayed evaluation Nicolas Graves via Bug reports for GNU Guix
2023-04-01 10:05 ` bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants Nicolas Graves via Bug reports for GNU Guix
2023-04-01 10:28   ` bug#62589: Help with patch with delayed evaluation Ludovic Courtès
2023-04-01 10:58     ` Nicolas Graves via Bug reports for GNU Guix
2023-04-01 15:27       ` Nicolas Graves via Bug reports for GNU Guix
2023-04-17 15:41     ` Nicolas Graves via Bug reports for GNU Guix
2023-04-01 17:32 ` bug#62589: [PATCH] gnu: nerd-dictation: Factor out wrapper. Add package variants Nicolas Graves via Bug reports for GNU Guix
2023-04-24 20:53   ` bug#62589: Help with patch with delayed evaluation Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.