{ 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; }; }; config = lib.mkIf (bluetoothConfig.enable && device.hasBluetooth) { hardware.bluetooth = { enable = true; package = pkgs.bluez; powerOnBoot = true; }; user.extraGroups = ["bluetooth"]; }; }