From 458dc14eefaf0468837209fe85a6f23d07bc33b4 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 31 Dec 2024 16:59:40 -0500 Subject: [PATCH] feat(hass): improve ueboom connection at boot --- configurations/homie/modules/music/default.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/configurations/homie/modules/music/default.nix b/configurations/homie/modules/music/default.nix index 8d9e5077..8941a487 100644 --- a/configurations/homie/modules/music/default.nix +++ b/configurations/homie/modules/music/default.nix @@ -27,13 +27,23 @@ systemd.user.services = { pulseaudio.after = ["bluetooth.service"]; spotifyd.after = ["pulseaudio.service"]; + ueboom = { after = ["spotifyd.service"]; - path = with pkgs; [bluez]; + path = builtins.attrValues { + inherit (pkgs) bluez; + inherit (config.hardware.pulseaudio) package; + }; script = '' - sleep 60 - exec bluetoothctl connect 88:C6:26:93:4B:77 + if [[ "$(pactl get-default-sink)" == "auto_null" ]]; then + exec bluetoothctl connect 88:C6:26:93:4B:77 + fi ''; + serviceConfig = { + Restart = "on-failure"; + RestartSec = 3; + RestartPreventExitStatus = 3; + }; }; }; systemd.user.targets.default.wants = [