From 853552493fe6afde3056230ea89a04adb546743a Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sat, 15 Feb 2025 11:31:48 -0500 Subject: [PATCH] feat(ueboom): use timer to make sure we're always connected --- .../homie/modules/music/default.nix | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/configurations/homie/modules/music/default.nix b/configurations/homie/modules/music/default.nix index 1e854a68..97cd6c6b 100644 --- a/configurations/homie/modules/music/default.nix +++ b/configurations/homie/modules/music/default.nix @@ -24,12 +24,18 @@ # Have pulseaudio and spotifyd start at boot but after bluetooth # so bluetooth accepts sound connections from the start. users.users.${mainUser}.linger = true; + systemd.user.services = { - pulseaudio.after = ["bluetooth.service"]; - spotifyd.after = ["pulseaudio.service"]; + pulseaudio = { + after = ["bluetooth.service"]; + wantedBy = ["default.target"]; + }; + spotifyd = { + after = ["pulseaudio.service"]; + wantedBy = ["default.target"]; + }; ueboom = { - after = ["spotifyd.service"]; path = builtins.attrValues { inherit (pkgs) bluez; inherit (config.services.pulseaudio) package; @@ -46,11 +52,16 @@ }; }; }; - systemd.user.targets.default.wants = [ - "pulseaudio.service" - "spotifyd.service" - "ueboom.service" - ]; + + systemd.user.timers.ueboom = { + after = ["spotifyd.service"]; + timerConfig = { + Unit = "ueboom.service"; + OnCalendar = "*-*-* *:0/10:50"; # Every 10 minutes + Persistent = true; + }; + wantedBy = ["timers.target"]; + }; services = { # Allow pulseaudio to be managed by MPD