perf(nix): narrow the KDE source to its cargo closure

The KDE source filter took all of crates/, so an edit of
crates/komorebi-bar-core, which KDE does not depend on, changed every KDE
check and VM suite derivation. The filter now takes the nine crates of the
root workspace in the KDE cargo closure, listed in
komorebi-for-kde/nix/root-crates.json (read by the flake and by
tools/kde-closure-check, which fails if the list differs from
`cargo metadata` of the KDE workspace; a new dependency is therefore a
check failure, not a silent skip). The crates/ directory itself still passes
the filter so that its listed members are reached.

Safety: komorebi-gui, komorebi-bar and the e2e crates are already absent
from the KDE source while the root manifest lists them as members, so a
missing member directory is already tolerated. Not proven by a build.

Verified (nix eval of drvPath in a throwaway git copy, 7 commits): an edit
of crates/komorebi-bar-core leaves kfde clippy, nextest, the packages and
kfde-vm.stacks and .commands unchanged (before: all changed); an edit of
crates/komorebi-config changes them; the kfde package still evaluates.
tools/kde-closure-check passes, and fails when a crate is removed from the
list.
This commit is contained in:
LGUG2Z committed 2026-10-31 11:22:17 -07:00
1 parent 262f44d2b6
commit 5002989053
2 files changed
+18 -7

No files matched your search

+7 -7
View File
@@ -36,12 +36,10 @@
crane
rust-overlay
;
rootCrates = [
"crates"
"komorebi-layouts"
"komorebi-scrolling"
"komorebi-themes"
];
# the crates of the root workspace that this workspace depends on, by path, directly or not.
# Only these are in the source, so that an edit of another crate (the bar's) changes nothing
# here. `tools/kde-closure-check` fails if this list and `cargo metadata` differ.
rootCrates = builtins.fromJSON (builtins.readFile ./nix/root-crates.json);
mkPkgs =
system:
import nixpkgs {
@@ -73,8 +71,10 @@
rootCrate = builtins.any (
crate: relative == crate || pkgs.lib.hasPrefix "${crate}/" relative
) rootCrates;
# the directory that holds the crates of crates/, to reach the listed ones
rootCrateParent = relative == "crates";
in
(rootCrate && !(pkgs.lib.hasSuffix "/Cargo.lock" path) || relative == "Cargo.toml" || inTree)
((rootCrate || rootCrateParent) && !(pkgs.lib.hasSuffix "/Cargo.lock" path) || relative == "Cargo.toml" || inTree)
&&
# the VM tests (their library, scripts and the states they keep) are not built, so
# editing one does not change the source the daemon is built from
+11
View File
@@ -0,0 +1,11 @@
[
"crates/komorebi-backend",
"crates/komorebi-collections",
"crates/komorebi-config",
"crates/komorebi-protocol",
"crates/komorebi-transport",
"crates/komorebic-core",
"komorebi-layouts",
"komorebi-scrolling",
"komorebi-themes"
]