1
0
Fork 0
nix-configuration/modules/nixos/system/bluetooth/default.nix

45 lines
1,018 B
Nix
Raw Normal View History

# Configures bluetooth.
{
lib,
config,
pkgs,
2024-12-06 18:04:47 +00:00
namespace,
...
}:
2024-02-29 14:53:34 +00:00
let
2024-12-06 18:04:47 +00:00
cfg = config.${namespace}.bluetooth;
2024-02-29 14:53:34 +00:00
in
{
options = {
2024-12-06 18:04:47 +00:00
${namespace}.bluetooth = {
2024-09-08 15:58:56 +00:00
enable = lib.mkEnableOption "Enables bluetooth.";
2024-10-18 20:14:33 +00:00
experimental.enable = lib.mkEnableOption "Enables experimental features, like device power reporting.";
};
};
2024-02-29 14:53:34 +00:00
config = lib.mkIf cfg.enable {
# Set up Bluetooth
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
2024-10-18 20:14:33 +00:00
settings = lib.mkIf cfg.experimental.enable {
General = {
Enable = "Source,Sink,Media,Socket";
Experimental = true;
KernelExperimental = true;
2024-12-16 20:13:32 +00:00
# Additional options based on:
# https://www.reddit.com/r/NixOS/comments/1hdsfz0/what_do_i_have_to_do_to_make_my_xbox_controller/
JustWorksRepairing = "always";
FastConnectable = true;
};
};
};
2024-02-29 14:53:34 +00:00
# Add Bluetooth LE audio support
environment.systemPackages = with pkgs; [ liblc3 ];
};
}