2024-11-08 03:59:57 +00:00
|
|
|
{
|
|
|
|
callPackage,
|
|
|
|
firecracker,
|
|
|
|
writeShellApplication,
|
|
|
|
writeText,
|
2023-12-18 03:39:23 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
kernel = callPackage ./kernel.nix { };
|
|
|
|
rootfs = callPackage ./rootfs.nix { };
|
|
|
|
|
2024-11-08 03:59:57 +00:00
|
|
|
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 = [ ];
|
|
|
|
}
|
|
|
|
);
|
2023-12-18 03:39:23 +00:00
|
|
|
|
|
|
|
in
|
2024-07-24 00:10:09 +00:00
|
|
|
writeShellApplication {
|
|
|
|
name = "firecracker-vm";
|
|
|
|
text = "${firecracker}/bin/firecracker --no-api --config-file ${vmconfig}";
|
2024-11-08 03:59:57 +00:00
|
|
|
derivationArgs.passthru = {
|
|
|
|
inherit kernel rootfs;
|
|
|
|
};
|
2024-07-24 00:10:09 +00:00
|
|
|
}
|