(wip) spotifyd experimentation

This commit is contained in:
2024-10-21 12:31:30 -07:00
parent a53519c339
commit 9b10f4abe0

View File

@@ -4,6 +4,16 @@ with lib;
let let
cfg = config.roles.spotifyd; cfg = config.roles.spotifyd;
spotifyd = pkgs.spotifyd.override { withMpris = true; withPulseAudio = true; };
spotifydConf = pkgs.writeText "spotifyd-config" ''
[global]
backend = "pulseaudio"
bitrate = 320
use_mpris = false
zeroconf_port = 5354
autoplay = false
device_type = "${cfg.deviceType}"
'';
in in
{ {
options.roles.spotifyd = { options.roles.spotifyd = {
@@ -16,27 +26,19 @@ in
config = mkIf cfg.enable config = mkIf cfg.enable
{ {
roles.audio.enable = true; roles.audio.enable = true;
hardware.pulseaudio.enable = true;
hardware.pulseaudio.extraConfig = ''
unload-module module-native-protocol-unix
load-module module-native-protocol-unix auth-anonymous=1
'';
hardware.pulseaudio.systemWide = true;
services.spotifyd = { systemd.user.services.spotifyd = {
enable = true; enable = true;
settings = { wantedBy = [ "default.target" ];
global = { after = [ "network-online.target" "sound.target" ];
use_mpris = false; description = "spotifyd, a Spotify playing daemon";
backend = "pulseaudio"; serviceConfig = {
bitrate = 320; ExecStart = "${spotifyd}/bin/spotifyd --no-daemon --cache-path=\${HOME}/.cache/spotifyd --config-path=${spotifydConf}";
cache_path = ""; Restart = "always";
zeroconf_port = 5354; RestartSec = 12;
autoplay = false;
device_type = cfg.deviceType;
};
}; };
}; };
users.users."kodi".linger = true;
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
5354 5354