nix-config/modules/bluetooth.nix

39 lines
962 B
Nix
Raw Normal View History

2021-05-05 12:47:04 +02:00
{ config, lib, pkgs, ... }:
let
cfg = config.my.modules.bluetooth;
in
{
options.my.modules.bluetooth = with lib; {
2021-05-09 11:40:37 +02:00
enable = mkEnableOption "bluetooth configuration";
2021-05-05 12:47:04 +02:00
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";
};
};
})
]);
}