mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-15 21:32:26 +01:00
feat(wm): JSON schemas, and the module's typed options
komorebi.json is described as a JSON Schema, made from the Rust types that read it: komorebic prints the schema of komorebi.json, of an applications.json, of a notification and of a message, and the daemon answers the same four questions on its socket. schema.json and schema.asc.json are committed (just jsonschema). The module's config option is typed from the schema: schemars-nixgen makes nix/komorebi-options.nix from schema.json (just nixgen), so a layout komorebi does not have, or a value of the wrong kind, does not evaluate. The module writes config as a komorebi.json and gives it to the daemon with --config. configFile and the file the module writes are checked against the schema when the system is built. applicationSpecificConfiguration takes files from GitHub, and there are none by default, since no community file for Plasma is known. Two checks keep the generated files honest without the tools that make them. schema-fresh compares the schemas with what komorebic prints, and the hash on the first line of the options with the schema. nix-options-validation evaluates the options against the example configuration, written in Nix and in JSON. nixos-module-eval also evaluates the module with the sources turned off: with applicationSpecificConfiguration.enable = false the sources are left out of the config that is written, and with no config either there is nothing to write and the unit passes no --config. ARCHITECTURE has the guarantee row that names the two checks.
This commit is contained in:
1 parent
ed34286bca
commit
3a3a0f8f24
29 files changed
+2754
-49
No files matched your search
@@ -354,3 +354,12 @@ Because one `komorebi.json` is meant to work on every platform, and the file it
|
||||
one that another platform has: a configuration written for macOS names `applications.mac.json`,
|
||||
which a KDE desktop does not have. The daemon warns and goes on. A file that exists and is not an
|
||||
applications.json is a mistake in something the user wrote, and is an error.
|
||||
|
||||
## Why does `nix/komorebi-options.nix` start with the hash of the schema?
|
||||
|
||||
Because the check that the options are fresh cannot make them again. `schemars-nixgen` makes
|
||||
`nix/komorebi-options.nix` from `schema.json`, and it is not in the dev shell or in CI (it is
|
||||
installed with `cargo install`). `just nixgen` writes the hash of `schema.json` as the first line
|
||||
of the file, and the check `schema-fresh` compares that with the hash of the committed schema, and
|
||||
the schema with what `komorebic static-config-schema` prints. A change to a key that leaves the
|
||||
schema or the options behind fails the check, with no tool but the build.
|
||||
Reference in new issue
Block a user