nixos/bluetooth: add extraConfig option (#23427)
This commit is contained in:
parent
1f0ce0eaf8
commit
f9e8ef7e6d
|
@ -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 ];
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue