Files
komorebi/justfile
T
LGUG2Z 1ee2405e44 docs(repo): trying komorebi in a virtual machine
The guide for the one command: docs/trying-it.md says what a machine needs to
run the demo guest, with the lines of .wslconfig and of the NixOS-WSL
configuration for Windows 11, how to check it with `run-kde --doctor`, what the
command does and shows, the key bindings to try, how the GPU path is chosen, how
to open Windows' own RDP client, how long the first run takes (measured on a
machine with 32 cores and an empty store, by number of cores, with an estimate
for a WSL 2 machine and its caveats), how to start again, how to work on
komorebi in the guest, and what to do when something is wrong, by symptom. It
ends with what was run and what was not: nothing has been run on WSL 2 yet. The
README has a section and a link, and the user guide index a line.

DESIGN.md has four entries. Two record what I decided and want: the QEMU window
first and RDP second, and the GPU wherever the host has one. Two say that a
reason was not written down, for QEMU with KVM and not Hyper-V and for sharing
the password by a directory, and what is known that bears on each; the password
entry also says why a password is made for each user. PLATFORM.md has a section
for WSL 2 with what the command expects, a table of the probe results still to
be recorded (KVM, display, GPU, RDP, resources, virtiofs), and what is known of
virtiofsd without WSL 2.
2026-10-28 14:20:08 -07:00

80 lines
3.7 KiB
Makefile

export RUST_BACKTRACE := "full"
# format the Rust sources (needs a nightly rustfmt: rustfmt.toml uses unstable options)
fmt:
cargo fmt
# everything a change has to pass before it is pushed
check: lint check-js
cargo fmt --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test --workspace --locked
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked
# the KWin bridge, which is JavaScript: its types, checked by tsc from its JSDoc comments, and its
# tests, which node runs against a fake KWin (no package.json, no build step)
check-js:
cd komorebi/src/kwin && tsc -p tsconfig.json
node --test komorebi/src/kwin/bridge.test.js
# the macros the codebase has agreed not to use, the workflows, which actionlint checks (with
# shellcheck over their scripts), and the probe script, all with the tools of the nixpkgs flake.lock pins
lint:
test -z "$(rg 'eyre!' --type rust .)" || (echo "eyre! macro not allowed"; false)
test -z "$(rg 'dbg!' --type rust .)" || (echo "dbg! macro not allowed"; false)
test -z "$(rg 'println!' --type rust ./komorebi/src)" || (echo "println! macro not allowed"; false)
nix shell --inputs-from . nixpkgs#actionlint nixpkgs#shellcheck --command actionlint .github/workflows/*.yaml
nix shell --inputs-from . nixpkgs#shellcheck --command shellcheck scripts/wsl2-probe.sh
# the JSON Schemas of komorebi.json and of applications.json, from the Rust types
jsonschema:
cargo run --package komorebic --locked -- static-config-schema > schema.json
cargo run --package komorebic --locked -- application-specific-configuration-schema > schema.asc.json
# the options of the module's `config`, from schema.json, with the hash of the schema they were
# made from in the first line (the check `schema-fresh` compares it); needs schemars-nixgen
# (`cargo install schemars-nixgen`), which the dev shell does not have
nixgen:
schemars-nixgen schema.json -o nix/komorebi-options.nix --name komorebi --description "komorebi for KDE Plasma configuration"
printf '# schema-sha256: %s\n' "$(nix hash file --type sha256 --base16 schema.json)" | cat - nix/komorebi-options.nix > nix/komorebi-options.nix.new
mv nix/komorebi-options.nix.new nix/komorebi-options.nix
nix fmt nix/komorebi-options.nix
nix build -L --no-link ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem).nix-options-validation"
# probe a NixOS-WSL2 machine for KVM, WSLg, a GPU and RDP (docs/dev/wsl2-probe.md): `just wsl2-probe --dry-run`
wsl2-probe *args:
nix run .#wsl2-probe -- {{ args }}
# one VM test, on this machine: `just vm kwin`. Linux boots the guest under KVM through the
# flake check; a Mac builds the guest on a builder and runs the driver (see docs/dev/vm-tests.md)
vm name:
#!/usr/bin/env bash
set -euo pipefail
if [ "$(uname)" = Darwin ]; then
scripts/vm-mac {{ name }}
else
nix build -L .#checks.{{ arch() }}-linux.vm-{{ name }}
fi
# every VM test, in the order of the flake
vm-all:
#!/usr/bin/env bash
set -euo pipefail
system=$(nix eval --raw --impure --expr builtins.currentSystem)
for name in $(nix eval --json ".#legacyPackages.$system.vm" --apply builtins.attrNames | jq -r '.[]'); do
just vm "$name"
done
# write the help of every komorebic subcommand to docs/cli, one page each
docgen:
rm -f docs/cli/*.md
cargo run --package komorebic --locked -- docgen --output docs/cli
# the demo guest in a virtual machine, with komorebi tiling a few windows (docs/trying-it.md);
# `just run-kde --doctor` says what this machine is missing
run-kde *args:
nix run .#run-kde -- {{ args }}
run target *args:
cargo run --bin {{ target }} --locked -- {{ args }}