2014-04-14 07:26:48 -07:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-08-10 11:25:09 -07:00
|
|
|
|
2014-04-14 07:26:48 -07:00
|
|
|
with lib;
|
2016-01-29 14:08:42 -08:00
|
|
|
let
|
2017-02-01 13:52:12 -08:00
|
|
|
isBluez4 = config.services.xserver.desktopManager.kde4.enable;
|
|
|
|
bluez-bluetooth = if isBluez4 then pkgs.bluez4 else pkgs.bluez;
|
2016-01-29 14:08:42 -08:00
|
|
|
|
|
|
|
in
|
2009-08-10 11:25:09 -07:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
2010-08-27 08:32:49 -07:00
|
|
|
|
|
|
|
hardware.bluetooth.enable = mkOption {
|
2013-10-30 09:37:45 -07:00
|
|
|
type = types.bool;
|
2010-08-27 08:32:49 -07:00
|
|
|
default = false;
|
|
|
|
description = "Whether to enable support for Bluetooth.";
|
|
|
|
};
|
2011-09-14 11:20:50 -07:00
|
|
|
|
2009-08-10 11:25:09 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
2016-01-29 14:08:42 -08:00
|
|
|
|
2010-08-27 08:32:49 -07:00
|
|
|
config = mkIf config.hardware.bluetooth.enable {
|
|
|
|
|
2016-01-29 14:08:42 -08:00
|
|
|
environment.systemPackages = [ bluez-bluetooth pkgs.openobex pkgs.obexftp ];
|
2017-02-01 13:52:12 -08:00
|
|
|
|
2016-01-29 14:08:42 -08:00
|
|
|
services.udev.packages = [ bluez-bluetooth ];
|
2017-02-01 13:52:12 -08:00
|
|
|
|
2016-01-29 14:08:42 -08:00
|
|
|
services.dbus.packages = [ bluez-bluetooth ];
|
2017-02-01 13:52:12 -08:00
|
|
|
|
|
|
|
systemd.packages = [ bluez-bluetooth ];
|
|
|
|
|
|
|
|
systemd.services.bluetooth = {
|
|
|
|
wantedBy = [ "bluetooth.target" ];
|
|
|
|
aliases = [ "dbus-org.bluez.service" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.user.services.obex = mkIf (!isBluez4) {
|
|
|
|
aliases = [ "dbus-org.bluez.obex.service" ];
|
|
|
|
};
|
2013-02-10 10:30:02 -08:00
|
|
|
|
2011-09-14 11:20:50 -07:00
|
|
|
};
|
|
|
|
|
2009-08-10 11:25:09 -07:00
|
|
|
}
|