-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
buildRustPackage is not very nix-ish #11144
Comments
I agree with your points. Regarding your 3rd point, that may not be very easy to accomplish. I was thinking we'd need something that parses If I understand correctly your 4th point, I think it may also not be easy to accomplish at this point in time (but I hope I'm wrong). As far as I know, there is no way to tell cargo how to use an already-built library. I think I asked the Cargo developers how to do this, and IIRC they told me this is not supported because Rust doesn't have a stable ABI yet (which is probably a poor excuse in Nix's case). |
Regarding the 3rd point, perhaps we could have something that crawls a source tree looking for stuff like That might pull in some false positives, but then it's just a matter of removing the unnecessary stuff, which is much easier IMO than trying to hunt down the dependencies in the first place. |
And regarding the 4th point, as @wizeman notes:
That's precisely what I recall from the last time I looked into Rust on Nix. |
I'd make these two simplish requests of them:
Then we should be to do the rest ourselves. |
Don't overrides allow to do that? |
I think the whole rust situation is bound to become worse for some time. I was trying to update cargo to 0.10.0 version, but it breaks buildRustPackage function.
If somebody could look into this, as I don't have enough knowledge and experience with this kind of stuff :) Or maybe we should wait for: rust-lang/cargo#2361 |
Could cargo-local-registry be used here to improve the situation? |
Not very much :(. The problem is caching rlibs, not source. |
Could we use multiple output and have each rust package output both its binaries / rlibs and its source. Then each rust package in nix could depend on the "source" output of its cargo dependencies. I think this would solve issues 2 and 3 of my original report, since rust-to-rust dependencies would be tracked by nix. |
See this Reddit discussion + blog post for an alternative approach. Looks interesting. |
And the relevant nixpkgs issue ticket: #24991. |
Can we close this because Carnix and |
I think so. There are still some points which could be improved, but we'd better handle that separate tickets. |
For that matter, is there a proposal to replace all |
No. Carnix still generates very large nix expressions that are not shared between packages. |
Bad for eval times, but could still evaluate to the same derivation? |
This should be the case. A |
Well we have a copy with some fixes in the nix-community group. It's technically a fork but just to have a "backup" of what's proposed for carnix and a copy of the released versions. There was some attempt at mirroring cargo into nixpkgs but as @Mic92 said it's generating very large expressions. Those missing features and the mentioned use-cases are definitely things I and others want to have in carnix. We still have to discuss with the original author. It will probably happen around nixcon.. (Excuses the lack of links & mentions, typed on a crippled phone) |
All the language infrastructures are hitting this. I really want to open the discussion on import-from-derivation to fix the problem once and for all. |
@andir where is that fork? The nest doesn't seem to have any way to search, and I can't see it in your github. I want to contribute. |
this looks promising: https://www.hadean.com/blog/managing-rust-dependencies-with-nix-part-ii |
@illegalprime It doesnt, since it uses cargo in the build. |
@lifranc cargo has a lot of stuff in it that would be hard to maintain in a rewrite (features, editions, etc.), as long as nix has fully control over building each crate, what's wrong with building it with cargo? |
Never used that word. not promising is what I expressed. I'm certain you can see why. |
@lifranc hmm... what do you think would be a good solution? (maybe that involves a contribution to rustc or cargo, but that's even more hoops to jump through) |
@illegalprime What carnix does (try to do maybe); pull all the data needed into nix expressions. The expressions carnix outputs have the wrong structure imo and feel like they stop at an intermediary step (stil lots of functions and boilerplate code in files that should only contain crates' metadata). So either fix carnix or do it over. |
Hi, I started developping some rust code on nixos, and I find that while buildRustPackage is great for having all of crates.io available, the experience is not quite on par with, say, that of developping in haskell or ocaml on nix.
Specifically:
I'm grouping these into one issue because I'm not sure which of these sub-issues can be fixed in buildRustPackage, and what would need something more akin to cabal2nix where rust dependencies of rust packages are made manifest to nix/within nixpkgs.
The text was updated successfully, but these errors were encountered: