modules: add bluetooth

This commit is contained in:
Bruno BELANYI 2021-05-05 12:47:04 +02:00
parent 4319105aa5
commit 35b8de02c2
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