From 50029890538568935a76c66167435d139dbdcc9a Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 11:10:14 -0700 Subject: [PATCH] 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. --- komorebi-for-kde/flake.nix | 14 +++++++------- komorebi-for-kde/nix/root-crates.json | 11 +++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 komorebi-for-kde/nix/root-crates.json diff --git a/komorebi-for-kde/flake.nix b/komorebi-for-kde/flake.nix index ea34b59a..1672f309 100644 --- a/komorebi-for-kde/flake.nix +++ b/komorebi-for-kde/flake.nix @@ -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 diff --git a/komorebi-for-kde/nix/root-crates.json b/komorebi-for-kde/nix/root-crates.json new file mode 100644 index 00000000..a764d830 --- /dev/null +++ b/komorebi-for-kde/nix/root-crates.json @@ -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" +]