-
-
Save Mic92/c62a47b0cf57c711b728196b09491b81 to your computer and use it in GitHub Desktop.
This file contains 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
# $ nix-build minimal-vm.nix | |
# $ cp ./result/nixos.qcow2 . && chmod +w nixos.qcow2 | |
# $ qemu-system-x86_64 -s -S \ | |
# -kernel arch/x86/boot/bzImage \ | |
# -hda nixos.qcow2 \ | |
# -append "root=/dev/sda console=ttyS0 nokalsr" \ | |
# -nographic -enable-kvm | |
{ pkgs ? import <nixpkgs> {} }: | |
import (pkgs.path + "/nixos/lib/make-disk-image.nix") { | |
inherit pkgs; | |
inherit (pkgs) lib; | |
config = (import (pkgs.path + "/nixos/lib/eval-config.nix") { | |
inherit (pkgs) system; | |
modules = [{ | |
imports = [ | |
(pkgs.path + "/nixos/modules/profiles/qemu-guest.nix") | |
]; | |
boot.loader.grub.enable = false; | |
boot.initrd.enable = false; | |
boot.isContainer = true; | |
boot.loader.initScript.enable = true; | |
# login with empty password | |
users.extraUsers.root.initialHashedPassword = ""; | |
services.mingetty.helpLine = '' | |
Log in as "root" with an empty password. | |
If you are connect via serial console: | |
Type Ctrl-a c to switch to the qemu console | |
and `quit` to stop the VM. | |
''; | |
documentation.doc.enable = false; | |
}]; | |
}).config; | |
partitionTableType = "none"; | |
diskSize = 8192; | |
format = "qcow2"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment