(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
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
{
options.roles.spotifyd = {
@@ -16,27 +26,19 @@ in
config = mkIf cfg.enable
{
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;
settings = {
global = {
use_mpris = false;
backend = "pulseaudio";
bitrate = 320;
cache_path = "";
zeroconf_port = 5354;
autoplay = false;
device_type = cfg.deviceType;
};
wantedBy = [ "default.target" ];
after = [ "network-online.target" "sound.target" ];
description = "spotifyd, a Spotify playing daemon";
serviceConfig = {
ExecStart = "${spotifyd}/bin/spotifyd --no-daemon --cache-path=\${HOME}/.cache/spotifyd --config-path=${spotifydConf}";
Restart = "always";
RestartSec = 12;
};
};
users.users."kodi".linger = true;
networking.firewall.allowedTCPPorts = [
5354