2025-06-26 19:43:39 +02:00
|
|
|
inputs: pkgs: let
|
|
|
|
|
flake = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
|
2025-12-05 14:16:22 +00:00
|
|
|
hyprland = flake.hyprland-with-tests;
|
2025-06-26 19:43:39 +02:00
|
|
|
in {
|
|
|
|
|
tests = pkgs.testers.runNixOSTest {
|
|
|
|
|
name = "hyprland-tests";
|
|
|
|
|
|
|
|
|
|
nodes.machine = {pkgs, ...}: {
|
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
# Programs needed for tests
|
2025-08-06 16:28:07 +02:00
|
|
|
jq
|
2025-06-26 19:43:39 +02:00
|
|
|
kitty
|
2025-10-27 23:49:49 +02:00
|
|
|
wl-clipboard
|
2025-06-26 19:43:39 +02:00
|
|
|
xorg.xeyes
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# Enabled by default for some reason
|
|
|
|
|
services.speechd.enable = false;
|
|
|
|
|
|
|
|
|
|
environment.variables = {
|
|
|
|
|
"AQ_TRACE" = "1";
|
|
|
|
|
"HYPRLAND_TRACE" = "1";
|
|
|
|
|
"XDG_RUNTIME_DIR" = "/tmp";
|
|
|
|
|
"XDG_CACHE_HOME" = "/tmp";
|
2025-08-28 11:20:29 +02:00
|
|
|
"KITTY_CONFIG_DIRECTORY" = "/etc/kitty";
|
2025-06-26 19:43:39 +02:00
|
|
|
};
|
|
|
|
|
|
2025-08-28 11:20:29 +02:00
|
|
|
environment.etc."kitty/kitty.conf".text = ''
|
|
|
|
|
confirm_os_window_close 0
|
|
|
|
|
'';
|
|
|
|
|
|
2025-06-26 19:43:39 +02:00
|
|
|
programs.hyprland = {
|
|
|
|
|
enable = true;
|
|
|
|
|
package = hyprland;
|
|
|
|
|
# We don't need portals in this test, so we don't set portalPackage
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Test configuration
|
2025-10-14 21:45:11 +03:00
|
|
|
environment.etc."test.conf".source = "${hyprland}/share/hypr/test.conf";
|
2025-06-26 19:43:39 +02:00
|
|
|
|
|
|
|
|
# Disable portals
|
|
|
|
|
xdg.portal.enable = pkgs.lib.mkForce false;
|
|
|
|
|
|
|
|
|
|
# Autologin root into tty
|
|
|
|
|
services.getty.autologinUser = "alice";
|
|
|
|
|
|
|
|
|
|
system.stateVersion = "24.11";
|
|
|
|
|
|
|
|
|
|
users.users.alice = {
|
|
|
|
|
isNormalUser = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
virtualisation = {
|
|
|
|
|
cores = 4;
|
|
|
|
|
# Might crash with less
|
|
|
|
|
memorySize = 8192;
|
|
|
|
|
resolution = {
|
|
|
|
|
x = 1920;
|
|
|
|
|
y = 1080;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Doesn't seem to do much, thought it would fix XWayland crashing
|
|
|
|
|
qemu.options = ["-vga none -device virtio-gpu-pci"];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
|
# Wait for tty to be up
|
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
|
|
2025-12-05 14:16:22 +00:00
|
|
|
|
|
|
|
|
# Run gtests
|
|
|
|
|
print("Running gtests")
|
|
|
|
|
exit_status, _out = machine.execute("su - alice -c 'hyprland_gtests 2>&1 | tee /tmp/gtestslog; exit ''${PIPESTATUS[0]}'")
|
|
|
|
|
machine.execute(f'echo {exit_status} > /tmp/exit_status_gtests')
|
|
|
|
|
|
2025-06-26 19:43:39 +02:00
|
|
|
# Run hyprtester testing framework/suite
|
|
|
|
|
print("Running hyprtester")
|
2025-10-14 21:45:11 +03:00
|
|
|
exit_status, _out = machine.execute("su - alice -c 'hyprtester -b ${hyprland}/bin/Hyprland -c /etc/test.conf -p ${hyprland}/lib/hyprtestplugin.so 2>&1 | tee /tmp/testerlog; exit ''${PIPESTATUS[0]}'")
|
2025-06-26 19:43:39 +02:00
|
|
|
print(f"Hyprtester exited with {exit_status}")
|
|
|
|
|
|
|
|
|
|
# Copy logs to host
|
|
|
|
|
machine.execute('cp "$(find /tmp/hypr -name *.log | head -1)" /tmp/hyprlog')
|
|
|
|
|
machine.execute(f'echo {exit_status} > /tmp/exit_status')
|
2025-12-05 14:16:22 +00:00
|
|
|
machine.copy_from_vm("/tmp/gtestslog")
|
2025-06-26 19:43:39 +02:00
|
|
|
machine.copy_from_vm("/tmp/testerlog")
|
|
|
|
|
machine.copy_from_vm("/tmp/hyprlog")
|
|
|
|
|
machine.copy_from_vm("/tmp/exit_status")
|
|
|
|
|
|
|
|
|
|
# Print logs for visibility in CI
|
|
|
|
|
_, out = machine.execute("cat /tmp/testerlog")
|
|
|
|
|
print(f"Hyprtester log:\n{out}")
|
|
|
|
|
|
|
|
|
|
# Finally - shutdown
|
|
|
|
|
machine.shutdown()
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
}
|