From 7b79203f54853733d4fae88943829d0e24e6e49f Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Sun, 7 Jan 2024 12:00:08 -0500 Subject: massive overhaul --- modules/hardware/bluetooth.nix | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'modules/hardware/bluetooth.nix') diff --git a/modules/hardware/bluetooth.nix b/modules/hardware/bluetooth.nix index 1465d68..7f835bf 100644 --- a/modules/hardware/bluetooth.nix +++ b/modules/hardware/bluetooth.nix @@ -1,16 +1,26 @@ -{ config, lib, pkgs, ... }: { - hardware.bluetooth.enable = true; - services.blueman.enable = true; + config, + options, + lib, + pkgs, + ... +}: let + bluetoothConfig = config.modules.hardware.bluetooth; + device = config.modules.device; +in { + options.modules.hardware.bluetooth = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + }; + }; - environment.etc = { - "wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' -bluez_monitor.properties = { - ["bluez5.enable-sbc-xq"] = true, - ["bluez5.enable-msbc"] = true, - ["bluez5.enable-hw-volume"] = true, - ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" -} - ''; + config = lib.mkIf (bluetoothConfig.enable && device.hasBluetooth) { + hardware.bluetooth = { + enable = true; + package = pkgs.bluez; + powerOnBoot = true; + }; + user.extraGroups = ["bluetooth"]; }; } -- cgit v1.2.1