-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscreenshot.nix
More file actions
112 lines (92 loc) · 2.37 KB
/
screenshot.nix
File metadata and controls
112 lines (92 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{ pkgs, nixos-system, username }:
let
vm-config = { config, lib, ... }:
{
boot.consoleLogLevel = lib.mkForce 7;
environment.systemPackages = with pkgs; let
auto-cbonsai = (pkgs.writeShellScriptBin "auto_cbonsai" ''
xdotool getactivewindow windowmove 80 80
xdotool getactivewindow windowsize 400 400
clear
sleep 1
cbonsai --seed=4
'');
auto-neofetch = (pkgs.writeShellScriptBin "auto_neofetch" ''
clear
sleep 1
xdotool getactivewindow windowmove 1080 600
neofetch
'');
in
[
cbonsai
neofetch
] ++ [
kitty
picom
xdotool
] ++ [
auto-cbonsai
auto-neofetch
];
users.users.${username} = {
isNormalUser = true;
uid = 1000;
};
services = {
xserver = {
enable = true;
displayManager = {
startx.enable = lib.mkForce false;
autoLogin = {
enable = true;
user = username;
};
};
};
};
virtualisation.resolution = {
x = 1920;
y = 1080;
};
};
in
pkgs.testers.runNixOSTest {
name = "screenshot-system";
node = {
inherit pkgs;
specialArgs = nixos-system.conf.specialArgs;
pkgsReadOnly = false;
};
nodes = {
machine.imports =
nixos-system.conf.modules
++ [ vm-config ];
};
testScript = ''
with subtest("ensure x starts"):
machine.wait_for_x()
machine.wait_for_file("/home/${username}/.Xauthority")
machine.succeed("xauth merge ~${username}/.Xauthority")
# it might take some time to boot up the session...
machine.sleep(10)
with subtest("ensure we can open a new terminal"):
machine.send_key("meta_l-ret")
machine.wait_for_window("zsh", timeout=10)
machine.shell_interact()
machine.sleep(2)
for key in "auto_cbonsai":
machine.send_key(key)
machine.send_key("ret")
machine.sleep(15)
machine.send_key("meta_l-ret")
machine.sleep(2)
machine.shell_interact()
machine.sleep(2)
for key in "auto_neofetch":
machine.send_key(key)
machine.send_key("ret")
machine.sleep(20)
machine.screenshot("terminal")
'';
}