diff mbox series

[bug#58140,6/6,v2] gnu: Add python-nerd-dictation/wayland.

Message ID 87bkqzfaqt.fsf@ngraves.fr
State Accepted
Headers show
Series [bug#58140,v4,1/2] gnu: Add nerd-dictation. | expand

Commit Message

Nicolas Graves Sept. 28, 2022, 9:30 p.m. UTC
* gnu/packages/machine-learning.scm (python-nerd-dictation/wayland): New variable.
---
 gnu/packages/machine-learning.scm | 34 +++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

--
2.37.3


<#secure method=pgpmime mode=sign>

--
Best regards,
Nicolas Graves

Comments

M Sept. 28, 2022, 9:39 p.m. UTC | #1
On 28-09-2022 23:30, Nicolas Graves via Guix-patches via wrote:
> +    (inputs (list bash-minimal python-nerd-dictation sox ydotool))
> +    (build-system trivial-build-system)
> +    (arguments
> +     (list
> +      #:modules '((guix build utils))
> +      #:builder
> +      #~(begin
> +          (use-modules (guix build utils))
> +          (let* ((out (assoc-ref %outputs "out"))
> +                 (exe (string-append out "/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
> +  else
> +    exec ~a $@
> +fi"
> +                        #$(file-append bash-minimal "/bin/bash")
> +                        #$(file-append python-nerd-dictation
> +                                       "/bin/nerd-dictation")
> +                        #$(file-append python-nerd-dictation
> +                                       "/bin/nerd-dictation"))))
> +            (chmod exe #o555)))))))

The input 'ydotool' seems to be unused here, you might need to patch it 
in, or failing that, propagate it.

(Also see previous reply, I think I replied to the v1 instead of the v2 
previously?)

Greetings,
Maxime.
diff mbox series

Patch

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 3fec07e6a1..4846a9103e 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -45,6 +45,7 @@  (define-module (gnu packages machine-learning)
   #:use-module (guix build-system ocaml)
   #:use-module (guix build-system python)
   #:use-module (guix build-system r)
+  #:use-module (guix build-system trivial)
   #:use-module (guix git-download)
   #:use-module (gnu packages)
   #:use-module (gnu packages adns)
@@ -103,6 +104,7 @@  (define-module (gnu packages machine-learning)
   #:use-module (gnu packages video)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xml)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
   #:use-module (ice-9 match))

@@ -3633,3 +3635,35 @@  (define-public python-nerd-dictation
 there are no background processes.  Dictation is accessed manually with
 @code{nerd-dictation begin} and @code{nerd-dictation end} commands.")
       (license license:gpl3+))))
+
+(define-public python-nerd-dictation/wayland
+  (package
+    (inherit python-nerd-dictation)
+    (name "python-nerd-dictation-wayland")
+    (inputs (list bash-minimal python-nerd-dictation sox ydotool))
+    (build-system trivial-build-system)
+    (arguments
+     (list
+      #:modules '((guix build utils))
+      #:builder
+      #~(begin
+          (use-modules (guix build utils))
+          (let* ((out (assoc-ref %outputs "out"))
+                 (exe (string-append out "/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
+  else
+    exec ~a $@
+fi"
+                        #$(file-append bash-minimal "/bin/bash")
+                        #$(file-append python-nerd-dictation
+                                       "/bin/nerd-dictation")
+                        #$(file-append python-nerd-dictation
+                                       "/bin/nerd-dictation"))))
+            (chmod exe #o555)))))))