c3h-nixfiles/shared-services/spotifyd.nix

36 lines
898 B
Nix

{ config, pkgs, ... }:
{
disabledModules = [ "services/audio/spotifyd.nix" ];
imports = [ ../modules/spotifyd.nix ];
services.spotifyd = {
enable = true;
settings.global = {
bitrate = 320;
zeroconf_port = 18572;
};
};
networking.firewall.allowedTCPPorts = [ 4070 config.services.spotifyd.settings.global.zeroconf_port ];
networking.firewall.allowedUDPPorts = [ 5353 ];
systemd.services.restart-spotifyd = {
serviceConfig.Type = "oneshot";
script = ''
${pkgs.systemd}/bin/systemctl restart spotifyd.service
${pkgs.systemd}/bin/systemctl restart pulseaudio.service
'';
};
systemd.timers.restart-spotifyd = {
wantedBy = [ "timers.target" ];
partOf = [ "restart-spotifyd.service" ];
timerConfig = {
OnCalendar = "*-*-* 07:00:00";
Persistent = "True";
Unit = "restart-spotifyd.service";
};
};
}