2020-04-24 23:36:52 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ...} :
|
|
|
|
|
|
|
|
{
|
|
|
|
name = "cage";
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2021-05-03 20:48:10 +00:00
|
|
|
maintainers = [ matthewbauer ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
nodes.machine = { ... }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
imports = [ ./common/user-account.nix ];
|
2023-04-29 16:46:19 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
fonts.packages = with pkgs; [ dejavu_fonts ];
|
2023-04-29 16:46:19 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
services.cage = {
|
|
|
|
enable = true;
|
|
|
|
user = "alice";
|
2023-04-29 16:46:19 +00:00
|
|
|
program = "${pkgs.xterm}/bin/xterm";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-28 09:39:13 +00: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-04-24 23:36:52 +00: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")
|
|
|
|
'';
|
|
|
|
})
|