2023-11-02 21:57:08 +01:00
|
|
|
# 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 = {
|
2024-11-02 22:39:24 +01:00
|
|
|
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";
|
2023-11-02 21:57:08 +01:00
|
|
|
User = "librespot";
|
|
|
|
Group = "librespot";
|
|
|
|
};
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
users = {
|
|
|
|
users.librespot = {
|
|
|
|
isSystemUser = true;
|
|
|
|
group = "librespot";
|
2024-11-02 22:39:24 +01:00
|
|
|
extraGroups = [ "pipewire" "audio" ];
|
2023-11-02 21:57:08 +01:00
|
|
|
};
|
|
|
|
groups.librespot = { };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|