mirror of
https://github.com/nix-community/nixos-generators.git
synced 2024-11-22 01:52:05 +03:00
formats vm-nogui: resize only if /dev/tty exists
This commit is contained in:
parent
296067b9c7
commit
494397272f
@ -1,12 +1,14 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
resize = pkgs.writeScriptBin "resize" ''
|
||||
old=$(stty -g)
|
||||
stty raw -echo min 0 time 5
|
||||
printf '\033[18t' > /dev/tty
|
||||
IFS=';t' read -r _ rows cols _ < /dev/tty
|
||||
stty "$old"
|
||||
stty cols "$cols" rows "$rows"
|
||||
if [ -e /dev/tty ]; then
|
||||
old=$(stty -g)
|
||||
stty raw -echo min 0 time 5
|
||||
printf '\033[18t' > /dev/tty
|
||||
IFS=';t' read -r _ rows cols _ < /dev/tty
|
||||
stty "$old"
|
||||
stty cols "$cols" rows "$rows"
|
||||
]
|
||||
''; # https://unix.stackexchange.com/questions/16578/resizable-serial-console-window
|
||||
in {
|
||||
imports = [
|
||||
|
Loading…
Reference in New Issue
Block a user