fix pipewire stuff

This commit is contained in:
notgne2 2024-03-12 06:30:49 -07:00
parent 7d954a61ef
commit baf94ae575
Signed by: notgne2
SSH Key Fingerprint: SHA256:qlFCAimT/PvNIG3u+aYT9pIqFCWgu6sNsWjpV1vHLIE
4 changed files with 83 additions and 44 deletions

View File

@ -59,6 +59,8 @@ inputs: all: {
iotop iotop
htop htop
corefonts
]; ];
programs.starship = { programs.starship = {

View File

@ -207,24 +207,26 @@ in {
"org/gnome/shell" = { "org/gnome/shell" = {
disable-user-extensions = false; disable-user-extensions = false;
disabled-extensions = [""]; disabled-extensions = [""];
enabled-extensions = [ enabled-extensions =
"rrc@ogarcia.me" [
"native-window-placement@gnome-shell-extensions.gcampax.github.com" "rrc@ogarcia.me"
"user-theme@gnome-shell-extensions.gcampax.github.com" "native-window-placement@gnome-shell-extensions.gcampax.github.com"
"improved-workspace-indicator@michaelaquilina.github.io" "user-theme@gnome-shell-extensions.gcampax.github.com"
"Vitals@CoreCoding.com" "improved-workspace-indicator@michaelaquilina.github.io"
"clipboard-indicator@tudmotu.com" "Vitals@CoreCoding.com"
"just-perfection-desktop@just-perfection" "clipboard-indicator@tudmotu.com"
"appindicatorsupport@rgcjonas.gmail.com" "just-perfection-desktop@just-perfection"
"launch-new-instance@gnome-shell-extensions.gcampax.github.com" "appindicatorsupport@rgcjonas.gmail.com"
"unite@hardpixel.eu" "launch-new-instance@gnome-shell-extensions.gcampax.github.com"
"gamemode@christian.kellner.me" "unite@hardpixel.eu"
# "compiz-windows-effect@hermes83.github.com" "gamemode@christian.kellner.me"
"bluetooth-quick-connect@bjarosze.gmail.com" # "compiz-windows-effect@hermes83.github.com"
"gsconnect@andyholmes.github.io" "bluetooth-quick-connect@bjarosze.gmail.com"
# "desktop-cube@schneegans.github.com" "gsconnect@andyholmes.github.io"
"sound-output-device-chooser@kgshank.net" # "desktop-cube@schneegans.github.com"
] ++ (lib.optional cfg.tiling "forge@jmmaranan.com"); "sound-output-device-chooser@kgshank.net"
]
++ (lib.optional cfg.tiling "forge@jmmaranan.com");
}; };
"org/gnome/desktop/peripherals/touchpad" = { "org/gnome/desktop/peripherals/touchpad" = {
natural-scroll = false; natural-scroll = false;

View File

@ -38,7 +38,7 @@ in {
quantum = mkOption { quantum = mkOption {
type = types.int; type = types.int;
description = "Pipewire quantum in low latency mode"; description = "Pipewire quantum in low latency mode";
default = 64; default = 32;
}; };
}; };
@ -64,31 +64,62 @@ in {
pulseaudio pulseaudio
]; ];
environment.etc."wireplumber/main.lua.d/51-alsa-config.lua" = mkIf cfg.lowLatency { services.pipewire.extraConfig.pipewire."92-low-latency" = mkIf cfg.lowLatency {
text = '' context.properties = {
alsa_monitor.properties = { default.clock.rate = cfg.rate;
["audio.rate"] = ${ default.clock.quantum = cfg.quantum;
toString (cfg.rate default.clock.min-quantum = cfg.quantum;
* ( default.clock.max-quantum = cfg.quantum;
if cfg.usbSoundcard };
then 2
else 1
))
},
["audio.format"] = "S32LE",
["api.alsa.headroom"] = 512,
["api.alsa.period-size"] = ${toString cfg.periodSize}
}
'';
}; };
environment.etc."wireplumber/bluetooth.lua.d/51-bluez-config.lua".text = '' services.pipewire.extraConfig.pipewire-pulse."92-low-latency" = mkIf cfg.lowLatency {
bluez_monitor.properties = { context.modules = [
["bluez5.enable-sbc-xq"] = true, {
["bluez5.enable-msbc"] = true, name = "libpipewire-module-protocol-pulse";
["bluez5.enable-hw-volume"] = true, args = {
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]" pulse.min.req = qr;
} pulse.default.req = qr;
''; pulse.max.req = qr;
pulse.min.quantum = qr;
pulse.max.quantum = qr;
};
}
];
stream.properties = {
node.latency = qr;
resample.quality = 1;
};
};
services.pipewire.wireplumber.configPackages =
[
(pkgs.writeTextDir "share/wireplumber/bluetooth.lua.d/51-bluez-config.lua" ''
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 ]"
}
'')
]
++ optional cfg.lowLatency (pkgs.writeTextDir "share/wireplumber/main.lua.d/99-alsa-lowlatency.lua" ''
alsa_monitor.rules = {
{
matches = {{{ "node.name", "matches", "alsa_output.*" }}};
apply_properties = {
["audio.format"] = "S32LE",
["audio.rate"] = "${toString (cfg.rate
* (
if cfg.usbSoundcard
then 2
else 1
))}", -- for USB soundcards it should be twice your desired rate
["api.alsa.period-size"] = ${toString cfg.periodSize}, -- defaults to 1024, tweak by trial-and-error
-- ["api.alsa.disable-batch"] = true, -- generally, USB soundcards use the batch mode
},
},
}
'');
}; };
} }

View File

@ -36,7 +36,11 @@ in {
}; };
boot = { boot = {
consoleLogLevel = lib.mkDefault (if cfg.fancyBoot then 0 else 3); consoleLogLevel = lib.mkDefault (
if cfg.fancyBoot
then 0
else 3
);
initrd.verbose = lib.mkDefault (!cfg.fancyBoot); initrd.verbose = lib.mkDefault (!cfg.fancyBoot);
plymouth.enable = lib.mkDefault cfg.fancyBoot; plymouth.enable = lib.mkDefault cfg.fancyBoot;
kernelParams = lib.mkIf cfg.fancyBoot [ kernelParams = lib.mkIf cfg.fancyBoot [