diff --git a/config/hosts/audio/default.nix b/config/hosts/audio/default.nix index 421557a..4bb568f 100644 --- a/config/hosts/audio/default.nix +++ b/config/hosts/audio/default.nix @@ -2,6 +2,7 @@ { imports = [ ./configuration.nix + ./librespot.nix ./networking.nix ./shairport-sync.nix ]; diff --git a/config/hosts/audio/librespot.nix b/config/hosts/audio/librespot.nix new file mode 100644 index 0000000..5709ee9 --- /dev/null +++ b/config/hosts/audio/librespot.nix @@ -0,0 +1,32 @@ +# 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, ... }: + +{ + 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 'Z9 Hauptraum' --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 = { }; + }; +}