fmt(host/cerithium-telescopium): audio-server

This commit is contained in:
Malte Tammena 2024-11-01 19:52:41 +01:00
parent 51afc6542d
commit 00e2f4d87e
2 changed files with 92 additions and 78 deletions

View file

@ -57,7 +57,7 @@ in {
"audio.format" = "S16LE"; "audio.format" = "S16LE";
"audio.rate" = "48000"; "audio.rate" = "48000";
"audio.channels" = "2"; "audio.channels" = "2";
"audio.position" = [ "FL" "FR" ]; "audio.position" = ["FL" "FR"];
"stream.props" = { "stream.props" = {
"node.name" = "Snapcast"; "node.name" = "Snapcast";
}; };
@ -65,14 +65,23 @@ in {
}; };
# Instruct pipewire to connect bluetooth input streams to the Snapcast sink # Instruct pipewire to connect bluetooth input streams to the Snapcast sink
services.pipewire.extraConfig.pipewire."21-bluetooth-to-snapcast"."node.rules" = lib.singleton { services.pipewire.extraConfig.pipewire."21-bluetooth-to-snapcast"."node.rules" = lib.singleton {
matches = lib.singleton { "node.name" = "~bluez_input.*"; }; matches = lib.singleton {"node.name" = "~bluez_input.*";};
actions.update-props."target.object" = "Snapcast"; actions.update-props."target.object" = "Snapcast";
}; };
# TODO: # TODO:
services.pipewire.extraConfig.pipewire-pulse."50-networking"."pulse.cmd" = [ services.pipewire.extraConfig.pipewire-pulse."50-networking"."pulse.cmd" = [
{ cmd = "load-module"; args = "module-native-protocol-tcp listen=0.0.0.0"; } {
{ cmd = "load-module"; args = "module-zeroconf-discover"; } cmd = "load-module";
{ cmd = "load-module"; args = "module-zeroconf-publish"; } args = "module-native-protocol-tcp listen=0.0.0.0";
}
{
cmd = "load-module";
args = "module-zeroconf-discover";
}
{
cmd = "load-module";
args = "module-zeroconf-publish";
}
]; ];
# === Bluetooth input === # === Bluetooth input ===
@ -92,7 +101,7 @@ in {
]; ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.bluez-tools}/bin/bt-agent --pin /etc/bluetooth/pin-file --capability NoInputNoOutput"; ExecStart = "${pkgs.bluez-tools}/bin/bt-agent --pin /etc/bluetooth/pin-file --capability NoInputNoOutput";
Slice="session.slice"; Slice = "session.slice";
}; };
}; };
} }

View file

@ -7,6 +7,11 @@
let cfg = config.services.snapclient; in let cfg = config.services.snapclient; in
{ {
options.services.snapclient.enable = lib.mkEnableOption "a local snapclient service"; options.services.snapclient.enable = lib.mkEnableOption "a local snapclient service";
options.services.snapclient.latency = lib.mkOption {
type = lib.types.number;
description = "latency of the PCM device";
default = 0;
};
config.systemd.user.services.snapclient = lib.mkIf cfg.enable { config.systemd.user.services.snapclient = lib.mkIf cfg.enable {
wantedBy = lib.warnIfNot config.services.pipewire.enable "Pipewire is not running, snapclient won't work" [ wantedBy = lib.warnIfNot config.services.pipewire.enable "Pipewire is not running, snapclient won't work" [
@ -17,7 +22,7 @@ let cfg = config.services.snapclient; in
"pipewire.service" "pipewire.service"
]; ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.snapcast}/bin/snapclient --host snapserver --player pulse"; ExecStart = "${pkgs.snapcast}/bin/snapclient --host snapserver --player pulse --latency ${builtins.toString cfg.latency}";
Slice="session.slice"; Slice="session.slice";
}; };
}; };