mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
Cherry-picked from NixOS/nixpkgs#391574 Co-authored-by: ccicnce113424 <ccicnce113424@gmail.com>
46 lines
956 B
Nix
46 lines
956 B
Nix
{ ... }:
|
|
{
|
|
name = "kmscon";
|
|
|
|
nodes.machine =
|
|
{
|
|
pkgs,
|
|
...
|
|
}:
|
|
{
|
|
imports = [
|
|
./common/user-account.nix
|
|
];
|
|
|
|
services.getty.autologinUser = "alice";
|
|
|
|
services.kmscon = {
|
|
enable = true;
|
|
hwRender = true;
|
|
fonts = [
|
|
{
|
|
name = "JetBrainsMono Nerd Font";
|
|
package = pkgs.nerd-fonts.jetbrains-mono;
|
|
}
|
|
];
|
|
term = "xterm-256color";
|
|
package = pkgs.kmscon;
|
|
};
|
|
};
|
|
|
|
enableOCR = true;
|
|
|
|
testScript = ''
|
|
machine.start()
|
|
|
|
with subtest("ensure we can open a tty"):
|
|
machine.wait_for_text("alice@machine")
|
|
|
|
machine.send_chars("echo $TERM | tee /tmp/term.txt\n")
|
|
machine.wait_until_succeeds("test -s /tmp/term.txt")
|
|
term = machine.succeed("cat /tmp/term.txt").strip()
|
|
assert term == "xterm-256color", f"Unexpected TERM value: {term!r}"
|
|
|
|
machine.screenshot("tty.png")
|
|
'';
|
|
}
|