diff options
author | Alexandre Macabies <web+oss@zopieux.com> | 2020-09-27 20:49:23 +0200 |
---|---|---|
committer | Alexandre Macabies <web+oss@zopieux.com> | 2021-02-05 19:23:24 +0100 |
commit | a36cc03d96594526565ce06a0b6db14286fe88ae (patch) | |
tree | 69a10a6898a95a01b4899dc4e03cbd13c104c114 /nixos/modules | |
parent | 5fd8747939ead2aa54d2cb413577ad80edc924c6 (diff) |
nixos/snapserver: update available stream types for v0.21.0
* Add 'librespot' (new name for 'spotify'), 'alsa', 'tcp'. * Add a warning about the spotify -> librespot rename. * Fix the deprecated example `mode = "listen"` for type 'pipe'. * Update the tests to include a straightforward 'tcp' test.
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/audio/snapserver.nix | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/nixos/modules/services/audio/snapserver.nix b/nixos/modules/services/audio/snapserver.nix index f614f0ba3e10c..b207fd30e222e 100644 --- a/nixos/modules/services/audio/snapserver.nix +++ b/nixos/modules/services/audio/snapserver.nix @@ -198,13 +198,14 @@ in { type = with types; attrsOf (submodule { options = { location = mkOption { - type = types.path; + type = types.oneOf [ types.path types.str ]; description = '' - The location of the pipe. + The location of the pipe, file, Librespot/Airplay/process binary, or a TCP address. + Use an empty string for alsa. ''; }; type = mkOption { - type = types.enum [ "pipe" "file" "process" "spotify" "airplay" ]; + type = types.enum [ "pipe" "librespot" "airplay" "file" "process" "tcp" "alsa" "spotify" ]; default = "pipe"; description = '' The type of input stream. @@ -219,13 +220,21 @@ in { example = literalExample '' # for type == "pipe": { - mode = "listen"; + mode = "create"; }; # for type == "process": { params = "--param1 --param2"; logStderr = "true"; }; + # for type == "tcp": + { + mode = "client"; + } + # for type == "alsa": + { + device = "hw:0,0"; + } ''; }; inherit sampleFormat; @@ -255,6 +264,11 @@ in { config = mkIf cfg.enable { + # https://github.com/badaix/snapcast/blob/98ac8b2fb7305084376607b59173ce4097c620d8/server/streamreader/stream_manager.cpp#L85 + warnings = filter (w: w != "") (mapAttrsToList (k: v: if v.type == "spotify" then '' + services.snapserver.streams.${k}.type = "spotify" is deprecated, use services.snapserver.streams.${k}.type = "librespot" instead. + '' else "") cfg.streams); + systemd.services.snapserver = { after = [ "network.target" ]; description = "Snapserver"; |