qemu: Add audio support to virtual machines

This fixes an issue where virtual machines would previously use dummy
output. More specifically, pulseaudio is used since pipewire supports
it, and intel hd audio (hda) is used since it's generally regarded as
one of the better options based on information available online.

Note that -audio is used instead of the outdated -audiodev and -soundhw
options. This setup also avoids the choppy audio observed with other
solutions like alsa.

References:
- https://www.qemu.org/docs/master/system/qemu-manpage.html
- https://github.com/NixOS/nixpkgs/issues/175378
- https://superuser.com/questions/1337570
- https://en.wikipedia.org/wiki/Intel_High_Definition_Audio
- https://gitlab.com/qemu-project/qemu/-/issues/1519
- https://lists.nongnu.org/archive/html/qemu-discuss/2020-04/msg00089.html
This commit is contained in:
Donovan Glover 2023-06-18 06:44:58 -04:00
parent b2ff95f11b
commit 168134bcf3
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -236,7 +236,7 @@ let VARIABLES = import ./variables.nix; in {
cores = 4;
};
virtualisation.qemu.options = [ "-device virtio-vga-gl" "-display sdl,gl=on,show-cursor=off" "-full-screen" ];
virtualisation.qemu.options = [ "-device virtio-vga-gl" "-display sdl,gl=on,show-cursor=off" "-full-screen" "-audio pa,model=hda" ];
environment.sessionVariables = {
WLR_NO_HARDWARE_CURSORS = "1";