nixos/qemu-vm: virtiofsd requires shared memory

We recently switched to virtiofs for qemu-vms run on Linux
(https://github.com/NixOS/nixpkgs/pull/552774). I suspect we
only tested it with nixos tests, which just [happen to enable shared memory](673028b7b1/nixos/lib/testing/driver.nix (L259))
for the ssh backdoor. However, for folks using qemu-vm.nix outside of nixos
tests, they'll experience virtiofsd crashing with [some very obtuse
messages](https://gitlab.com/virtio-fs/virtiofsd/-/work_items/127).

Reported by @fricklerhandwerk in
<https://github.com/NixOS/nixpkgs/pull/552774#issuecomment-5668027063>.
This commit is contained in:
Jeremy Fleischman
2026-09-14 15:26:22 -05:00
parent 32d7e0aa87
commit 0390e69d8d

View File

@@ -741,7 +741,11 @@ in
};
virtualisation.qemu = {
enableSharedMemory = mkEnableOption "shared memory";
enableSharedMemory = mkOption {
type = types.bool;
default = useVirtiofs; # Need shared memory for virtiofs: <https://www.qemu.org/docs/master/system/devices/virtio/vhost-user.html#shared-memory-object>
description = "Enable shared memory";
};
package = mkOption {
type = types.package;