Bluetooth: Difference between revisions

imported>Laxect
No edit summary
imported>Pyrox0
Fix syntax highlighting
Line 3: Line 3:


<syntaxhighlight lang="nix">{
<syntaxhighlight lang="nix">{
  ...
   hardware.bluetooth.enable = true;
   hardware.bluetooth.enable = true;
  ...
}</syntaxhighlight>
}</syntaxhighlight>


Line 33: Line 31:
Bluetooth devices automatically connect with <tt>bluetoothctl</tt> as well:
Bluetooth devices automatically connect with <tt>bluetoothctl</tt> as well:


<syntaxhighlight lang="console">$ bluetoothctl
<syntaxhighlight lang="console">
[bluetooth] # trust [hex-address]</syntaxhighlight>
$ bluetoothctl
[bluetooth] # trust [hex-address]
</syntaxhighlight>


==Using Bluetooth headsets with PulseAudio==
==Using Bluetooth headsets with PulseAudio==
Line 41: Line 41:


<syntaxhighlight lang="nix">{
<syntaxhighlight lang="nix">{
  ...
   hardware.pulseaudio.enable = true;
   hardware.pulseaudio.enable = true;
   hardware.bluetooth.enable = true;
   hardware.bluetooth.enable = true;
  ...
}</syntaxhighlight>
}</syntaxhighlight>


Line 108: Line 106:
Modern headsets will generally try to connect using the A2DP profile. To enable this for your bluetooth connection, add the following to <tt>/etc/nixos/configuration.nix</tt>
Modern headsets will generally try to connect using the A2DP profile. To enable this for your bluetooth connection, add the following to <tt>/etc/nixos/configuration.nix</tt>


<syntaxhighlight lang="nix">{
<syntaxhighlight lang="nix">
...
{
hardware.bluetooth.settings = {
  hardware.bluetooth.settings = {
  General = {
    General = {
    Enable = "Source,Sink,Media,Socket";
      Enable = "Source,Sink,Media,Socket";
    };
   };
   };
};
}
...
</syntaxhighlight>
}</syntaxhighlight>
This configuration may be unnecessary and does not work with bluez5 (<tt>Unknown key Enable for group General</tt> ).
This configuration may be unnecessary and does not work with bluez5 (<tt>Unknown key Enable for group General</tt> ).


Line 180: Line 178:
This possibly can be fixed by restarting the display-manager session. The session management may have had an issue with registering your current session and doesn't allow you to control bluetooth.
This possibly can be fixed by restarting the display-manager session. The session management may have had an issue with registering your current session and doesn't allow you to control bluetooth.


<syntaxhighlight>
<syntaxhighlight lang="console">
sudo systemctl restart display-manager.service
$ sudo systemctl restart display-manager.service
</syntaxhighlight>
</syntaxhighlight>