nix-git/modules/rust.nix

50 lines
1.5 KiB
Nix
Raw Permalink Normal View History

2024-11-21 23:12:19 +01:00
# We use the unofficial overlay oxalica/rust-overlay
# https://nixos.wiki/wiki/Rust#Unofficial_overlays
# Example for oxalica/rust-overlay
# https://nixos.wiki/wiki/Rust#Custom_Rust_version
# rust-analyzer
# https://rust-analyzer.github.io/
# rust-analyzer is an implementation of Language Server Protocol for the Rust programming language. It provides features like completion and goto definition for many code editors, including VS Code, Emacs and Vim.
2024-11-21 23:18:43 +01:00
# pkg-config
# Used in these two examples
# https://nixos.wiki/wiki/Rust#Custom_Rust_version
# https://github.com/oxalica/rust-overlay/blob/master/examples/cross-aarch64/shell.nix
# Explanation:
# https://nixos.wiki/wiki/Rust#Building_Rust_crates_that_require_external_system_libraries
# Rust crates using external system libraries often depend on pkg.config
# While we could add it system wide, it is probably best to use a shell.nix file in some code project.
2024-11-11 14:06:54 +01:00
{ config, pkgs, ... }:
let
#rustVersion = pkgs.rust-bin.stable."1.81.0".default.override {
rustVersion = pkgs.rust-bin.stable.latest.default.override {
2024-11-21 23:12:19 +01:00
extensions = [
"rust-src"
"rust-analyzer"
];
2024-11-11 14:06:54 +01:00
#targets = [
# "x86_64-unknown-linux-musl"
# #"arm-unknown-linux-gnueabihf"
# #"wasm32-wasi"
# #"wasm32-unknown-unknown"
#];
};
2024-11-21 22:44:07 +01:00
# This is depreciated.
#rustPlatform = pkgs.makeRustPlatform {
# cargo = rustVersion;
# rustc = rustVersion;
#};
2024-11-11 14:06:54 +01:00
in
{
environment.systemPackages = with pkgs; [
2024-11-21 22:44:07 +01:00
# This is depreciated.
#rustPlatform.rust.cargo
rustVersion
2024-11-11 14:06:54 +01:00
];
}