From f8686374176d7875846a0ee71a2c2890ef7d4a85 Mon Sep 17 00:00:00 2001 From: busti Date: Sat, 22 Jan 2022 17:22:02 +0100 Subject: [PATCH] automatically restart spotifyd and pulseaudio daily --- shared-services/spotifyd.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/shared-services/spotifyd.nix b/shared-services/spotifyd.nix index 0b8a9be..c3ce6c4 100644 --- a/shared-services/spotifyd.nix +++ b/shared-services/spotifyd.nix @@ -1,4 +1,4 @@ -{ config, ... }: +{ config, pkgs, ... }: { disabledModules = [ "services/audio/spotifyd.nix" ]; @@ -15,4 +15,22 @@ 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"; + }; + }; }