Files
komorebi/nix/tests/vm/nodes/session.nix
T
LGUG2Z a86e2bdc63 build(nix): a NixOS module for komorebi
On NixOS, running komorebi should take one flake input and one module line. The
flake exports `services.komorebi` as nixosModules.default (and .komorebi). It
adds the flake's overlay, which gains komorebi-full, installs komorebi and
komorebic, and runs the daemon in every Plasma session as a systemd user unit,
wanted by plasma-workspace.target and ordered after plasma-core.target, which
Plasma orders after KWin. systemd starts a daemon that fails again; the exit
status of a SIGTERM (130) counts as success, so a stopped unit is not failed.
The unit's PATH is the one a terminal in the session has, instead of the few
store paths NixOS gives a unit.

The options are enable, package, logLevel and a read-only execStart, the command
line the unit runs. There is no configFile: the daemon reads no configuration
file yet, and an option that linked one would do nothing.

nixos-module-eval evaluates seven scenarios as real NixOS systems and checks
their assertions, the unit and execStart, with builtins.tryEval for the two that
must not evaluate. Nothing in it builds a Linux package, so it runs on a Mac as
well.

The VM nodes import the module, so every suite runs komorebi as the module
installs it. The headless node's komorebi@NAME runs execStart, which has
--log-level, so the nodes set logLevel to debug and the suites stop passing it;
latency, which times the daemon, keeps the default level. The session node
starts the module's unit at login; render-smoke turns it off, since a tiled
terminal would cover the desktop it looks at. A new fast suite, vm-module, logs
in to Plasma and checks that the unit runs the daemon with the module's log
level and PATH, that a window opened in the session is tiled, that a killed
daemon is started again, and that a stop is not a failure.

docs/installation.md covers NixOS first, and building from source on other
distributions. There is no binary cache: the Komorebi license does not allow
third parties to redistribute binaries.
2026-10-28 07:20:37 -07:00

56 lines
2.0 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 module's
# unit, `komorebi.service`, starts komorebi in the session when the user logs in, as on a user's
# machine; a suite that wants the session without it sets `services.komorebi.enable = false` in
# its `node`.
#
# 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.
}