nix-community / crate2nix

rebuild only changed crates in CI with crate2nix and nix
https://nix-community.github.io/crate2nix/
Apache License 2.0
385 stars 89 forks source link

Allow some crates to access more files than just those in their folder #346

Open Ten0 opened 7 months ago

Ten0 commented 7 months ago

Linked to #17

I have a file architecture such that crates that build references .proto files that are not in the crate folder:

/
 xxx.proto
 xxx_crate/
           build.rs <- references ../xxx.proto

Since those proto files may be used to generate code for multiple languages, it doesn't feel like it would make much sense for the proto file to be inside the xxx_crate. However when it's outside, the crate naturally can't build.

I'd like to get this to work without altering my file architecture somehow. However I wouldn't like to trade that off for a full workspace recompilation every time a file changes in the workspace (since the workspace is big, it's very good that it only recompiles granularly, so I don't think #17 should be applied as suggested).

Having an override mechanism that would enable me to get the original path of the crate to fetch any parent proto and add them to the source would be enough for me. However it seems that currently the Cargo.nix does not export any path information, so I'm not sure how to achieve that. Any idea?

Thanks