diff options
Diffstat (limited to 'default.nix')
| -rw-r--r-- | default.nix | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/default.nix b/default.nix index 207588b..aa8a7e4 100644 --- a/default.nix +++ b/default.nix @@ -78,7 +78,7 @@ let boot-source = { kernel_image_path = "${kernel.dev}/vmlinux"; initrd_path = "${initialRamdisk}/${nixos.config.system.boot.loader.initrdFile}"; - boot_args = toString (nixos.config.boot.kernelParams ++ [ "init=${toplevel}/init" ]); + boot_args = toString (nixos.config.boot.kernelParams ++ [ "init=${toplevel}/init" "@TTY_SIZE@" ]); }; network-interfaces = [{ iface_id = "eth0"; @@ -123,6 +123,14 @@ pkgs.writeShellScriptBin "run-firecracker-vm" '' find "$cache" -type f ! -path "$img" -delete fi - sed "s|@STORE_IMAGE@|$img|" ${config} > "$tmp"/config.json + # Tell systemd the terminal size, so it doesn't query it via ANSI + # sequences (and wait up to 333ms for an answer) when starting the getty. + tty_size= + if size=$(stty size 2>/dev/null) && test "$size" != "0 0"; then + read -r rows cols <<< "$size" + tty_size="systemd.tty.rows.ttyS0=$rows systemd.tty.columns.ttyS0=$cols" + fi + + sed -e "s|@STORE_IMAGE@|$img|" -e "s|@TTY_SIZE@|$tty_size|" ${config} > "$tmp"/config.json firecracker --no-api --config-file "$tmp"/config.json '' |
