summaryrefslogtreecommitdiffstats
path: root/modules/hardware/bluetooth.nix
blob: 7f835bf59052ecca12fdaeff34d254cd1e7803e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
    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"];
    };
}