2020-02-19 20:43:48 +01:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} :
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "cage";
|
2021-01-10 20:08:30 +01:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2021-04-29 18:07:13 +02:00
|
|
|
maintainers = [ matthewbauer ];
|
2020-02-19 20:43:48 +01:00
|
|
|
};
|
|
|
|
|
2022-03-21 00:15:30 +01:00
|
|
|
nodes.machine = { ... }:
|
2020-02-19 20:43:48 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
imports = [ ./common/user-account.nix ];
|
|
|
|
services.cage = {
|
|
|
|
enable = true;
|
|
|
|
user = "alice";
|
2021-04-29 19:42:12 +02:00
|
|
|
# Disable color and bold and use a larger font to make OCR easier:
|
|
|
|
program = "${pkgs.xterm}/bin/xterm -cm -pc -fa Monospace -fs 24";
|
2020-02-19 20:43:48 +01:00
|
|
|
};
|
|
|
|
|
2021-05-27 20:37:24 +02:00
|
|
|
# Need to switch to a different GPU driver than the default one (-vga std) so that Cage can launch:
|
|
|
|
virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ];
|
2020-02-19 20:43:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enableOCR = true;
|
|
|
|
|
|
|
|
testScript = { nodes, ... }: let
|
|
|
|
user = nodes.machine.config.users.users.alice;
|
|
|
|
in ''
|
|
|
|
with subtest("Wait for cage to boot up"):
|
|
|
|
start_all()
|
|
|
|
machine.wait_for_file("/run/user/${toString user.uid}/wayland-0.lock")
|
|
|
|
machine.wait_until_succeeds("pgrep xterm")
|
|
|
|
machine.wait_for_text("alice@machine")
|
|
|
|
machine.screenshot("screen")
|
|
|
|
'';
|
|
|
|
})
|