Rust: Difference between revisions

imported>Srid
Meta summary of nix + rust
imported>Legendofmiracles
adds a example shell.nix file for rust development
Line 89: Line 89:
})
})
</syntaxHighlight>
</syntaxHighlight>
== shell.nix example ==
<syntaxHighlight lang="nix">
{ pkgs ? import <nixpkgs> {}  }:
pkgs.mkShell {
          nativeBuildInputs = with pkgs; [ rustc cargo gcc ];
          buildInputs = with pkgs; [ rustfmt clippy ];
          RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
}
</syntaxHighlight>
This will have the stable rust compiler + the official formatter and linter inside the ephemeral shell. It'll also set the RUST_SRC_PATH environment variable to point to the right location, so that tools like rust-analyzer will work.


== FAQ ==
== FAQ ==