From 1cd0b43ceaf4d81617502d5e62ee971e305dff9f Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sun, 28 Jul 2024 11:10:33 -0400 Subject: [PATCH] feat: Use filterCargoSources for workspace crates To avoid unnecessary rebuilds. We already do this for project root (via the `src` option). --- nix/modules/default-crates.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nix/modules/default-crates.nix b/nix/modules/default-crates.nix index 7448cbe..d14e372 100644 --- a/nix/modules/default-crates.nix +++ b/nix/modules/default-crates.nix @@ -12,8 +12,13 @@ lib.foldl' (acc: pathString: let - path = "${src}/${pathString}"; - cargoPath = "${src}/${pathString}/Cargo.toml"; + path = + lib.cleanSourceWith { + src = "${src}/${pathString}"; + filter = path: type: + (config.rust-project.crane-lib.filterCargoSources path type); + }; + cargoPath = "${path}/Cargo.toml"; cargoToml = builtins.fromTOML (builtins.readFile cargoPath); name = cargoToml.package.name; in