modules: add bluetooth

This commit is contained in:
Bruno BELANYI 2021-05-05 12:47:04 +02:00
parent 1022601602
commit b115d94cd6
2 changed files with 39 additions and 0 deletions

38
modules/bluetooth.nix Normal file
View file

@ -0,0 +1,38 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.modules.bluetooth;
in
{
options.my.modules.bluetooth = with lib; {
enable = mkEnableOption "wireless configuration";
enableHeadsetIntegration = my.mkDisableOption "A2DP sink configuration";
loadExtraCodecs = my.mkDisableOption "extra audio codecs";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
# Enable bluetooth devices and GUI to connect to them
{
hardware.bluetooth.enable = true;
services.blueman.enable = true;
}
# Support for additional bluetooth codecs
(lib.mkIf cfg.loadExtraCodecs {
hardware.pulseaudio = {
extraModules = [ pkgs.pulseaudio-modules-bt ];
package = pkgs.pulseaudioFull;
};
})
# Support for A2DP audio profile
(lib.mkIf cfg.enableHeadsetIntegration {
hardware.bluetooth.settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
})
]);
}

View file

@ -3,6 +3,7 @@
{
imports = [
./bluetooth.nix
./documentation.nix
./ergodox.nix
./home.nix