Skip to content

Commit 453d705

Browse files
Add option to pass cpu-config to firecracker
1 parent bde4522 commit 453d705

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/runners/firecracker.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ let
1111
interfaces volumes shares devices
1212
kernel initrdPath
1313
storeDisk;
14+
inherit (microvmConfig.firecracker) cpu;
1415

1516
kernelPath = {
1617
x86_64-linux = "${kernel.dev}/vmlinux";
@@ -60,6 +61,8 @@ let
6061
else throw "Network interface type ${type} not implemented for Firecracker"
6162
) interfaces;
6263
vsock = null;
64+
} // lib.optionalAttrs (cpu != null) {
65+
cpu-config = pkgs.writeText "cpu-config.json" (builtins.toJSON cpu);
6366
};
6467

6568
configFile = pkgs.writers.writeJSON "firecracker-${hostName}.json" config;

nixos-modules/microvm/options.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,12 @@ in
533533
description = "A Hypervisor's sandbox directory";
534534
};
535535

536+
firecracker.cpu = mkOption {
537+
type = with types; nullOr attrs;
538+
default = null;
539+
description = "Custom CPU template passed to firecracker.";
540+
};
541+
536542
prettyProcnames = mkOption {
537543
type = types.bool;
538544
default = true;

0 commit comments

Comments
 (0)