diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix index 71b3a93a2e0..f1fcb436934 100644 --- a/nixos/modules/services/hardware/bluetooth.nix +++ b/nixos/modules/services/hardware/bluetooth.nix @@ -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 ]; diff --git a/pkgs/os-specific/linux/bluez/bluez5.nix b/pkgs/os-specific/linux/bluez/bluez5.nix index 6185e22fb87..9149f6da033 100644 --- a/pkgs/os-specific/linux/bluez/bluez5.nix +++ b/pkgs/os-specific/linux/bluez/bluez5.nix @@ -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;