From 6e9a454aa4f69c19c2e0bb4b109b4e86bb627a60 Mon Sep 17 00:00:00 2001
Message-Id: <6e9a454aa4f69c19c2e0bb4b109b4e86bb627a60.1665846418.git.hunter.t.joz@gmail.com>
From: Hunter Jozwiak <hunter.t.joz@gmail.com>
Date: Fri, 14 Oct 2022 15:45:21 -0400
Subject: [PATCH] gnu: Services: Add espeakup service.
* gnu/services/accessibility.scm: add espeakup-configuration,
espeakup-shepherd-service, and espeakup-service-type.
* gnu/local.mk: wire it in.
* doc/guix.texi (Accessibility Services): Document the espeakup configuration.
---
doc/guix.texi | 23 ++++++++++++
gnu/local.mk | 2 ++
gnu/services/accessibility.scm | 66 ++++++++++++++++++++++++++++++++++
3 files changed, 91 insertions(+)
create mode 100644 gnu/services/accessibility.scm
@@ -109,6 +109,7 @@
Copyright @copyright{} 2022 Simon Streit@*
Copyright @copyright{} 2022 (@*
Copyright @copyright{} 2022 John Kehayias@*
+Copyright @copyright{} 2022 Hunter Jozwiak@*
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -17585,6 +17586,7 @@ Services
@menu
* Base Services:: Essential system services.
+* Accessibility Services:: For those with various impairments.
* Scheduled Job Execution:: The mcron service.
* Log Rotation:: The rottlog service.
* Networking Setup:: Setting up network interfaces.
@@ -18806,6 +18808,27 @@ Base Services
(local-file "sway-greetd.conf"))))))))
@end lisp
@end deftp
+@node Accessibility Services
+@subsection Accessibility Services
+%espeakup-configuration
+@c %start of fragment
+
+@deftp {Data Type} espeakup-configuration
+Available @code{espeakup-configuration} fields are:
+
+@table @asis
+@item @code{espeakup} (default: @code{espeakup}) (type: file-like)
+Set the package providing the @code{/bin/espeakup} command.
+
+@item @code{default-voice} (default: @code{"en-US"}) (type: string)
+Set the voice that espeak-ng should use by default.
+
+@end table
+
+@end deftp
+
+
+@c %end of fragment
@node Scheduled Job Execution
@subsection Scheduled Job Execution
@@ -55,6 +55,7 @@
# Copyright © 2022 Hilton Chain <hako@ultrarare.space>
# Copyright © 2022 Alex Griffin <a@ajgrf.com>
# Copyright © 2022 ( <paren@disroot.org>
+# Copyright © 2022 Hunter Jozwiak <hunter.t.joz@gmail.com>
#
# This file is part of GNU Guix.
#
@@ -643,6 +644,7 @@ GNU_SYSTEM_MODULES = \
%D%/packages/zwave.scm \
\
%D%/services.scm \
+ %D%/services/accessibility.scm \
%D%/services/admin.scm \
%D%/services/audio.scm \
%D%/services/auditd.scm \
new file mode 100644
@@ -0,0 +1,66 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Hunter Jozwiak <hunter.t.joz@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services accessibility)
+ #:use-module (gnu packages accessibility)
+ #:use-module (gnu services)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu services linux)
+ #:use-module (gnu services shepherd)
+ #:use-module (guix gexp)
+ #:use-module (guix records)
+ #:export (espeakup-configuration
+ espeakup-service-type))
+
+
+;;;
+;;; Espeakup
+
+(define-configuration/no-serialization espeakup-configuration
+ (espeakup
+ (file-like espeakup)
+ "Set the package providing the @code{/bin/espeakup} command.")
+ (default-voice
+ (string "en-US")
+ "Set the voice that espeak-ng should use by default."))
+
+(define (espeakup-shepherd-service config)
+ (list (shepherd-service
+ (provision '(espeakup))
+ (requirement '(user-processes))
+ (documentation "Run espeakup, the espeak-ng bridge to speakup.")
+ (start
+ #~(make-forkexec-constructor
+ (list #$(file-append (espeakup-configuration-espeakup config)
+ "/bin/espeakup")
+ "-v" #$(espeakup-configuration-default-voice config))))
+ (stop #~(make-kill-destructor)))))
+
+(define espeakup-service-type
+ (service-type
+ (name 'espeakup)
+ (extensions
+ (list (service-extension
+ shepherd-root-service-type
+ espeakup-shepherd-service)
+ (service-extension
+ kernel-module-loader-service-type
+ (const (list "speakup_soft")))))
+ (default-value (espeakup-configuration))
+ (description
+ "Configure and run espeakup, a lightweight bridge between espeak-ng and speakup.")))
--
2.38.0