Stackage for Rust + Nix #539
Replies: 2 comments 3 replies
-
https://nix-community.github.io/crate2nix/ This may also solve what I'm looking for. |
Beta Was this translation helpful? Give feedback.
-
Benefits of derivation per-crate are overstated, benefits of bundling it all together and compressing together understated.
In practice if you have 4 rust packages each will want a different combination of: exact tokio version, exact tokio features, exact toolchain version and you won't get any sharing anyway. |
Beta Was this translation helpful? Give feedback.
-
Crane is great for single crate/executable projects but as projects get bigger with multiple programs or utilizing cargo workspaces builds get slow and caching is poorly utilized. Specifically if I have 4 rust packages that all use the same tokio crate, they all have their own build of tokio in their nix store path even though that dependency should be shareable. The Haskell ecosystem has Stackage which is a consistent set of Haskell package that will all build against each other. This pairs very well with Nix because Stackage solves the diamond dependency problem and then via Nix we can get library/package level cache sharing. Michael Snoyman, the creator of Stackage, has talked about why Rust doesn't need Stackage but in the nix ecosystem I think we could gain a lot from a Stackage for Rust.
Maybe building a Stackage for rust is too big of a hammer and there may be better ways of resolving the dependencies that are shared.
Im starting this discussion here since this is the best community of Rust + Nix users.
Beta Was this translation helpful? Give feedback.
All reactions