Created
May 10, 2025 10:03
-
-
Save aaronedev/80b5ecdab50a8caf0c6d81922a981f3f to your computer and use it in GitHub Desktop.
qemu run nixos + use kvm libguestfs video accelaration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# ╔══════════════════════╗ | |
# ║ ░█▀█░▀█▀░█░█░█▀█░█▀▀ ║ | |
# ║ ░█░█░░█░░▄▀▄░█░█░▀▀█ ║ | |
# ║ ░▀░▀░▀▀▀░▀░▀░▀▀▀░▀▀▀ ║ | |
# ╚══════════════════════╝ | |
# author: https://github.com/aaronedev | |
# date: 2025-05-10 | |
ISO=nixos-24.05-x86_64-linux.iso | |
IMG=nixos-24-05.qcow2 | |
if [ ! -f "$ISO" ]; then | |
wget https://channels.nixos.org/nixos-24.05/latest-nixos-gnome-x86_64-linux.iso -O $ISO | |
fi | |
if [ ! -f "$IMG" ]; then | |
qemu-img create -f qcow2 $IMG 16G | |
fi | |
qemu-system-x86_64 \ | |
-enable-kvm \ | |
-M q35 \ | |
-smp 4 \ | |
-m 4G \ | |
-cpu host \ | |
-net nic,model=virtio \ | |
-net user,hostfwd=tcp::2222-:22 \ | |
-device virtio-vga-gl,hostmem=4G,blob=true,venus=true \ | |
-vga none \ | |
-display gtk,gl=on,show-cursor=on \ | |
-usb -device usb-tablet \ | |
-object memory-backend-memfd,id=mem1,size=4G \ | |
-machine memory-backend=mem1 \ | |
-hda $IMG \ | |
-cdrom $ISO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment