bluetooth.nix (882B)
1 { config, lib, pkgs, ... }: 2 let 3 inherit (lib) mkEnableOption mkIf mkMerge; 4 cfg = config.modules.hardware.bluetooth; 5 in 6 { 7 options.modules.hardware.bluetooth = { 8 enable = mkEnableOption "Enable bluetooth"; 9 }; 10 11 config = mkIf cfg.enable (mkMerge [ 12 { 13 hardware.bluetooth.enable = true; 14 # warnings = if stable then [ ] else [ "NixOS release: ${config.system.nixos.release}" ]; 15 } 16 (mkIf config.modules.hardware.audio.pulseaudio.enable { 17 hardware.pulseaudio = { 18 # NixOS allows either a lightweight build (default) or full build of 19 # PulseAudio to be installed. Only the full build has Bluetooth 20 # support, so it must be selected here. 21 package = pkgs.pulseaudioFull; 22 }; 23 hardware.bluetooth.settings = { 24 General = { 25 Enable = "Source,Sink,Media,Socket"; 26 }; 27 }; 28 }) 29 ]); 30 }