Rust: Difference between revisions

imported>Samuela
imported>Samuela
No edit summary
Line 2: Line 2:


== Installing via nixpkgs ==
== Installing via nixpkgs ==
The <code>cargo</code> and <code>rustc</code> derivations provide the rust toolchain in nixpkgs. Here's an example <code>shell.nix</code>:
The <code>cargo</code> and <code>rustc</code> derivations provide the rust toolchain in nixpkgs.
 
<syntaxHighlight lang="nix">
let
  # Pinned nixpkgs, deterministic. Last updated: 2/12/21.
  pkgs = import (fetchTarball("https://github.com/NixOS/nixpkgs/archive/a58a0b5098f0c2a389ee70eb69422a052982d990.tar.gz")) {};
 
  # Rolling updates, not deterministic.
  # pkgs = import (fetchTarball("channel:nixpkgs-unstable")) {};
in pkgs.mkShell {
  buildInputs = [ pkgs.cargo pkgs.rustc ];
}
</syntaxHighlight>


=== VSCode integration ===
=== VSCode integration ===
The [https://marketplace.visualstudio.com/items?itemName=rust-lang.rust rust-lang.rust] and [https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer matklad.rust-analyzer] VSCode extensions offer rust support. Most of the


== Installation via rustup ==
== Installation via rustup ==