Files
sydnix/modules/nixos/qemu.nix
Madeleine Sydney 72dc7fd836 feat: Qemu
2025-03-27 13:53:58 -06:00

38 lines
823 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let cfg = config.sydnix.qemu;
in {
options.sydnix.qemu = {
enable = mkEnableOption "Qemu";
};
config = mkIf cfg.enable
(let
# Necessary for UEFI boot with libvirt.
qemu-uefi = pkgs.writeShellScriptBin "qemu-system-x86_64-uefi" ''
qemu-system-x86_64 \
-bios ${pkgs.OVMF.fd}/FV/OVMF.fd \
"$@"
'';
in {
programs.virt-manager.enable = true;
environment.systemPackages = [
pkgs.virtiofsd
qemu-uefi
];
virtualisation.libvirtd = {
enable = true;
qemu.vhostUserPackages = [ pkgs.virtiofsd ];
};
# Hack to enable UEFI support.
systemd.tmpfiles.rules = [
"L+ /var/lib/qemu/firmware - - - - ${pkgs.qemu}/share/qemu/firmware"
];
});
}