diff --git a/examples/nixos/layouts.nix b/examples/nixos/layouts.nix index a80fcb7..61d9b55 100644 --- a/examples/nixos/layouts.nix +++ b/examples/nixos/layouts.nix @@ -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 diff --git a/nixos/nixosModules/hardware/bluetooth.nix b/nixos/nixosModules/hardware/bluetooth.nix new file mode 100644 index 0000000..32064d0 --- /dev/null +++ b/nixos/nixosModules/hardware/bluetooth.nix @@ -0,0 +1,5 @@ +{ + options.__profiles__ = with lib; { + desktop = mkEnableOption (lib.mdDoc "Whether to enable desktop profile"); + }; +} diff --git a/nixos/nixosProfiles/audio.nix b/nixos/nixosProfiles/audio.nix new file mode 100644 index 0000000..ddb2bb5 --- /dev/null +++ b/nixos/nixosProfiles/audio.nix @@ -0,0 +1,9 @@ +let + inherit (root) presets; +in +{ + default = [ + pipewire + bluetooth + ]; +} diff --git a/nixos/nixosProfiles/presets/bluetooth.nix b/nixos/nixosProfiles/presets/bluetooth.nix new file mode 100644 index 0000000..f0e8f81 --- /dev/null +++ b/nixos/nixosProfiles/presets/bluetooth.nix @@ -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 ]" + } + ''; + }; +} diff --git a/nixos/nixosProfiles/presets/pipewire.nix b/nixos/nixosProfiles/presets/pipewire.nix new file mode 100644 index 0000000..e7c0f9b --- /dev/null +++ b/nixos/nixosProfiles/presets/pipewire.nix @@ -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; + }; +}