Commit 59f7dda2598f
Changed files (1)
systems
modules
hardware
systems/modules/hardware/bluetooth.nix
@@ -1,7 +1,8 @@
{ config, lib, pkgs, ... }:
let
- inherit (lib) mkEnableOption mkIf mkMerge;
+ inherit (lib) mkEnableOption mkIf mkMerge versionOlder;
cfg = config.modules.hardware.bluetooth;
+ stable = versionOlder config.system.nixos.release "21.05";
in
{
options.modules.hardware.bluetooth = {
@@ -9,7 +10,10 @@ in
};
config = mkIf cfg.enable (mkMerge [
- { hardware.bluetooth.enable = true; }
+ {
+ hardware.bluetooth.enable = true;
+ # warnings = if stable then [ ] else [ "NixOS release: ${config.system.nixos.release}" ];
+ }
(mkIf config.modules.hardware.audio.enable {
hardware.pulseaudio = {
# NixOS allows either a lightweight build (default) or full build of
@@ -19,11 +23,20 @@ in
# Enable additional codecs
extraModules = [ pkgs.pulseaudio-modules-bt ];
};
-
+ })
+ (mkIf (stable && config.modules.hardware.audio.enable) {
hardware.bluetooth.extraConfig = ''
[General]
Enable=Source,Sink,Media,Socket
'';
})
+ (mkIf ((!stable) && config.modules.hardware.audio.enable)
+ {
+ hardware.bluetooth.settings = {
+ General = {
+ Enable = "Source,Sink,Media,Socket";
+ };
+ };
+ })
]);
}