maasier/spinnyboy_rust/shell.nix
2026-01-08 22:08:39 +01:00

28 lines
826 B
Nix

{ pkgs ? import <nixpkgs> {
overlays = [
(import (builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz"))
];
}
}:
let
# Define the specific toolchain with ESP32-C6 support
rustToolchain = pkgs.rust-bin.selectLatestNightlyWith(toolchain: toolchain.default.override {
targets = [ "riscv32imac-unknown-none-elf" ];
extensions = [ "rust-src" "llvm-tools-preview" ];
});
in
pkgs.mkShell {
nativeBuildInputs = [
rustToolchain
pkgs.probe-rs-tools
pkgs.espflash # For flashing your ESP32-C6
pkgs.pkg-config
pkgs.gcc # Critical: provides the 'cc' wrapper script
];
# Injects necessary library paths for the Nix-wrapped linker
shellHook = ''
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc ]}"
'';
}