From 7614f02d79587db4d4ac6930d07fd34a57e59c75 Mon Sep 17 00:00:00 2001 From: Andre Date: Wed, 17 Jul 2024 11:08:22 -0400 Subject: [PATCH] Bluetooth: Add systemd service to enable adapter at boot --- modules/system/bluetooth.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/system/bluetooth.nix b/modules/system/bluetooth.nix index 8eecd22..b2b3d37 100644 --- a/modules/system/bluetooth.nix +++ b/modules/system/bluetooth.nix @@ -33,5 +33,19 @@ in # Add Bluetooth LE audio support environment.systemPackages = with pkgs; [ liblc3 ]; + + # FIXME: Create systemd service to manually start the adapter on boot. + # This is a workaround for hardware.bluetooth.powerOnBoot not working as expected. + systemd.services.startBluetooth = { + description = "Manually starts the Bluetooth service on boot"; + after = [ "bluetooth.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + type = "simple"; + ExecStart = "${pkgs.bluez}/bin/bluetoothctl -- power on"; + Restart = "always"; + RestartSec = "5s"; + }; + }; }; }