nixfiles/modules/ezpw.nix
2021-12-23 05:42:08 -07:00

83 lines
2.5 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.ezpw;
in
{
options.services.ezpw = {
enable =
mkEnableOption
"Enable pipewire";
};
config = mkIf cfg.enable {
hardware.pulseaudio.enable = lib.mkDefault false;
sound.enable = lib.mkDefault false;
services.pipewire = {
enable = lib.mkDefault true;
jack.enable = lib.mkDefault true;
alsa.enable = lib.mkDefault true;
alsa.support32Bit = lib.mkDefault true;
pulse.enable = lib.mkDefault true;
config.pipewire-pulse = {
"context.modules" = [
{
"args" = { };
"flags" = [ "ifexists" "nofail" ];
"name" = "libpipewire-module-rtkit";
}
{ "name" = "libpipewire-module-protocol-native"; }
{ "name" = "libpipewire-module-client-node"; }
{ "name" = "libpipewire-module-adapter"; }
{ "name" = "libpipewire-module-metadata"; }
{
"args" = {
"server.address" = [ "unix:native" "tcp:4713" ];
"vm.overrides" = { "pulse.min.quantum" = "1024/48000"; };
};
"name" = "libpipewire-module-protocol-pulse";
}
];
"context.properties" = { };
"context.spa-libs" = {
"audio.convert.*" = "audioconvert/libspa-audioconvert";
"support.*" = "support/libspa-support";
};
"stream.properties" = { };
};
media-session.config.bluez-monitor = {
properties = {
"bluez5.codecs" = [ "sbc" "aac" "ldac" "aptx" "aptx_hd" ];
"bluez5.mdbc-support" = true;
};
rules = [
{
actions = {
update-props = {
"bluez5.auto-connect" = [ "hsp_hs" "hfp_hf" "a2dp_sink" ];
"bluez5.hw-volume" =
[ "hsp_ag" "hfp_ag" "a2dp_source" "a2dp_sink" ];
"bluez5.autoswitch-profile" = true;
};
};
matches = [{ "device.name" = "~bluez_card.*"; }];
}
{
actions = { update-props = { "node.pause-on-idle" = false; }; };
matches = [
{ "node.name" = "~bluez_input.*"; }
{ "node.name" = "~bluez_output.*"; }
];
}
];
};
};
xdg.portal.enable = lib.mkDefault true;
xdg.portal.gtkUsePortal = lib.mkDefault true;
xdg.portal.extraPortals = lib.mkDefault (with pkgs; [ xdg-desktop-portal-wlr xdg-desktop-portal-gtk ]);
};
}