1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 21:50:55 +00:00
nixpkgs/nixos/modules/services/hardware/bluetooth.nix
2017-02-02 00:52:54 +03:00

48 lines
943 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
isBluez4 = config.services.xserver.desktopManager.kde4.enable;
bluez-bluetooth = if isBluez4 then pkgs.bluez4 else pkgs.bluez;
in
{
###### interface
options = {
hardware.bluetooth.enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable support for Bluetooth.";
};
};
###### implementation
config = mkIf config.hardware.bluetooth.enable {
environment.systemPackages = [ bluez-bluetooth pkgs.openobex pkgs.obexftp ];
services.udev.packages = [ bluez-bluetooth ];
services.dbus.packages = [ bluez-bluetooth ];
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" ];
};
};
}