diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix index 33bd759a1e3f..0a2646a3364e 100644 --- a/nixos/modules/virtualisation/qemu-vm.nix +++ b/nixos/modules/virtualisation/qemu-vm.nix @@ -716,6 +716,8 @@ in }; virtualisation.qemu = { + enableSharedMemory = mkEnableOption "shared memory"; + package = mkOption { type = types.package; default = @@ -1338,6 +1340,10 @@ in "-device usb-kbd" "-device usb-tablet" ]) + (mkIf cfg.qemu.enableSharedMemory [ + "-object memory-backend-memfd,id=mem0,size=${toString config.virtualisation.memorySize}M,share=on" + "-machine memory-backend=mem0" + ]) ( let alphaNumericChars = lowerChars ++ upperChars ++ (map toString (range 0 9));