diff options
Diffstat (limited to 'default.nix')
| -rw-r--r-- | default.nix | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/default.nix b/default.nix index e757b8e..8f64d78 100644 --- a/default.nix +++ b/default.nix @@ -84,7 +84,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" "@TTY_SIZE@" ]); + boot_args = toString (nixos.config.boot.kernelParams ++ [ "init=${toplevel}/init" "@TTY_ARGS@" ]); }; network-interfaces = [{ iface_id = "eth0"; @@ -137,12 +137,16 @@ pkgs.writeShellScriptBin "run-firecracker-vm" '' find "$cache" -type f ! -path "$img" -delete fi - # 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= + # Tell systemd the terminal's type and size, so it doesn't query them via + # ANSI sequences (and wait up to 333ms for each answer) when starting the + # getty. + tty_args= + if test -n "''${TERM-}"; then + tty_args="systemd.tty.term.ttyS0=$TERM" + fi 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" + tty_args="$tty_args systemd.tty.rows.ttyS0=$rows systemd.tty.columns.ttyS0=$cols" fi mkdir -p xchg @@ -152,7 +156,7 @@ pkgs.writeShellScriptBin "run-firecracker-vm" '' sed \ -e "s|@STORE_IMAGE@|$img|" \ -e "s|@XCHG_IMAGE@|$tmp/xchg.img|" \ - -e "s|@TTY_SIZE@|$tty_size|" \ + -e "s|@TTY_ARGS@|$tty_args|" \ ${config} > "$tmp"/config.json status=0 firecracker --no-api --config-file "$tmp"/config.json || status=$? |
