mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-20 23:51:40 +01:00
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.
This commit is contained in:
1 parent
e2d757bbb0
commit
a86e2bdc63
26 files changed
+840
-71
No files matched your search
@@ -182,3 +182,31 @@ and komorebi for Mac sends the same notifications to Unix sockets, which is also
|
||||
([its README](https://github.com/LGUG2Z/komorebi-for-mac#window-manager-event-subscriptions)).
|
||||
A subscriber here is a Unix socket, as on macOS. The named pipes that komorebi on Windows
|
||||
sends notifications to are not ported, since the socket subscribers do the same.
|
||||
|
||||
## Why does the flake have a NixOS module?
|
||||
|
||||
So that komorebi runs on NixOS with one flake input and one module line. The module installs
|
||||
komorebi and starts it with every Plasma session, and it adds the flake's overlay to nixpkgs
|
||||
itself, so a configuration needs nothing else to find the package. Its options follow those of
|
||||
the nix-darwin module of komorebi for Mac: `enable`, `package` and `logLevel`.
|
||||
|
||||
## Why does komorebi run as a systemd user unit?
|
||||
|
||||
Because a user unit covers every user: it is defined once for the machine and runs for each
|
||||
user who logs in. It is wanted by `plasma-workspace.target`, so it runs in Plasma sessions and
|
||||
nowhere else, and it is ordered after `plasma-core.target`, which Plasma orders after KWin's
|
||||
service: the daemon exits when KWin is not on the session bus. systemd starts a daemon that fails
|
||||
again.
|
||||
|
||||
## Why is there no binary cache?
|
||||
|
||||
The Komorebi license does not allow third parties to redistribute binaries. There is no public
|
||||
binary cache for komorebi, and every installation builds it from source.
|
||||
|
||||
## Why do the VM tests run on machines built with the module?
|
||||
|
||||
So that the tests exercise the module. Every VM suite boots a machine that imports
|
||||
`nixosModules.default` and installs komorebi through it. The headless node runs the daemon with
|
||||
the module's read-only `execStart`, and the session node runs the module's unit itself. A change
|
||||
to the module that breaks how komorebi is installed or started fails the VM suites, and not only
|
||||
`nixos-module-eval`.
|
||||
Reference in new issue
Block a user