nixos: create 'modules/nixos' folder
Let's consolidate all modules under one path, so that NixOS, home-manager, and nix-darwin (if I ever end up using it down the line) would go under the same folder.
This commit is contained in:
parent
b52e56ed08
commit
c856933803
74 changed files with 1 additions and 1 deletions
56
modules/nixos/hardware/bluetooth/default.nix
Normal file
56
modules/nixos/hardware/bluetooth/default.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.my.hardware.bluetooth;
|
||||
in
|
||||
{
|
||||
options.my.hardware.bluetooth = with lib; {
|
||||
enable = mkEnableOption "bluetooth configuration";
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
environment.etc = {
|
||||
"wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
|
||||
bluez_monitor.properties = {
|
||||
-- SBC XQ provides better audio
|
||||
["bluez5.enable-sbc-xq"] = true,
|
||||
|
||||
-- mSBC provides better audio + microphone
|
||||
["bluez5.enable-msbc"] = true,
|
||||
|
||||
-- Synchronize volume with bluetooth device
|
||||
["bluez5.enable-hw-volume"] = true,
|
||||
|
||||
-- FIXME: Some devices may now support both hsp_ag and hfp_ag
|
||||
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
|
||||
}
|
||||
'';
|
||||
};
|
||||
})
|
||||
|
||||
# Support for A2DP audio profile
|
||||
(lib.mkIf cfg.enableHeadsetIntegration {
|
||||
hardware.bluetooth.settings = {
|
||||
General = {
|
||||
Enable = "Source,Sink,Media,Socket";
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue