Skip to content

Instantly share code, notes, and snippets.

@ibizaman
Created March 26, 2024 06:44
Show Gist options
  • Save ibizaman/525e1a00d3c3254f73527d22cbd74bdb to your computer and use it in GitHub Desktop.
Save ibizaman/525e1a00d3c3254f73527d22cbd74bdb to your computer and use it in GitHub Desktop.
installer-test = (nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
"${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix"
"${nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
({
config,
lib,
pkgs,
...
}: rec {
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.kernelModules = [ "kvm-intel" ];
boot.kernelParams = lib.mkIf (! virtualisation.graphics) [
"console=tty1"
"console=ttyS0,115200"
];
virtualisation = {
memorySize = 2048;
useDefaultFilesystems = false;
graphics = true;
# fileSystems."/" = {
# device = "/dev/vda1";
# fsType = "iso9660";
# };
fileSystems."/" = {
device = "none";
fsType = "tmpfs";
options = ["mode=0755"];
};
forwardPorts = [
{
from = "host";
host.port = 2222;
guest.port = 22;
}
];
qemu = {
drives = [
{
file = "${self.outputs.packages.x86_64-linux.installer}/iso/installer.iso";
driveExtraOpts = {
media = "cdrom";
format = "raw";
readonly = "on";
};
}
];
};
};
})
];
})
.config
.system
.build
.vm;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment