Skip to content

Commit 9020c2e

Browse files
kajusnaubrianmcgillion
authored andcommitted
bluetooth: rename adapter, dont enable on boot, adjust cfg
Signed-off-by: Kajus Naujokaitis <[email protected]>
1 parent 2c21db7 commit 9020c2e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

modules/common/services/bluetooth.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,35 @@ in
2626
description = "Name of the bluetooth user";
2727
};
2828

29+
defaultName = mkOption {
30+
type = types.str;
31+
default = "Ghaf";
32+
description = ''
33+
Default Bluetooth adapter name.
34+
35+
If unset, BlueZ will attempt to fetch the hostname via hostnamed DBus service.
36+
If hostnamed is disabled, BlueZ will fall back to "BlueZ [BlueZ version]".
37+
'';
38+
};
39+
2940
};
3041
config = mkIf cfg.enable {
3142

3243
# Enable bluetooth
3344
hardware.bluetooth = {
3445
enable = true;
46+
# Save battery by disabling bluetooth on boot
47+
powerOnBoot = false;
48+
# https://github.com/bluez/bluez/blob/master/src/main.conf full list of options
49+
settings = {
50+
General = {
51+
Name = lib.optionalAttrs (cfg.defaultName != null && cfg.defaultName != "") cfg.defaultName;
52+
FastConnectable = "true";
53+
JustWorksRepairing = "confirm";
54+
Privacy = "device";
55+
DiscoverableTimeout = "60"; # Default is 180 seconds
56+
};
57+
};
3558
};
3659

3760
# Setup bluetooth user and group

0 commit comments

Comments
 (0)