{
description = "Rust development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# Rust toolchain
rustc
cargo
rustfmt
clippy
rust-analyzer
# C/C++ compiler
# clang
];
# Environment variables
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
# Use clang as the default C/C++ compiler
# CC = "clang";
# CXX = "clang++";
};
}
);
}