Files
projekt1/flake.nix
2025-10-15 11:17:03 +02:00

59 lines
1.5 KiB
Nix
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
description = "ESP32-D0WD-V3 (esp32-hal) Rust dev flake";
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; };
outputs = { self, nixpkgs }: let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in {
devShells.${system}.default = pkgs.mkShell {
packages = with pkgs; [
llvm
cmake
ninja
python3
pkg-config
git
curl
wget
unzip
gcc
gnumake
rustup
rust-analyzer
cargo-espflash
espup
mosquitto
];
shellHook = ''
echo ">>> ESP32 DevShell (esp-hal only)"
if [ ! -d "$HOME/.espup" ]; then
echo "Running espup install..."
espup install
fi
# Ensure the real rust-analyzer from Nix is used (not rustup's shim)
export PATH=${pkgs.rust-analyzer}/bin:$PATH
# Keep ESP toolchain binaries on PATH for building/flashing
# (do NOT set RUSTUP_TOOLCHAIN=esp globally; that breaks rust-analyzer)
export PATH=$HOME/.rustup/toolchains/esp/bin:$PATH
# Add GCC/binutils path for xtensa-esp32-elf-gcc
export PATH=$HOME/.rustup/toolchains/esp/xtensa-esp-elf/esp-14.2.0_20240906/xtensa-esp-elf/bin:$PATH
# Helpers that force the ESP toolchain explicitly when needed
alias cargo-esp="RUSTUP_TOOLCHAIN=esp cargo"
alias rustc-esp="RUSTUP_TOOLCHAIN=esp rustc"
echo "Xtensa Rust toolchain ready."
rustc --version
which xtensa-esp32-elf-gcc || echo " xtensa-esp32-elf-gcc not found in PATH"
'';
};
};
}