Skip to content

Commit

Permalink
feat: add bluetooth profile
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Oct 6, 2023
1 parent 732f853 commit deb61c4
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/nixos/layouts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ in
# self.nixosProfiles.default.presets.boot
outputs.nixosModules.default.programs.git

# outputs.nixosModules.default.hardware.bluetooth
# load a suite profile from audio
# (outputs.nixosProfiles.default.audio {}).default

# # --custom profiles
outputs.nixosProfiles.customProfiles.presets.nix
outputs.nixosProfiles.customProfiles.presets.boot
Expand Down
5 changes: 5 additions & 0 deletions nixos/nixosModules/hardware/bluetooth.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
options.__profiles__ = with lib; {
desktop = mkEnableOption (lib.mdDoc "Whether to enable desktop profile");
};
}
9 changes: 9 additions & 0 deletions nixos/nixosProfiles/audio.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
let
inherit (root) presets;
in
{
default = [
pipewire
bluetooth
];
}
28 changes: 28 additions & 0 deletions nixos/nixosProfiles/presets/bluetooth.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
imports = [ omnibus.nixosModules.hardware.bluetooth ];

services.blueman.enable = true;

environment.systemPackages =
with pkgs;
(lib.optionals config.hardware.bluetooth.__profiles__.desktop [
lxqt.pavucontrol-qt
]);

hardware.bluetooth = {
package = pkgs.bluez5-experimental;
enable = true;
powerOnBoot = true;
};

environment = lib.mkIf config.hardware.bluetooth.enable {
etc."wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = ''
bluez_monitor.properties = {
["bluez5.enable-sbc-xq"] = true,
["bluez5.enable-msbc"] = true,
["bluez5.enable-hw-volume"] = true,
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
}
'';
};
}
10 changes: 10 additions & 0 deletions nixos/nixosProfiles/presets/pipewire.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
security.rtkit.enable = lib.mkDefault config.services.pipewire.enable;
services.pipewire = {
enable = true;
alsa.enable = true;
wireplumber.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
}

0 comments on commit deb61c4

Please sign in to comment.