This repository defines a simple (minimal) Linux VM built with Nix and ran via just commands with qemu.
- Nix-based build: the
image.nixcontains the definition of the guest. - Overlays: the directory containing this README is overlayed into the
/root/[here]in the guest using 9pfs. - Shared nix store: the host nix store is overlayed in the guest.
-
Enter dev shell with
nix develop -
Modify
nix/image.nixto fit your use case. Especially you may add packages inenvironment.systemPackages. To change the Linux version in the guest, adapt thekernelPackagesvariable in theflake.nixfile -
Build the image with
just vm-image-init -
Launch the VM with
just vm [nb_cpu] [size_mem]wherenb_cpuis the number of vcpus given to the VM andsize_memis the memory dedicated to the VM (can be any string valid for qemu: 1024, 2G, etc..) -
(Optional) To connect to the VM from another terminal, use
just ssh [command].