2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-08-10 19:25:09 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2009-08-10 19:25:09 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
2010-08-27 16:32:49 +01:00
|
|
|
|
|
|
|
hardware.bluetooth.enable = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.bool;
|
2010-08-27 16:32:49 +01:00
|
|
|
default = false;
|
|
|
|
description = "Whether to enable support for Bluetooth.";
|
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-08-10 19:25:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2010-08-27 16:32:49 +01:00
|
|
|
config = mkIf config.hardware.bluetooth.enable {
|
|
|
|
|
|
|
|
environment.systemPackages = [ pkgs.bluez pkgs.openobex pkgs.obexftp ];
|
2009-08-10 19:25:09 +01:00
|
|
|
|
2010-08-27 16:32:49 +01:00
|
|
|
services.udev.packages = [ pkgs.bluez ];
|
2009-08-10 19:25:09 +01:00
|
|
|
|
2010-08-27 16:32:49 +01:00
|
|
|
services.dbus.packages = [ pkgs.bluez ];
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2013-02-10 18:30:02 +00:00
|
|
|
systemd.services."dbus-org.bluez" = {
|
2013-11-09 19:06:01 +00:00
|
|
|
description = "Bluetooth Service";
|
2013-02-10 18:30:02 +00:00
|
|
|
serviceConfig = {
|
|
|
|
Type = "dbus";
|
|
|
|
BusName = "org.bluez";
|
|
|
|
ExecStart = "${pkgs.bluez}/sbin/bluetoothd -n";
|
|
|
|
};
|
|
|
|
wantedBy = [ "bluetooth.target" ];
|
|
|
|
};
|
|
|
|
|
2011-09-14 19:20:50 +01:00
|
|
|
};
|
|
|
|
|
2009-08-10 19:25:09 +01:00
|
|
|
}
|