Rust: Difference between revisions
fix links |
Console4852 (talk | contribs) Remove Rust Nightlies section. This section had no information that wasn't found on the rest of the page (only having two bullet points referring to other sections of the page). Instead, modify the page to elaborate more in the respective sections. |
||
(One intermediate revision by the same user not shown) | |||
Line 76: | Line 76: | ||
A minimal example of the <code>rust-toolchain.toml</code>: | A minimal example of the <code>rust-toolchain.toml</code>: | ||
< | <syntaxhighlight lang="toml"> | ||
[toolchain] | [toolchain] | ||
channel = "stable" | channel = "stable" # This can also be "nightly" if you want a nightly rust | ||
</ | # or nightly-20XX-XX-XX for a specific nightly. | ||
</syntaxhighlight> | |||
The important part is that this also works with complex setups using bindgen and precompiled C libraries. To add a new C library in the search path of bindgen and rustc edit the variables <code>BINDGEN_EXTRA_CLANG_ARGS</code> and <code>RUSTFLAGS</code> | The important part is that this also works with complex setups using bindgen and precompiled C libraries. To add a new C library in the search path of bindgen and rustc edit the variables <code>BINDGEN_EXTRA_CLANG_ARGS</code> and <code>RUSTFLAGS</code> | ||
Line 99: | Line 100: | ||
# https://github.com/cachix/devenv/blob/main/examples/rust/devenv.nix and <code>devenv shell</code> | # https://github.com/cachix/devenv/blob/main/examples/rust/devenv.nix and <code>devenv shell</code> | ||
== Developing Rust projects using Nix == | == Developing Rust projects using Nix == | ||
Line 250: | Line 246: | ||
You can use the [https://marketplace.visualstudio.com/items?itemName=arrterian.nix-env-selector arrterian.nix-env-selector] extension to enable your nix-shell inside VSCode and have these settings picked up by other extensions. | You can use the [https://marketplace.visualstudio.com/items?itemName=arrterian.nix-env-selector arrterian.nix-env-selector] extension to enable your nix-shell inside VSCode and have these settings picked up by other extensions. | ||
== FAQ == | == FAQ == | ||
Line 304: | Line 274: | ||
=== Building with a different Rust version than the one in Nixpkgs === | === Building with a different Rust version than the one in Nixpkgs === | ||
The following uses the [https://github.com/nix-community/fenix fenix] overlay and <code>makeRustPlatform</code> to build a crate with Rust | The following uses the [https://github.com/nix-community/fenix fenix] overlay and <code>makeRustPlatform</code> to build a crate with Rust Nightly: | ||
<syntaxHighlight lang="nix"> | <syntaxHighlight lang="nix"> |