Created
September 15, 2020 16:45
-
-
Save theduke/4d19eda2b2f3de9161de9317ded2ffe7 to your computer and use it in GitHub Desktop.
Nix VM qcow2
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
{ config, lib, pkgs, ... }: | |
{ | |
imports = | |
[ | |
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix> | |
]; | |
system.build.qcow2 = import <nixpkgs/nixos/lib/make-disk-image.nix> { | |
pkgs = import <nixpkgs> { inherit (pkgs) system; }; # ensure we use the regular qemu-kvm package | |
diskSize = 8192; | |
format = "qcow2"; | |
configFile = pkgs.writeText "configuration.nix" | |
'' | |
{ pkgs, lib, ... }: | |
{ | |
imports = [ | |
<nixpkgs/nixos/modules/profiles/qemu-guest.nix> | |
]; | |
config = { | |
fileSystems."/" = { | |
device = "/dev/disk/by-label/nixos"; | |
fsType = "ext4"; | |
autoResize = true; | |
}; | |
boot.growPartition = true; | |
boot.kernelParams = [ "console=ttyS0" ]; | |
boot.loader.grub.device = "/dev/sda"; | |
boot.loader.timeout = 0; | |
security.sudo.enable = false; | |
users.extraUsers.root.password = ""; | |
}; | |
} | |
''; | |
}; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment