summary refs log tree commit diff
path: root/nixos/modules/services/hardware/bluetooth.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services/hardware/bluetooth.nix')
-rw-r--r--nixos/modules/services/hardware/bluetooth.nix29
1 files changed, 24 insertions, 5 deletions
diff --git a/nixos/modules/services/hardware/bluetooth.nix b/nixos/modules/services/hardware/bluetooth.nix
index 71b3a93a2e0d..f1fcb4369346 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 ];