-
Notifications
You must be signed in to change notification settings - Fork 2
/
screenshot.nix
138 lines (115 loc) · 2.92 KB
/
screenshot.nix
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{ nixpkgs
, home-manager-config
, home-manager
, pkgs
}:
let
vm-config = { config, lib, ... }:
let
username = "sigmanificient";
sysconf = (import ./system { inherit config pkgs username; });
in
{
inherit (sysconf) fonts programs time nixpkgs;
imports = [
home-manager
home-manager-config
];
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
sleep 1
cbonsai --seed=4 -p
'');
auto-neofetch = (pkgs.writeShellScriptBin "auto_neofetch" ''
picom -f & disown
xdotool getactivewindow windowmove 1080 600
neofetch
'');
in
[
cbonsai
neofetch
] ++ [
kitty
libnotify
picom
xdotool
xorg.xrandr
] ++ [
auto-cbonsai
auto-neofetch
];
users.users.${username} = {
isNormalUser = true;
password = "foobar";
uid = 1000;
};
services = {
xserver = {
inherit (sysconf.services.xserver) windowManager;
enable = true;
displayManager = {
startx.enable = false;
autoLogin = {
enable = true;
user = username;
};
};
};
};
virtualisation.resolution = {
x = 1920;
y = 1080;
};
};
testScript = ''
with subtest("ensure x starts"):
machine.wait_for_x()
machine.wait_for_file("/home/sigmanificient/.Xauthority")
machine.succeed("xauth merge ~sigmanificient/.Xauthority")
with subtest("ensure client is available"):
machine.succeed("qtile --version")
with subtest("ensure we can open a new terminal"):
machine.sleep(4)
machine.send_key("meta_l-ret")
machine.wait_for_window("~", timeout=5)
machine.shell_interact()
machine.sleep(1)
for key in "auto_cbonsai":
machine.send_key(key)
machine.send_key("ret")
machine.sleep(4)
machine.send_key("meta_l-ret")
machine.sleep(4)
machine.shell_interact()
machine.sleep(1)
for key in "auto_neofetch":
machine.send_key(key)
machine.send_key("ret")
machine.sleep(6)
machine.screenshot("terminal")
'';
in
pkgs.stdenvNoCC.mkDerivation {
name = "screenshot-system";
version = "1.0.0";
src = ./.;
dontUnpack = true;
dontBuild = true;
installPhase = ''
cp -r $src $out
'';
passthru.tests.qtile =
let
nixos-lib = import (nixpkgs + "/nixos/lib") { };
in
nixos-lib.runTest {
inherit testScript;
name = "test";
nodes.machine = vm-config;
hostPkgs = pkgs;
};
}