add vm for android build

This commit is contained in:
Dmitriy Kholkin 2023-07-08 02:17:40 +03:00
parent f2b81a1b99
commit 1c13225e98
2 changed files with 30 additions and 2 deletions

View File

@ -21,6 +21,22 @@
group = "libvirtd";
xmlFile = ./vm/win2k22.xml;
};
fedora-build = {
autoStart = false;
user = config.mainuser;
group = "libvirtd";
uefi = true;
memory = 32 * 1024;
sharedMemory = true;
cpu = { cores = 6; threads = 2; };
devices = {
disks = [
{ diskFile = "/media/libvirt/images/fedora-build.qcow2"; targetName = "vda"; }
{ diskFile = "/media/libvirt/images/android-zfs.qcow2"; targetName = "sda"; bus = "scsi"; }
];
network.macAddress = "52:54:00:f7:be:ef";
};
};
};
deviceSpecific.devInfo = {

View File

@ -16,6 +16,18 @@ let
type = types.enum [ "raw" "qcow2" ];
default = "qcow2";
};
targetName = mkOption {
type = types.str;
default = "vda";
};
discard = mkOption {
type = types.enum [ "ignore" "unmap" ];
default = "unmap";
};
cache = mkOption {
type = types.enum [ "none" "writethrough" "writeback" "directsync" "unsafe" ];
default = "writeback";
};
};
mountOptions.options = {
sourceDir = mkOption {
@ -294,9 +306,9 @@ in {
${
lib.concatStrings (map (disk: ''
<disk type="file" device="disk">
<driver name="qemu" type="${disk.type}" discard="unmap"/>
<driver name="qemu" type="${disk.type}" cache="${disk.cache}" discard="${disk.discard}"/>
<source file="${disk.diskFile}"/>
<target dev="vda" bus="${disk.bus}"/>
<target dev="${disk.targetName}" bus="${disk.bus}"/>
</disk>
'') guest.devices.disks)
}