1{ config, lib, pkgs, ... }:
2
3with lib;
4
5{
6
7 ###### interface
8
9 options = {
10
11 hardware.bluetooth.enable = mkOption {
12 type = types.bool;
13 default = false;
14 description = "Whether to enable support for Bluetooth.";
15 };
16
17 };
18
19
20 ###### implementation
21
22 config = mkIf config.hardware.bluetooth.enable {
23
24 environment.systemPackages = [ pkgs.bluez pkgs.openobex pkgs.obexftp ];
25
26 services.udev.packages = [ pkgs.bluez ];
27
28 services.dbus.packages = [ pkgs.bluez ];
29
30 systemd.services."dbus-org.bluez" = {
31 description = "Bluetooth Service";
32 serviceConfig = {
33 Type = "dbus";
34 BusName = "org.bluez";
35 ExecStart = "${pkgs.bluez}/sbin/bluetoothd -n";
36 };
37 wantedBy = [ "bluetooth.target" ];
38 };
39
40 };
41
42}