nixos/bluetooth: add extraConfig option (#23427)

This commit is contained in:
Kristoffer Søholm 2017-03-20 14:28:02 +01:00 committed by Franz Pletz
parent 1f0ce0eaf8
commit f9e8ef7e6d
2 changed files with 28 additions and 5 deletions

View file

@ -14,12 +14,26 @@ in
options = {
hardware.bluetooth.enable = mkEnableOption "support for Bluetooth.";
hardware.bluetooth = {
enable = mkEnableOption "support for Bluetooth.";
hardware.bluetooth.powerOnBoot = mkOption {
type = types.bool;
default = true;
description = "Whether to power up the default Bluetooth controller on boot.";
powerOnBoot = mkOption {
type = types.bool;
default = true;
description = "Whether to power up the default Bluetooth controller on boot.";
};
extraConfig = mkOption {
type = types.lines;
default = "";
example = ''
[General]
ControllerMode = bredr
'';
description = ''
Set additional configuration for system-wide bluetooth (/etc/bluetooth/main.conf).
'';
};
};
};
@ -30,6 +44,11 @@ in
environment.systemPackages = [ bluez-bluetooth pkgs.openobex pkgs.obexftp ];
environment.etc = singleton {
source = pkgs.writeText "main.conf" cfg.extraConfig;
target = "bluetooth/main.conf";
};
services.udev.packages = [ bluez-bluetooth ];
services.dbus.packages = [ bluez-bluetooth ];
systemd.packages = [ bluez-bluetooth ];

View file

@ -73,6 +73,10 @@ stdenv.mkDerivation rec {
mkdir $out/sbin
ln -s ../libexec/bluetooth/bluetoothd $out/sbin/bluetoothd
ln -s ../libexec/bluetooth/obexd $out/sbin/obexd
# Add extra configuration
mkdir $out/etc/bluetooth
ln -s /etc/bluetooth/main.conf $out/etc/bluetooth/main.conf
'';
enableParallelBuilding = true;