QEMU: Difference between revisions

From NixOS Wiki
imported>Rti
No edit summary
imported>Mkg20001
m Fix formatting
Line 2: Line 2:


== Install ==
== Install ==
environment = {
<syntaxhighlight lang=nix>
  environment = {
     systemPackages = [ pkgs.qemu ];
     systemPackages = [ pkgs.qemu ];
   };
   };
</syntaxhighlight>


== Booting UEFI ==
== Booting UEFI ==
Line 10: Line 12:


The following installs a script, that always starts QEMU with OVMF firmware implementing UEFI support.
The following installs a script, that always starts QEMU with OVMF firmware implementing UEFI support.
<syntaxhighlight lang=nix>
  environment = {
  environment = {
   (pkgs.writeShellScriptBin "qemu-system-x86_64-uefi" ''
   (pkgs.writeShellScriptBin "qemu-system-x86_64-uefi" ''
Line 17: Line 21:
   '')
   '')
  };
  };
</syntaxhighlight>

Revision as of 23:39, 13 January 2024

A generic and open source machine emulator and virtualizer

Install

  environment = {
    systemPackages = [ pkgs.qemu ];
  };

Booting UEFI

To boot UEFI systems using QEMU, the UEFI firmware replacing the BIOS implementation needs to be provided while starting QEMU.

The following installs a script, that always starts QEMU with OVMF firmware implementing UEFI support.

 environment = {
   (pkgs.writeShellScriptBin "qemu-system-x86_64-uefi" ''
     qemu-system-x86_64 \
       -bios ${pkgs.OVMF.fd}/FV/OVMF.fd \
       "$@"
   '')
 };