diff --git a/flake.nix b/flake.nix index 60a0531..bc15fa1 100644 --- a/flake.nix +++ b/flake.nix @@ -98,14 +98,25 @@ runtimeInputs = [ pkgs.qemu_kvm ]; - # -snapshot \ text = '' set -ex + state="/tmp/qemu-$USER" + mkdir -p "$state" + chmod 700 "$state" qemu-system-x86_64 \ - -smp 4 -m 4096 -machine q35,accel=kvm \ - -bios ${pkgs.OVMF.fd}/FV/OVMF.fd \ + -cpu host \ + -machine q35,accel=kvm \ + -m 4G \ + -smp 8 \ -display none \ - -serial stdio "$@" + -chardev "stdio,id=char0,mux=on,logfile=$state/serial.log,signal=off" \ + -serial chardev:char0 \ + -mon chardev=char0 \ + -drive "if=pflash,format=raw,unit=0,readonly=on,file=${pkgs.OVMF.firmware}" \ + -drive "if=pflash,format=raw,unit=1,readonly=on,file=${pkgs.OVMF.variables}" \ + -netdev id=net00,type=user,hostfwd=tcp::2222-:22 \ + -device virtio-net-pci,netdev=net00 \ + "$@" ''; }; };