mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
32 lines
715 B
Nix
32 lines
715 B
Nix
{ callPackage
|
|
, firecracker
|
|
, writeShellScriptBin
|
|
, writeText
|
|
}:
|
|
|
|
let
|
|
kernel = callPackage ./kernel.nix { };
|
|
rootfs = callPackage ./rootfs.nix { };
|
|
|
|
vmconfig = writeText "vmconfig.json" (builtins.toJSON {
|
|
boot-source = {
|
|
kernel_image_path = "${kernel}/vmlinux";
|
|
boot_args = "panic=1 console=ttyS0 ro";
|
|
};
|
|
drives = [
|
|
{
|
|
drive_id = "rootfs";
|
|
path_on_host = rootfs;
|
|
is_root_device = true;
|
|
is_read_only = true;
|
|
}
|
|
];
|
|
machine-config.vcpu_count = 2;
|
|
machine-config.mem_size_mib = 1024;
|
|
network-interfaces = [ ];
|
|
});
|
|
|
|
in
|
|
writeShellScriptBin "firecracker-vm" ''
|
|
${firecracker}/bin/firecracker --no-api --config-file ${vmconfig}
|
|
''
|