Next: , Previous: , Up: Services   [Contents][Index]

11.10.10 Sound Services

The (gnu services sound) module provides a service to configure the Advanced Linux Sound Architecture (ALSA) system, which makes PulseAudio the preferred ALSA output driver.

Variable: alsa-service-type

This is the type for the Advanced Linux Sound Architecture (ALSA) system, which generates the /etc/asound.conf configuration file. The value for this type is a alsa-configuration record as in this example:

See below for details about alsa-configuration.

Data Type: alsa-configuration

Data type representing the configuration for alsa-service.

alsa-plugins (default: alsa-plugins)

alsa-plugins package to use.

pulseaudio? (default: #t)

Whether ALSA applications should transparently be made to use the PulseAudio sound server.

Using PulseAudio allows you to run several sound-producing applications at the same time and to individual control them via pavucontrol, among other things.

extra-options (default: "")

String to append to the /etc/asound.conf file.

Individual users who want to override the system configuration of ALSA can do it with the ~/.asoundrc file:

# In guix, we have to specify the absolute path for plugins.
pcm_type.jack {
  lib "/home/alice/.guix-profile/lib/alsa-lib/"

# Routing ALSA to jack:
# <>.
pcm.rawjack {
  type jack
  playback_ports {
    0 system:playback_1
    1 system:playback_2

  capture_ports {
    0 system:capture_1
    1 system:capture_2

pcm.!default {
  type plug
  slave {
    pcm "rawjack"

See for the details.

Variable: pulseaudio-service-type

This is the type for the PulseAudio sound server. It exists to allow system overrides of the default settings via pulseaudio-configuration, see below.

Warning: This service overrides per-user configuration files. If you want PulseAudio to honor configuration files in ~/.config/pulse you have to unset the environment variables PULSE_CONFIG and PULSE_CLIENTCONFIG in your ~/.bash_profile.

Warning: This service on its own does not ensure, that the pulseaudio package exists on your machine. It merely adds configuration files for it, as detailed below. In the (admittedly unlikely) case, that you find yourself without a pulseaudio package, consider enabling it through the alsa-service-type above.

Data Type: pulseaudio-configuration

Data type representing the configuration for pulseaudio-service.

client-conf (default: '())

List of settings to set in client.conf. Accepts a list of strings or symbol-value pairs. A string will be inserted as-is with a newline added. A pair will be formatted as “key = value”, again with a newline added.

daemon-conf (default: '((flat-volumes . no)))

List of settings to set in daemon.conf, formatted just like client-conf.

script-file (default: (file-append pulseaudio "/etc/pulse/"))

Script file to use as In case the extra-script-files field below is used, an .include directive pointing to /etc/pulse/ is appended to the provided script.

extra-script-files (default: '())

A list of file-like objects defining extra PulseAudio scripts to run at the initialization of the pulseaudio daemon, after the main script-file. The scripts are deployed to the /etc/pulse/ directory; they should have the ‘.pa’ file name extension. For a reference of the available commands, refer to man pulse-cli-syntax.

system-script-file (default: (file-append pulseaudio "/etc/pulse/"))

Script file to use as

The example below sets the default PulseAudio card profile, the default sink and the default source to use for a old SoundBlaster Audigy sound card:

  (list (plain-file ""
                    (string-append "\
set-card-profile alsa_card.pci-0000_01_01.0 \
set-default-source alsa_input.pci-0000_01_01.0.analog-mono
set-default-sink alsa_output.pci-0000_01_01.0.analog-surround-40\n")))))

Note that pulseaudio-service-type is part of %desktop-services; if your operating system declaration was derived from one of the desktop templates, you’ll want to adjust the above example to modify the existing pulseaudio-service-type via modify-services (see modify-services), instead of defining a new one.

Variable: ladspa-service-type

This service sets the LADSPA_PATH variable, so that programs, which respect it, e.g. PulseAudio, can load LADSPA plugins.

The following example will setup the service to enable modules from the swh-plugins package:

(service ladspa-service-type
         (ladspa-configuration (plugins (list swh-plugins))))

See for the details.

Next: File Search Services, Previous: Desktop Services, Up: Services   [Contents][Index]