nix: build nova-plugin via crane to cache deps separately from crate src

This commit is contained in:
Damocles 2026-05-03 20:01:47 +02:00
parent 2a691aa66f
commit bf5cb913fc
4 changed files with 88 additions and 44 deletions

View file

@ -8,7 +8,15 @@ fn main() {
// plugin loader finds nothing exported. --export-dynamic re-exposes them.
println!("cargo:rustc-link-arg=-Wl,--export-dynamic");
// Crane's deps-only build stubs out lib.rs and removes our bridge sources to
// build a dummy crate that only compiles dependencies. Skip cxx-qt codegen in
// that case - we just want cxx-qt-lib (the heavy dep) cached, not our own glue.
let bridge_files = ["src/system_stats.rs", "src/cpu_service.rs"];
if !bridge_files.iter().all(|p| std::path::Path::new(p).exists()) {
return;
}
CxxQtBuilder::new_qml_module(QmlModule::new("NovaStats").plugin_type(PluginType::Dynamic))
.files(["src/system_stats.rs", "src/cpu_service.rs"])
.files(bridge_files)
.build();
}