helm/modules/hardware/bluetooth.nix
Henrik Lissner a75c64d04a
Rewrite to use flakes
This puts a hard dependency on 20.09, but that's to be expected.
2020-10-11 01:31:33 -04:00

33 lines
845 B
Nix

{ options, config, lib, pkgs, ... }:
with lib;
with lib.my;
let hwCfg = config.modules.hardware;
cfg = hwCfg.bluetooth;
in {
options.modules.hardware.bluetooth = {
enable = mkBoolOpt false;
audio.enable = mkBoolOpt false;
};
config = mkIf cfg.enable (mkMerge [
{ hardware.bluetooth.enable = true; }
(mkIf cfg.audio.enable {
hardware.pulseaudio = {
# NixOS allows either a lightweight build (default) or full build of
# PulseAudio to be installed. Only the full build has Bluetooth
# support, so it must be selected here.
package = pkgs.pulseaudioFull;
# Enable additional codecs
extraModules = [ pkgs.pulseaudio-modules-bt ];
};
hardware.bluetooth.extraConfig = ''
[General]
Enable=Source,Sink,Media,Socket
'';
})
]);
}