forked from CCCHH/nix-infra
julian
c9310374af
- Move audio configuration into a service module to make it easily usable by multiple hosts. - Allow configuration of AirPlay 2 name. - Don't set MQTT topic of Shairport-Sync (AirPlay 2) explictly. Defaults to hostname now. - Don't set sound.enable anymore, since its not needed.
42 lines
1.1 KiB
Nix
42 lines
1.1 KiB
Nix
# Sources for this configuration:
|
|
# - https://github.com/librespot-org/librespot
|
|
# - https://github.com/librespot-org/librespot/wiki/Options
|
|
# - https://github.com/librespot-org/librespot/wiki/Audio-Backends
|
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.ccchh.services.audio;
|
|
|
|
in
|
|
|
|
{
|
|
config = mkIf cfg.enable {
|
|
systemd.services.spotify-connect-receiver = {
|
|
enable = true;
|
|
description = "Spotify Connect Receiver Using librespot";
|
|
unitConfig = {
|
|
Requires = [ "network-online.target" "pipewire.service" ];
|
|
After = [ "network-online.target" "pipewire.service" ];
|
|
};
|
|
serviceConfig = {
|
|
ExecStart = "${pkgs.librespot}/bin/librespot --name '${config.ccchh.services.audio.name}' --device-type speaker --bitrate 320 --enable-volume-normalisation --disable-audio-cache --disable-credential-cache --quiet";
|
|
User = "librespot";
|
|
Group = "librespot";
|
|
};
|
|
wantedBy = [ "multi-user.target" ];
|
|
};
|
|
|
|
users = {
|
|
users.librespot = {
|
|
isSystemUser = true;
|
|
group = "librespot";
|
|
extraGroups = [ "pipewire" ];
|
|
};
|
|
groups.librespot = { };
|
|
};
|
|
};
|
|
}
|