41 lines
866 B
Nix
41 lines
866 B
Nix
{
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
cfg = config.myConfig.qemu;
|
|
in {
|
|
options.myConfig.qemu = {
|
|
enable = lib.mkEnableOption "qemu";
|
|
kvm = lib.mkEnableOption "kvm for faster emulation of x86";
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
virtualisation.
|
|
libvirtd = {
|
|
enable = true;
|
|
qemu = {
|
|
package =
|
|
if cfg.kvm
|
|
then pkgs.qemu_kvm
|
|
else config.virtualisation.libvirtd.qemu.package;
|
|
runAsRoot = true;
|
|
swtpm.enable = true;
|
|
ovmf = {
|
|
enable = true;
|
|
packages = [
|
|
(pkgs.OVMF.override {
|
|
secureBoot = true;
|
|
tpmSupport = true;
|
|
})
|
|
.fd
|
|
];
|
|
};
|
|
};
|
|
};
|
|
boot.binfmt.emulatedSystems = ["aarch64-linux"];
|
|
users.users.${config.myConfig.user}.extraGroups = ["libvirtd"];
|
|
};
|
|
}
|