From 7ba4251b621c24ed238654fc47f858bc0cbf168d Mon Sep 17 00:00:00 2001 From: ifurther <55025025+ifurther@users.noreply.github.com> Date: Thu, 27 Jun 2024 20:48:31 +0800 Subject: [PATCH] update qemu arg --- nixos.pkr.hcl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nixos.pkr.hcl b/nixos.pkr.hcl index f821d97..18241f6 100644 --- a/nixos.pkr.hcl +++ b/nixos.pkr.hcl @@ -129,7 +129,11 @@ source "qemu" "qemu" { http_directory = "scripts" iso_checksum = var.iso_checksum iso_url = local.iso_url - qemuargs = [["-m", var.memory]] + qemuargs = [ + ["-m", var.memory], + [ "-netdev", "user,hostfwd=tcp::{{ .SSHHostPort }}-:22,id=forward"], + [ "-device", "virtio-net,netdev=forward,id=net0"] + ] shutdown_command = "sudo shutdown -h now" ssh_port = 22 ssh_private_key_file = "./scripts/install_ed25519" @@ -150,7 +154,11 @@ source "qemu" "qemu-efi" { http_directory = "scripts" iso_checksum = var.iso_checksum iso_url = local.iso_url - qemuargs = [["-m", var.memory]] + qemuargs = [ + ["-m", var.memory], + [ "-netdev", "user,hostfwd=tcp::{{ .SSHHostPort }}-:22,id=forward"], + [ "-device", "virtio-net,netdev=forward,id=net0"] + ] shutdown_command = "sudo shutdown -h now" machine_type = "q35" ssh_port = 22