I should commit more frequently 🫣

This commit is contained in:
Andrea Ciceri 2023-09-22 18:45:43 +02:00
parent d7e82621c8
commit f1483e45f0
Signed by: aciceri
SSH key fingerprint: SHA256:/AagBweyV4Hlfg9u092n8hbHwD5fcB6A3qhDiDA65Rg
70 changed files with 2344 additions and 599 deletions

View file

@ -0,0 +1,34 @@
{pkgs, ...}: {
virtualisation.libvirtd.enable = true;
networking.firewall.interfaces."wg0" = {
allowedTCPPorts = [
5900 # vnc by QEMU
2233
60022
8545
];
};
systemd.services.vm-ubuntu = let
start-vm = pkgs.writeShellApplication {
name = "start-vm";
runtimeInputs = with pkgs; [qemu];
text = ''
qemu-system-x86_64 \
-enable-kvm \
-cpu host,kvm=on,hv-vendor_id="GenuineIntel" \
-smp 4 \
-m 8192 \
-nic user,model=virtio-net-pci,hostfwd=tcp::60022-:22,hostfwd=tcp::8545-:8545 \
-drive file=/var/lib/vm-ubuntu/ubuntu.qcow2
'';
};
in {
wantedBy = ["multi-user.target"];
after = ["network.target"];
serviceConfig = {
ExecStart = "${start-vm}/bin/start-vm";
};
};
}