Files
komorebi/nix/tests/vm/nodes/session.nix
T
LGUG2Z fec9c2773a build(nix): a Plasma session node for tests
A virtual KWin has no output to draw on, so every test about pixels, and later
about the pointer, needs a real session. The `session` node is the headless node
plus a login: plasma-login-manager logs the test user in by itself, the way
nixpkgs' own `plasma6` test does, and Plasma draws on the machine's display. The
choice of login manager is made in `nodes/session.nix` and nowhere else, and the
file says how to switch to sddm.

The node adds no display device. The test driver gives every aarch64 guest one
virtio-gpu and takes screenshots of it; a second device is a second KWin output
that screenshots never show, which is what a first attempt did (a blank 1280x800
console).

`Kde.session` attaches to the session once the desktop is up: the shell is
running, the user manager knows the Wayland display, and the splash screen has
gone. The display is read from the user manager because plasma-login-manager's
greeter has its own KWin and takes `wayland-0`, and the user's session gets
`wayland-1`. The splash condition is there because KSplash has over a thousand
colors on it, so a "not blank" check passed on the splash screen. NixOS wraps
programs, which is why processes are found by their command lines: `pgrep -x
plasmashell` never matches `.plasmashell-wrapped`, and an exact match for the
splash would have passed because nothing matched. `Kde.shot` returns a
screenshot as a Pillow image.

`vm-render-smoke` is the first slow suite: it starts a session, opens a
terminal, and checks the middle of the window is dark and that the desktop
behind it has thousands of colors. On aarch64 under HVF five runs gave the same
screenshot, with the desktop up after 34 seconds. docs/dev/vm-tests.md describes
the node and the two traps.
2026-10-27 14:06:52 -07:00

53 lines
1.8 KiB
Nix

# A real Plasma Wayland session that logs in by itself, on a machine that can draw. Everything the
# headless node has is here too, so a test can still start a virtual KWin next to it.
#
# The choice of login manager is made here and nowhere else. nixpkgs' own `plasma6` test uses
# plasma-login-manager, so that is what this node follows; sddm with a Wayland greeter is the other
# one that has been seen to work, and replacing the first block below with
# `services.displayManager.sddm = { enable = true; wayland.enable = true; };` and
# `services.displayManager.defaultSession = "plasma";` switches to it.
{ pkgs, ... }:
{
imports = [ ./headless.nix ];
# the one display this node has is the one screenshots are taken of
komorebi.vm.renderNode = false;
services.xserver.enable = true;
services.displayManager = {
plasma-login-manager.enable = true;
autoLogin = {
enable = true;
user = "komorebi";
};
};
virtualisation = {
memorySize = 4096;
cores = 4;
};
# An idle lock screen or a dimmed display changes what a screenshot shows, and a display that has
# gone to sleep gets no frame callbacks from KWin, so clients stop answering resizes.
environment.etc."xdg/kscreenlockerrc".text = ''
[Daemon]
Autolock=false
LockOnResume=false
'';
environment.etc."xdg/powerdevilrc".text = ''
[AC][Display]
DimDisplayWhenIdle=false
TurnOffDisplayWhenIdle=false
[AC][SuspendAndShutdown]
AutoSuspendAction=0
'';
environment.systemPackages = [ pkgs.kdePackages.konsole ];
# Nothing adds a display device here (see komorebi.vm.renderNode above). The test driver gives
# every aarch64 guest a virtio-gpu, and an x86_64 guest has the default VGA; screenshots are taken
# of that one, and a second device would be a second head that KWin draws on and the screenshot
# never shows.
}