summary refs log tree commit diff
path: root/nixos/modules/services/hardware/bluetooth.nix
blob: 6bc0ad0bf77462989455a5e16dc7103a2c0aa57c (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ config, pkgs, ... }:

with pkgs.lib;

{

  ###### interface

  options = {

    hardware.bluetooth.enable = mkOption {
      default = false;
      description = "Whether to enable support for Bluetooth.";
    };

  };


  ###### implementation

  config = mkIf config.hardware.bluetooth.enable {

    environment.systemPackages = [ pkgs.bluez pkgs.openobex pkgs.obexftp ];

    services.udev.packages = [ pkgs.bluez ];

    services.dbus.packages = [ pkgs.bluez ];

    systemd.services."dbus-org.bluez" = {
      description = "Bluetooth service";
      serviceConfig = {
        Type = "dbus";
        BusName = "org.bluez";
        ExecStart = "${pkgs.bluez}/sbin/bluetoothd -n";
      };
      wantedBy = [ "bluetooth.target" ];
    };

  };

}