summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2026-08-09 10:20:02 +0100
committerChristopher Baines <mail@cbaines.net>2026-08-22 20:03:01 +0100
commit9ceab34e9bd42c878bfeab15c71687ab754e4cf4 (patch)
tree5eb50180c5a7b577f461b2c89d777213308d2c2e /doc
parent239327961888f109b0a66bda099a5ac23ce9f9ef (diff)
gnu: services: audio: Add snapcast snapserver service.
This is just the server component, another service definition is needed for the snapclient. * gnu/services/audio.scm: (snapserver-stream, snapserver-stream?, snapserver-stream-name, snapserver-stream-type, snapserver-stream-location, snapserver-stream-codec, snapserver-stream-sampleformat, snapserver-stream-chunk-ms, snapserver-stream-parameters, snapserver-configuration, snapserver-configuration?, snapserver-configuration-package, snapserver-configuration-user, snapserver-configuration-group, snapserver-configuration-shepherd-requirement, snapserver-configuration-log-file, snapserver-configuration-log-filter, snapserver-configuration-data-directory, snapserver-configuration-mdns?, snapserver-configuration-http?, snapserver-configuration-http-port, snapserver-configuration-http-bind-address, snapserver-configuration-doc-root, snapserver-configuration-tcp-control?, snapserver-configuration-tcp-control-port, snapserver-configuration-tcp-streaming?, snapserver-configuration-tcp-streaming-port, snapserver-configuration-streams, snapserver-configuration-codec, snapserver-configuration-sampleformat, snapserver-configuration-buffer-ms, snapserver-configuration-chunk-ms, snapserver-configuration-send-to-muted?, snapserver-configuration-extra-content): New procedures. (snapserver-service-type): New variable. * doc/guix.texi (Audio Services): Document it. Change-Id: I5dd2c15ff8c1b560abd481147312a8d6fc844776
Diffstat (limited to 'doc')
-rw-r--r--doc/guix.texi174
1 files changed, 170 insertions, 4 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 555fd082471..39544d9acff 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -456,7 +456,7 @@ Services
456* Samba Services:: Samba services. 456* Samba Services:: Samba services.
457* Continuous Integration:: Cuirass and Laminar services. 457* Continuous Integration:: Cuirass and Laminar services.
458* Power Management Services:: Extending battery life, etc. 458* Power Management Services:: Extending battery life, etc.
459* Audio Services:: The MPD. 459* Audio Services:: The MPD and Snapcast.
460* Virtualization Services:: Virtualization services. 460* Virtualization Services:: Virtualization services.
461* Version Control Services:: Software version control servers. 461* Version Control Services:: Software version control servers.
462* Game Services:: Game servers. 462* Game Services:: Game servers.
@@ -20622,7 +20622,7 @@ declaration.
20622* Samba Services:: Samba services. 20622* Samba Services:: Samba services.
20623* Continuous Integration:: Cuirass and Laminar services. 20623* Continuous Integration:: Cuirass and Laminar services.
20624* Power Management Services:: Extending battery life, etc. 20624* Power Management Services:: Extending battery life, etc.
20625* Audio Services:: The MPD. 20625* Audio Services:: The MPD and Snapcast.
20626* Virtualization Services:: Virtualization services. 20626* Virtualization Services:: Virtualization services.
20627* Version Control Services:: Software version control servers. 20627* Version Control Services:: Software version control servers.
20628* Game Services:: Game servers. 20628* Game Services:: Game servers.
@@ -41763,8 +41763,9 @@ The handler for the battattach event.
41763@node Audio Services 41763@node Audio Services
41764@subsection Audio Services 41764@subsection Audio Services
41765 41765
41766The @code{(gnu services audio)} module provides a service to start MPD 41766The @code{(gnu services audio)} module provides services to start MPD
41767(the Music Player Daemon). 41767(the Music Player Daemon) and Snapcast, a multi-room audio streaming
41768system.
41768 41769
41769@cindex mpd 41770@cindex mpd
41770@subsubheading Music Player Daemon 41771@subsubheading Music Player Daemon
@@ -42167,6 +42168,171 @@ Disallowed IP addresses.
42167@end deftp 42168@end deftp
42168@c %end of fragment 42169@c %end of fragment
42169 42170
42171@subsubheading Snapcast
42172
42173@cindex Snapcast
42174@cindex multi-room audio
42175
42176@uref{https://github.com/badaix/snapcast, Snapcast} is a multi-room
42177audio streaming system: @command{snapserver} receives audio from one or
42178more sources and streams it to @command{snapclient} instances, which
42179play it back in sync.
42180
42181The following example runs @command{snapserver} with a single named pipe
42182as its audio source, in addition to the default HTTP interface on port
421831780 and the client-facing streaming interface on port 1704.
42184
42185@lisp
42186(service snapserver-service-type
42187 (snapserver-configuration
42188 (streams (list (snapserver-stream
42189 (name "mpd")
42190 (location "/run/snapserver/mpd"))))))
42191@end lisp
42192
42193@command{snapserver} creates the named pipes of its @code{pipe} sources
42194when it starts, as the @samp{snapserver} user; make sure the program
42195feeding such a pipe---the @code{fifo} output of MPD, for instance---is
42196allowed to write to it.
42197
42198@defvar snapserver-service-type
42199The service type for @command{snapserver}.
42200@end defvar
42201
42202@c %start of fragment
42203@deftp {Data Type} snapserver-configuration
42204Available @code{snapserver-configuration} fields are:
42205
42206@table @asis
42207@item @code{package} (default: @code{snapcast}) (type: file-like)
42208The Snapcast package to use.
42209
42210@item @code{user} (default: @code{%snapserver-user}) (type: user-account)
42211Owner of the @command{snapserver} process.
42212
42213@item @code{group} (default: @code{%snapserver-group}) (type: user-group)
42214Owner group of the @command{snapserver} process.
42215
42216@item @code{shepherd-requirement} (default: @code{'()}) (type: list-of-symbols)
42217This is a list of symbols naming Shepherd services that this service
42218will depend on.
42219
42220@item @code{log-file} (default: @code{"/var/log/snapserver.log"}) (type: string)
42221File where @command{snapserver} writes its log.
42222
42223@item @code{log-filter} (default: @code{"*:info"}) (type: string)
42224Log filter, given as @code{@var{tag}:@var{level}} pairs separated by
42225commas, where @var{tag} is @code{*} or a log tag and @var{level} is one
42226of @code{trace}, @code{debug}, @code{info}, @code{notice},
42227@code{warning}, @code{error} or @code{fatal}.
42228
42229@item @code{data-directory} (default: @code{"/var/lib/snapserver"}) (type: string)
42230Directory where @command{snapserver} stores persistent data, such as
42231client settings.
42232
42233@item @code{mdns?} (default: @code{#t}) (type: boolean)
42234Whether to publish the Snapcast services over mDNS. This requires
42235@code{avahi-service-type} (@pxref{Networking Services}).
42236
42237@item @code{http?} (default: @code{#t}) (type: boolean)
42238Whether to enable the HTTP JSON-RPC interface, which also serves the
42239Snapweb web interface.
42240
42241@item @code{http-port} (default: @code{1780}) (type: integer)
42242Port the HTTP server listens on.
42243
42244@item @code{http-bind-address} (default: @code{"::"}) (type: string)
42245Address the HTTP server listens on.
42246
42247@item @code{doc-root} (type: maybe-file-like)
42248Directory served by the HTTP server. It defaults to the Snapweb web
42249interface bundled with the @code{package} field.
42250
42251@item @code{tcp-control?} (default: @code{#t}) (type: boolean)
42252Whether to enable the TCP JSON-RPC control interface.
42253
42254@item @code{tcp-control-port} (default: @code{1705}) (type: integer)
42255Port the TCP control interface listens on.
42256
42257@item @code{tcp-streaming?} (default: @code{#t}) (type: boolean)
42258Whether to enable TCP streaming, which is what Snapcast clients connect
42259to.
42260
42261@item @code{tcp-streaming-port} (default: @code{1704}) (type: integer)
42262Port the TCP streaming interface listens on.
42263
42264@item @code{streams} (type: list-of-snapserver-stream)
42265List of @code{snapserver-stream} records describing the audio sources
42266@command{snapserver} reads from.
42267
42268@item @code{codec} (default: @code{"flac"}) (type: string)
42269Default codec used to send audio to clients, given as
42270@code{@var{codec}[:@var{options}]} where @var{codec} is one of
42271@code{flac}, @code{ogg}, @code{opus} or @code{pcm}.
42272
42273@item @code{sampleformat} (default: @code{"48000:16:2"}) (type: string)
42274Default sample format of the streams, given as
42275@code{@var{rate}:@var{bits}:@var{channels}}.
42276
42277@item @code{buffer-ms} (default: @code{1000}) (type: integer)
42278End-to-end latency, in milliseconds.
42279
42280@item @code{chunk-ms} (default: @code{20}) (type: integer)
42281Default duration, in milliseconds, of the audio chunks read from the
42282sources.
42283
42284@item @code{send-to-muted?} (default: @code{#f}) (type: boolean)
42285Whether to send audio to muted clients.
42286
42287@item @code{extra-content} (type: maybe-string)
42288Content appended verbatim to @file{snapserver.conf}, for options that
42289are not covered by the fields above, such as the @code{[ssl]} and
42290@code{[authorization]} sections.
42291
42292@end table
42293@end deftp
42294@c %end of fragment
42295
42296@c %start of fragment
42297@deftp {Data Type} snapserver-stream
42298Available @code{snapserver-stream} fields are:
42299
42300@table @asis
42301@item @code{name} (default: @code{"default"}) (type: string)
42302Name of the stream, as shown by Snapcast clients.
42303
42304@item @code{type} (default: @code{pipe}) (type: snapserver-stream-type)
42305Type of the stream source: one of @code{pipe}, @code{file},
42306@code{process}, @code{librespot}, @code{airplay}, @code{tcp},
42307@code{alsa} or @code{meta}.
42308
42309@item @code{location} (default: @code{"/run/snapserver/snapfifo"}) (type: string)
42310Location of the stream source: a file name for @code{pipe}, @code{file}
42311and @code{process} streams, a host name for @code{tcp} streams, a device
42312name for @code{alsa} streams, and a slash-separated list of stream names
42313for @code{meta} streams.
42314
42315@item @code{codec} (type: maybe-string)
42316Codec to use for this stream, overriding the @code{codec} field of
42317@code{snapserver-configuration}.
42318
42319@item @code{sampleformat} (type: maybe-string)
42320Sample format of this stream, given as
42321@code{@var{rate}:@var{bits}:@var{channels}}, overriding the
42322@code{sampleformat} field of @code{snapserver-configuration}.
42323
42324@item @code{chunk-ms} (type: maybe-integer)
42325Duration, in milliseconds, of the audio chunks read from this source,
42326overriding the @code{chunk-ms} field of @code{snapserver-configuration}.
42327
42328@item @code{parameters} (default: @code{'()}) (type: alist)
42329Additional source parameters, given as an association list, for example
42330@code{'(("controlscript" . "meta_mpd.py"))}.
42331
42332@end table
42333@end deftp
42334@c %end of fragment
42335
42170@node Virtualization Services 42336@node Virtualization Services
42171@subsection Virtualization Services 42337@subsection Virtualization Services
42172 42338