Bluetooth: Difference between revisions

From NixOS Wiki
imported>Fadenb
No edit summary
imported>Makefu
No edit summary
Line 1: Line 1:
== Enabling Bluetooth in NixOS ==
== Bluetooth headsets with Pulseaudio ==


Enabling Bluetooth is as simple as putting this in your configuration.nix:
<pre class="nix">{
  hardware.pulseaudio = {
    enable = true;
    package = pkgs.pulseaudioFull;
  };
  hardware.bluetooth.enable = true;
}</pre>
After updating the configuration


<pre>
<pre class="console">nixos-rebuild switch</pre>
hardware.bluetooth.enable = true;
I had to restart the system for pulseaudio to load the bluetooth module.
</pre>


== Bluez 5 ==
<code>pactl list</code> should show the bluetooth module.
<del>To use Bluez 5, you need something like this in your Nixpkgs config (in your <code>~/.nixpkgs/config.nix</code>):</del>


Bluez5 is now the default version (as of 2017-06-30)
As I'm not using a desktop-manager I've configured the device from the command line following [https://wiki.archlinux.org/index.php/Bluetooth_Headset ArchLinux instructions]


<pre>
<pre class="console">$ bluetoothctl
pkgs : {
[bluetooth] # power on
  packageOverrides = pkgs : {
[bluetooth] # agent on
    bluez = pkgs.bluez5;
[bluetooth] # default-agent
  }
[bluetooth] # scan on
}
...put device in pairing mode and wait [hex-address] to appear here...
</pre>
[bluetooth] # pair [hex-address]
[bluetooth] # connect [hex-address]</pre>
I've then played some audio and opened configured PulseAudio using pavucontrol. I changed the headset profile to &quot;High Fidelity Playback (A2DP Sink)&quot; for decent audio quality.
 
== How-Tos ==
 
* [http://anderspapitto.com/posts/2016-11-07-scripting_pulseaudio_bluetooth_jack.html scripting pulseaudio,bluetooth and jack]

Revision as of 16:57, 21 August 2017

Bluetooth headsets with Pulseaudio

{
  hardware.pulseaudio = {
    enable = true;
    package = pkgs.pulseaudioFull;
  };
  hardware.bluetooth.enable = true;
}

After updating the configuration

nixos-rebuild switch

I had to restart the system for pulseaudio to load the bluetooth module.

pactl list should show the bluetooth module.

As I'm not using a desktop-manager I've configured the device from the command line following ArchLinux instructions

$ bluetoothctl
[bluetooth] # power on
[bluetooth] # agent on
[bluetooth] # default-agent
[bluetooth] # scan on
...put device in pairing mode and wait [hex-address] to appear here...
[bluetooth] # pair [hex-address]
[bluetooth] # connect [hex-address]

I've then played some audio and opened configured PulseAudio using pavucontrol. I changed the headset profile to "High Fidelity Playback (A2DP Sink)" for decent audio quality.

How-Tos