Comments (9)
@vbrandl I am using the following pattern in an overlay:
self: super: {
rustNightlyChannel = mozilla.rustChannelOf { date = "..."; channel = "..."; };
rustNightly = self.rustNightlyChannel.rust.override { extensions = [ "rust-src" ]; };
myBuildRustCrate = super.buildRustCrate.override { rustc = self.rustNightly; };
myPkg = (self.callPackage ./Crate.nix { buildRustCrate = myBuildRustCrate; }).rootCrate.build;
}
(adopted from my actual, more complicated, version)
from crate2nix.
I wasn't able to test yet because I didn't need it anymore (since 1.39.0 landed in the unstable channel, I don't need a nightly compiler for async/await). This can be closed but I think it would be nice to have a documented example in the README that shows how to use the mozilla overlay
from crate2nix.
You can override the rust compiler by overlays to the used nixpkgs.
I will investigate in making this easy...
from crate2nix.
Would be cool to mention this in the readme with an example.
I tried adding the mozilla overlay but I can't figure out, where do override the used compiler channel
from crate2nix.
Thank you. I also found this one yesterday but I didn't come around to test it, yet: https://github.com/jD91mZM2/xidlehook/blob/master/default.nix
from crate2nix.
@kolloch @vbrandl Can this be closed?
from crate2nix.
This answer is similar to @andir 's, but I just wanted to make explicit that you don't need to use an overlay.buildRustCrate
, which is what the file generated by crate2nix uses, allows you to specify a whole Rust toolchain through the rust
argument. This can be handy when you make a package set that others should also be able to use, without defining overlays locally.
This is an example of a derivation using a nightly compiler:
It's self-contained, so others can use the derivation directly.
Edit: nevermind, I was still on a crate2nix
branch with PR #38, and I somehow misremembered that 184d3dd made this possible.
@kolloch maybe it's still worth pursuing this approach? It's more powerful than the defaultCrateOverrides
argument introduced by 184d3dd. carnix
also supports overriding buildRustCrate
arguments. It's more intuitive than having to override buildRustCrate
first and then passing the overrided buildRustCrate
as an argument.
from crate2nix.
@andir @vbrandl @danielk I added documentation for doing this "globally" here:
https://github.com/kolloch/crate2nix#choosing-a-rust-version
I discovered one caveat: I had to use "rust" (without the c suffix) for "rustc" with a recent version of the overlay because otherwise rustc
wouldn't find the std sources.
Doing this globally is often what you want, I guess. Build all your stuff with the same rust compiler. But the individual approach also has merrit. Maybe you want to add that to the documentation? You would be welcome.
@danielk for making buildRustCrate more directly overridable, see #77. Tell me what you think! For "pkgs" it is not the right tool, though, since you also want to override it for all dependencies, correct?
from crate2nix.
I will close this issue for now but will gladly accept documentation fixes/extensions.
from crate2nix.
Related Issues (20)
- Panic when running `crate2nix generate` HOT 6
- crate2nix stumbles over arbitrary #[cfg] conditionals HOT 4
- error inheriting `version` from workspace root manifest's `workspace.package.version` HOT 1
- Set custom environment variables in `packages` and `devShells` HOT 1
- rustc 1.73 breaks crate2nix cross compilation HOT 5
- Cargo.nix includes references to ./crate2nix-sources with cargo workspaces HOT 1
- nixpkgs update breaks empty_cross test due to missing `rust` arguement HOT 7
- rstests adds a stray "/sources" to all globbed #[files] HOT 1
- Support path to Cargo.toml/Cargo.lock in fetched sources
- Tarball issue when building or trying to use template. HOT 1
- Error with dep that has a local dep
- Some sort of support for .cargo/config.toml ? HOT 1
- Overriding `crateConfig` for generated `Cargo.nix`
- Crate hash loading from Cargo.lock is broken in Rust 1.77
- Respect cargo profiles / enable debug info in release mode HOT 1
- Allow some crates to access more files than just those in their folder
- IFD is crazy slow due to copying the entire tree HOT 2
- IFD does not work with git deps HOT 2
- Installs `rustc` from nixpkgs when already installed HOT 4
- error: invalid metadata version found HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crate2nix.