Closed szg251 closed 10 months ago
Thank you for opening this issue.
I looked into https://github.com/cachix/pre-commit-hooks.nix/blob/master/modules/hooks.nix and found that there's a Rust wide option to set the location of the Cargo manifest file (I think that's it right?).
Both rustfmt and clippy are using this.
That being said, can we add clippy as well?
Ok, this was easy... I will add both
I found a problem, this only allows configuring one manifest file, but we will have multiple ones eventually... I guess we will need to request a new feature, or implement it ourselves.
Legitimate problem that's making monorepos more difficult. Hmmm...
Stupid question! What's the content of said Manifest? Is it something generic? If so, we can just have it provided as a derivation :)
It's basically the same as a xyz.cabal
file in Haskell. I wouldn't go in that direction.
I think we could define a custom hook, at least as a temporary solution..
Maybe we could trick the system by providing a workspace root manifest file as derivation... I'll give this a go
By default,
rustfmt
looks for aCargo.toml
file in the root directory to determines which files should be formatted. However, as we're using a monorepo structure there's no such file, so the pre-commit-hook fails. We must find a way to tellrustfmt
where the package roots are. Previously I configured cargo workspaces, which solved the problem, but it is not in alignment with the rules of our monorepo (the repo should be language agnostic), so this is a no-go.