-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use cargo artifacts in dev environment #294
Comments
I'm not sure if I understand, but |
We can control all of these with Nix! |
Yes, but the chances that two users will have exactly same combination are becoming increasingly small, making the caching largely pointless. The re-usability of cargo artifacts makes sense only within the same organization, largely around just working on the exactly same project, pinned to the same inputs. It's trivial to plug in cachix (or other private Nix cache) and achieve the same results, without the overhead of global caching infrastructure. On top of it |
I have actually done just this in my own nix cargo/rust solution, as I had trouble using https://github.com/twistedfall/opencv-rust with many of these other solutions. I also needed workspace support, which many of these don't support.
This has been an uphill battle. What we really need for a pure cargo/rust shell is chrooted shells. Combining that with overlayfs would allow us to reuse the |
I don't agree with these points. Caching build artifacts between your development environment, CI, and other projects is valuable outside of the 'same organization'.
It sounds the feature I am suggesting is a non-starter for this project. |
@SkamDart yes I have considered it, the issue has been finding a robust solution. The last time I tried looking into that there were issues with cargo rebuilding things anyway. Come to think of it, the last time I even tried building in one directory then copying the artifacts somewhere else it would crash the compiler (though maybe this is related to incremental builds?)... I have a suspicion something might be sensitive to the full path to the
I wouldn't go quite that far. If someone is willing to investigate and find a solution that works I'd be happy to include it in the documentation! Even though |
I've been doing this in CI on a few projects for a while now with the cache working perfectly. I think it's actually pretty neat. The main reason I began looking into this was that I was unhappy with running tests in the Nix sandbox. The reasons were:
So I just decided to build Btw there's no guarantee that the Nix sandbox build directory stays the same between I'll see if I can clean up and upstream some of this when I find some free time. |
Crane, similar to the rest of the nix-rust builders, relies on crates-io for dependencies in the nix-shell
This is a bit off the beaten path for nix users where you (usually) get the dependencies from your nix-store or cache before rebuilding from source.
Cargo and crates-io are wonderful tools but this is a bit non-standard for nix users.
Has this project considered exposing cargoArtifacts to cargo in the nix-shell environment?
One rather janky way I envision this happening is adding a shellHook to set the target directory and symlinking the dependencies from the nix-store to said directory.
Cargo used to have a "build-plan" which would be ideal here but it seems to deprecated.
rust-lang/cargo#7614
Thoughts?
The text was updated successfully, but these errors were encountered: