waifud/templates/base.xml

88 lines
2.6 KiB
XML

<domain type="kvm" xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
<name>{{.Name}}</name>
<uuid>{{.UUID}}</uuid>
<metadata>
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
<libosinfo:os id="http://nixos.org/nixos/unstable"/>
</libosinfo:libosinfo>
</metadata>
<memory>{{.Memory}}</memory>
<currentMemory>{{.Memory}}</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch="x86_64" machine="q35">hvm</type>
<boot dev="hd"/>
</os>
<features>
<acpi/>
<apic/>
<vmport state="off"/>
</features>
<cpu mode="host-model"/>
<clock offset="utc">
<timer name="rtc" tickpolicy="catchup"/>
<timer name="pit" tickpolicy="delay"/>
<timer name="hpet" present="no"/>
</clock>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<pm>
<suspend-to-mem enabled="no"/>
<suspend-to-disk enabled="no"/>
</pm>
<devices>
<emulator>/run/libvirt/nix-emulators/qemu-system-x86_64</emulator>
<disk type="block" device="disk">
<driver name="qemu" type="raw" cache="none" io="native"/>
<source dev="/dev/zvol/{{.ZVol}}"/>
{{if .SATA}}
<target dev="sda" bus="sata"/>
{{else}}
<target dev="vda" bus="virtio"/>
{{end}}
</disk>
<disk type="file" device="cdrom">
<driver name="qemu" type="raw"/>
<source file="{{.Seed}}"/>
<target dev="sdb" bus="sata"/>
<readonly/>
</disk>
<controller type="usb" model="qemu-xhci" ports="15"/>
<interface type="network">
<source network="default"/>
<mac address="{{.MACAddress}}"/>
{{if .SATA}}
<model type="e1000e"/>
<address type="pci" domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
{{else}}
<model type="virtio"/>
{{end}}
</interface>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
<input type="tablet" bus="usb"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
<sound model="ich9"/>
<video>
<model type="qxl"/>
</video>
<redirdev bus="usb" type="spicevmc"/>
<redirdev bus="usb" type="spicevmc"/>
<memballoon model="virtio"/>
<rng model="virtio">
<backend model="random">/dev/urandom</backend>
</rng>
</devices>
<qemu:commandline>
<qemu:arg value="-smbios" />
<qemu:arg value="type=1,serial=ds=nocloud;h={{.Name}}" />
</qemu:commandline>
</domain>