diff mbox series

[bug#58140,v4,2/2] gnu: Add nerd-dictation/wayland.

Message ID 20220929090203.6672-2-ngraves@ngraves.fr
State Accepted
Headers show
Series None | expand

Commit Message

Nicolas Graves Sept. 29, 2022, 9:02 a.m. UTC
* gnu/packages/machine-learning.scm (nerd-dictation/wayland): New variable.
---
 gnu/packages/machine-learning.scm | 35 +++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

Comments

Ludovic Courtès Oct. 17, 2022, 8:46 a.m. UTC | #1
Hi Nicolas,

I applied the whole series, thank you!

  d5b54e0137 gnu: Add nerd-dictation/wayland.
  eecb288ca2 gnu: Add nerd-dictation.
  a3e20f35f5 gnu: Add python-vosk.
  fadfeeede5 gnu: Add vosk-api.
  0c7a2639bb gnu: Add kaldi-for-vosk.
  9ca6416a19 gnu: Add openfst-for-vosk.

Ludo’.
diff mbox series

Patch

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index f2c9b8dace..c0d6ccfd19 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))
 
@@ -3636,3 +3638,36 @@  (define-public 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 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
+if [ \"$1\" = begin ]
+  then
+    exec ~a $@ --input=SOX --simulate-input-tool=YDOTOOL
+  else
+    exec ~a $@
+fi"
+                        bash-exe
+                        original-exe
+                        original-exe)))
+            (chmod exe #o555)))))))