Howdy,

Here is a project I am interested in getting into Guix in some fashion, copied from my email I sent to help-guix a while back. Any mentorship and/or help pointers would be appreciated, and I appologize for the double posting.

---------- Forwarded message ---------
From: Hunter Jozwiak <hunter.t.joz@gmail.com>
Date: Sun, May 7, 2023 at 3:50 AM
Subject: Writing an Accessible Guix ISO
To: <help-guix@gnu.org>


Greetings,

I have been hacking for quite some time now on the Guix installer, trying to get it to run with the espeakup screenreader which I have the module and package for in Guix already. Here is what I have managed to come up with thus far, after a time.

(define-module (nongnu system install)
  #:use-module (gnu services)
  #:use-module (gnu services ssh)
  #:use-module (gnu services sound)
  #:use-module (gnu services configuration)
  #:use-module (gnu services linux)
  #:use-module (gnu services shepherd)
  #:use-module (guix gexp)
  #:use-module (guix records)
  #:use-module (gnu system)
  #:use-module (gnu system install)
  #:use-module (gnu packages accessibility)

  #:use-module (gnu packages version-control)
  #:use-module (gnu packages vim)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages emacs)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages mtools)
  #:use-module (gnu packages package-management)
  #:use-module (guix)
  #:export (installation-os-accessible))

(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.")))
(define installation-os-accessible
  (operating-system
   (inherit installation-os)
   ;; Add the 'net.ifnames' argument to prevent network interfaces
   ;; from having really long names.  This can cause an issue with
   ;; wpa_supplicant when you try to connect to a wifi network.
   (kernel-arguments '("quiet" "modprobe.blacklist=radeon" "net.ifnames=0" "console=ttyS0,115200" "speakup.synth=soft"))

   (services
    (cons*
     ;;; Todo unmute all the audio channels.
     (service alsa-service-type)
     (service espeakup-service-type)
     (modify-services (operating-system-user-services installation-os)
                      (openssh-service-type config =>
                                            (openssh-configuration
                                             (inherit config)
                                             (allow-empty-passwords? #t)
                                             (%auto-start? #t))))))

   ;; Add some extra packages useful for the installation process
   (packages
    (append (list espeakup git curl stow vim emacs-no-x-toolkit alsa-utils)
            (operating-system-packages installation-os)))))

installation-os-accessible

The main questions I have so far are these:

  1. I know that the espeakup service is incomplete and when I was experimenting it was perpetually disabled. I have a reference of how it is done in systemd, but not sure how to translate it to the correct shepherd things; pointers to corrections appreciated (I suspect that the kernel-loader service is a modprobe of sorts, not sure how to solve for the sound requirement as yet).

    [Unit]
    Description=Software speech output for Speakup
    Documentation=man:espeakup(8)
    Wants=modprobe@speakup_soft.service
    After=modprobe@speakup_soft.service sound.target
    
    [Service]
    Type=forking
    PIDFile=/run/espeakup.pid
    Environment="default_voice="
    ExecStart=@bindir@/espeakup --default-voice=${default_voice}
    ExecReload=kill -HUP $MAINPID
    Restart=always
    Nice=-10
    OOMScoreAdjust=-900
    
    [Install]
    WantedBy=sound.target
    

    As an update, I did manage to get espeakup to sort of enable itself with herd enable espeakup and I tried herd start espeakup, but nothing fruitful happened.

  2. Is it true that the defaults is to mute all the channels by default, and if so how can this be undone? As it stands now, the system has everything muted when I run alsamixer and the volumes were all 0.
  3. The ssh was meant more as a fail safe in case all else had failed,

and there was no audio to speak of; that and it has been somewhat invaluable in debugging the system. In practical uses, this will likely need to be shorn up and locked down again. In the case someone needs to ssh into the box, is there a way to hijack the installer from an ssh session (the code spelunking I have done thus far suggests no, but I might be wrong)?

Thanks,

Hunter