From 168134bcf3e04a27a3bd7b654820bbe440beebfd Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Sun, 18 Jun 2023 06:44:58 -0400 Subject: [PATCH] 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 --- src/main.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.nix b/src/main.nix index bae638fa..462935aa 100644 --- a/src/main.nix +++ b/src/main.nix @@ -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";