aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/hardware/bluetooth/default.nix64
-rw-r--r--modules/hardware/default.nix2
-rw-r--r--profiles/bluetooth/default.nix9
-rw-r--r--profiles/default.nix5
4 files changed, 78 insertions, 2 deletions
diff --git a/modules/hardware/bluetooth/default.nix b/modules/hardware/bluetooth/default.nix
new file mode 100644
index 0000000..cfb9a25
--- /dev/null
+++ b/modules/hardware/bluetooth/default.nix
@@ -0,0 +1,64 @@
+{ config, lib, pkgs, ... }:
+let cfg = config.my.hardware.bluetooth;
+in {
+ options.my.hardware.bluetooth = with lib; {
+ enable = mkEnableOption "bluetooth configuration";
+ };
+
+ config = lib.mkIf cfg.enable {
+ hardware.bluetooth.enable = true;
+ services.blueman.enable = true;
+
+ hardware.pulseaudio = {
+ extraModules = [ pkgs.pulseaudio-modules-bt ];
+ package = pkgs.pulseaudioFull;
+ };
+
+ environment.etc = {
+ "wireplumber/bluetooth.lua.d/50-bluez-config.lua".text = ''
+ bluez_monitor.properties = {
+ ["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
+ -- mSBC provides better audio + microphone
+ ["bluez5.enable-msbc"] = true,
+ -- SBC XQ provides better audio
+ ["bluez5.enable-sbc-xq"] = true,
+ -- Hardware volume control
+ ["bluez5.enable-hw-volume"] = true,
+ }
+ '';
+ };
+
+ services.pipewire = {
+ media-session.config.bluez-monitor.rules = [
+ {
+ # Matches all cards
+ matches = [{ "device.name" = "~bluez_card.*"; }];
+ actions = {
+ "update-props" = {
+ "bluez5.reconnect-profiles" = [ "hfp_hf" "hsp_hs" "a2dp_sink" ];
+ # mSBC provides better audio + microphone
+ "bluez5.msbc-support" = true;
+ # SBC XQ provides better audio
+ "bluez5.sbc-xq-support" = true;
+ };
+ };
+ }
+ {
+ matches = [
+ # Matches all sources
+ {
+ "node.name" = "~bluez_input.*";
+ }
+ # Matches all outputs
+ { "node.name" = "~bluez_output.*"; }
+ ];
+ actions = { "node.pause-on-idle" = false; };
+ }
+ ];
+ };
+
+ hardware.bluetooth.settings = {
+ General = { Enable = "Source,Sink,Media,Socket"; };
+ };
+ };
+}
diff --git a/modules/hardware/default.nix b/modules/hardware/default.nix
index 843c1f5..21e4713 100644
--- a/modules/hardware/default.nix
+++ b/modules/hardware/default.nix
@@ -1,5 +1,5 @@
{ ... }:
{
- imports = [ ./amd ./intel ./ssd ./sound ./networking ];
+ imports = [ ./amd ./bluetooth ./intel ./ssd ./sound ./networking ];
}
diff --git a/profiles/bluetooth/default.nix b/profiles/bluetooth/default.nix
new file mode 100644
index 0000000..ffd05b4
--- /dev/null
+++ b/profiles/bluetooth/default.nix
@@ -0,0 +1,9 @@
+{ config, lib, ... }:
+let cfg = config.my.profiles.bluetooth;
+in {
+ options.my.profiles.bluetooth = with lib; {
+ enable = mkEnableOption "bluetooth profile";
+ };
+
+ config = lib.mkIf cfg.enable { my.hardware.bluetooth.enable = true; };
+}
diff --git a/profiles/default.nix b/profiles/default.nix
index 9c0d2f9..d683b58 100644
--- a/profiles/default.nix
+++ b/profiles/default.nix
@@ -1 +1,4 @@
-{ ... }: { imports = [ ./laptop ./gtk ./trusted ./wm ./desktop ./multimedia ]; }
+{ ... }: {
+ imports =
+ [ ./bluetooth ./laptop ./gtk ./trusted ./wm ./desktop ./multimedia ];
+}