Merge pull request #98962 from Zopieux/snapcast-fixes
Snapcast: v0.20.0 → v0.23.0, including various fixes to nixos/snapserver
This commit is contained in:
commit
ce7da7dfef
3 changed files with 30 additions and 9 deletions
|
@ -198,13 +198,14 @@ in {
|
||||||
type = with types; attrsOf (submodule {
|
type = with types; attrsOf (submodule {
|
||||||
options = {
|
options = {
|
||||||
location = mkOption {
|
location = mkOption {
|
||||||
type = types.path;
|
type = types.oneOf [ types.path types.str ];
|
||||||
description = ''
|
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 = mkOption {
|
||||||
type = types.enum [ "pipe" "file" "process" "spotify" "airplay" ];
|
type = types.enum [ "pipe" "librespot" "airplay" "file" "process" "tcp" "alsa" "spotify" ];
|
||||||
default = "pipe";
|
default = "pipe";
|
||||||
description = ''
|
description = ''
|
||||||
The type of input stream.
|
The type of input stream.
|
||||||
|
@ -219,13 +220,21 @@ in {
|
||||||
example = literalExample ''
|
example = literalExample ''
|
||||||
# for type == "pipe":
|
# for type == "pipe":
|
||||||
{
|
{
|
||||||
mode = "listen";
|
mode = "create";
|
||||||
};
|
};
|
||||||
# for type == "process":
|
# for type == "process":
|
||||||
{
|
{
|
||||||
params = "--param1 --param2";
|
params = "--param1 --param2";
|
||||||
logStderr = "true";
|
logStderr = "true";
|
||||||
};
|
};
|
||||||
|
# for type == "tcp":
|
||||||
|
{
|
||||||
|
mode = "client";
|
||||||
|
}
|
||||||
|
# for type == "alsa":
|
||||||
|
{
|
||||||
|
device = "hw:0,0";
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
inherit sampleFormat;
|
inherit sampleFormat;
|
||||||
|
@ -255,6 +264,11 @@ in {
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
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 = {
|
systemd.services.snapserver = {
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
description = "Snapserver";
|
description = "Snapserver";
|
||||||
|
@ -272,7 +286,7 @@ in {
|
||||||
ProtectKernelTunables = true;
|
ProtectKernelTunables = true;
|
||||||
ProtectControlGroups = true;
|
ProtectControlGroups = true;
|
||||||
ProtectKernelModules = true;
|
ProtectKernelModules = true;
|
||||||
RestrictAddressFamilies = "AF_INET AF_INET6 AF_UNIX";
|
RestrictAddressFamilies = "AF_INET AF_INET6 AF_UNIX AF_NETLINK";
|
||||||
RestrictNamespaces = true;
|
RestrictNamespaces = true;
|
||||||
RuntimeDirectory = name;
|
RuntimeDirectory = name;
|
||||||
StateDirectory = name;
|
StateDirectory = name;
|
||||||
|
|
|
@ -4,6 +4,7 @@ let
|
||||||
port = 10004;
|
port = 10004;
|
||||||
tcpPort = 10005;
|
tcpPort = 10005;
|
||||||
httpPort = 10080;
|
httpPort = 10080;
|
||||||
|
tcpStreamPort = 10006;
|
||||||
in {
|
in {
|
||||||
name = "snapcast";
|
name = "snapcast";
|
||||||
meta = with pkgs.lib.maintainers; {
|
meta = with pkgs.lib.maintainers; {
|
||||||
|
@ -21,11 +22,16 @@ in {
|
||||||
mpd = {
|
mpd = {
|
||||||
type = "pipe";
|
type = "pipe";
|
||||||
location = "/run/snapserver/mpd";
|
location = "/run/snapserver/mpd";
|
||||||
|
query.mode = "create";
|
||||||
};
|
};
|
||||||
bluetooth = {
|
bluetooth = {
|
||||||
type = "pipe";
|
type = "pipe";
|
||||||
location = "/run/snapserver/bluetooth";
|
location = "/run/snapserver/bluetooth";
|
||||||
};
|
};
|
||||||
|
tcp = {
|
||||||
|
type = "tcp";
|
||||||
|
location = "127.0.0.1:${toString tcpStreamPort}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -42,6 +48,7 @@ in {
|
||||||
server.wait_until_succeeds("ss -ntl | grep -q ${toString port}")
|
server.wait_until_succeeds("ss -ntl | grep -q ${toString port}")
|
||||||
server.wait_until_succeeds("ss -ntl | grep -q ${toString tcpPort}")
|
server.wait_until_succeeds("ss -ntl | grep -q ${toString tcpPort}")
|
||||||
server.wait_until_succeeds("ss -ntl | grep -q ${toString httpPort}")
|
server.wait_until_succeeds("ss -ntl | grep -q ${toString httpPort}")
|
||||||
|
server.wait_until_succeeds("ss -ntl | grep -q ${toString tcpStreamPort}")
|
||||||
|
|
||||||
with subtest("check that pipes are created"):
|
with subtest("check that pipes are created"):
|
||||||
server.succeed("test -p /run/snapserver/mpd")
|
server.succeed("test -p /run/snapserver/mpd")
|
||||||
|
|
|
@ -20,8 +20,8 @@ let
|
||||||
|
|
||||||
aixlog = dependency {
|
aixlog = dependency {
|
||||||
name = "aixlog";
|
name = "aixlog";
|
||||||
version = "1.2.1";
|
version = "1.4.0";
|
||||||
sha256 = "1rh4jib5g41b85bqrxkl5g74hk5ryf187y9fw0am76g59xlymfpr";
|
sha256 = "0f2bs5j1jjajcpa251dslnwkgglaam3b0cm6wdx5l7mbwvnmib2g";
|
||||||
};
|
};
|
||||||
|
|
||||||
popl = dependency {
|
popl = dependency {
|
||||||
|
@ -34,13 +34,13 @@ in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "snapcast";
|
pname = "snapcast";
|
||||||
version = "0.20.0";
|
version = "0.23.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "badaix";
|
owner = "badaix";
|
||||||
repo = "snapcast";
|
repo = "snapcast";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "152ic8hlyawcmj9pykb33xc6yx7il6yb9ilmsy6m9nlh40m8yxls";
|
sha256 = "0183hhghzn0fhw2qzc1s009q7miabpcf0pxaqjdscsl8iivxqknd";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake pkg-config boost170.dev ];
|
nativeBuildInputs = [ cmake pkg-config boost170.dev ];
|
||||||
|
|
Loading…
Reference in a new issue