Jump to content

Rust: Difference between revisions

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.
(Remove Neovim Completion Section. This section references racer, which hasn't been relevant for rust autocomplete in years now (the last commit on the project was 2 years ago). It's also not a valid, working snippet - nor does it configure neovim in a way you'd expect.)
(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.)
 
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">
<syntaxhighlight lang="toml">
[toolchain]
[toolchain]
channel = "stable"
channel = "stable" # This can also be "nightly" if you want a nightly rust
</syntaxHighlight>
                  # 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>
== Rust Nightlies ==
# Use one of the overlays above,
# Or, use rustup


== Developing Rust projects using Nix ==
== Developing Rust projects using Nix ==
Line 278: 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 nightly:
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">
3

edits