Move audio configuration into a service module
- 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.
This commit is contained in:
parent
8355a6f635
commit
c9310374af
13 changed files with 246 additions and 155 deletions
42
modules/services/audio/librespot.nix
Normal file
42
modules/services/audio/librespot.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
# 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 = { };
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue