diff --git a/flake.nix b/flake.nix index c004686..90e05d8 100644 --- a/flake.nix +++ b/flake.nix @@ -37,6 +37,7 @@ devShells = { esp-idf-full = import ./shells/esp-idf-full.nix { inherit pkgs; }; esp32-idf = import ./shells/esp32-idf.nix { inherit pkgs; }; + esp32-idf-rust = import ./shells/esp32-idf-rust.nix { inherit pkgs; }; esp32c3-idf = import ./shells/esp32c3-idf.nix { inherit pkgs; }; esp32s2-idf = import ./shells/esp32s2-idf.nix { inherit pkgs; }; esp32s2-idf-rust = import ./shells/esp32s2-idf-rust.nix { inherit pkgs; }; diff --git a/pkgs/rust-xtensa-bin.nix b/pkgs/rust-xtensa-bin.nix index acf9892..7ad337e 100644 --- a/pkgs/rust-xtensa-bin.nix +++ b/pkgs/rust-xtensa-bin.nix @@ -1,26 +1,22 @@ -{ version ? "1.80.0.0" -, callPackage -, rust -, lib -, stdenv -, fetchurl +{ + version ? "1.86.0.0", + callPackage, + rust, + lib, + stdenv, + fetchurl, }: let component = import { }; # Remove keys from attrsets whose value is null. - removeNulls = set: - removeAttrs set - (lib.filter (name: set.${name} == null) - (lib.attrNames set)); + removeNulls = set: removeAttrs set (lib.filter (name: set.${name} == null) (lib.attrNames set)); # FIXME: https://github.com/NixOS/nixpkgs/pull/146274 - toRustTarget = platform: - if platform.isWasi then - "${platform.parsed.cpu.name}-wasi" - else - rust.toRustTarget platform; + toRustTarget = + platform: + if platform.isWasi then "${platform.parsed.cpu.name}-wasi" else rust.toRustTarget platform; mkComponentSet = callPackage ./rust/mk-component-set.nix { inherit toRustTarget removeNulls; - # src = + # src = }; mkAggregated = callPackage ./rust/mk-aggregated.nix { }; @@ -32,11 +28,11 @@ let srcs = { rustc = fetchurl { url = "https://github.com/esp-rs/rust-build/releases/download/v${version}/rust-${version}-x86_64-unknown-linux-gnu.tar.xz"; - hash = "sha256-08yHjWmTZFkFEyT3Ypjx/cVc4aRJLNkITM2vjVPPV9U="; + hash = "sha256-CqqIgIvYfI10aXTRpS3TnyaMCpsRtdCaMnW3r+qN1V0="; }; rust-src = fetchurl { url = "https://github.com/esp-rs/rust-build/releases/download/v${version}/rust-src-${version}.tar.xz"; - hash = "sha256-7OIGrBpgOc8dJGTgdpu1AfV9J+VJ4N4Bw5X5l1psho8="; + hash = "sha256-EPoxNiYUk6XZfU886bmLruXMWCiXEf5vJCSY/09lspo="; }; }; }; @@ -45,9 +41,11 @@ in assert stdenv.system == "x86_64-linux"; mkAggregated { pname = "rust-xtensa"; - date = "2024-06-06"; + date = "2025-06-07"; inherit version; availableComponents = selComponents; - selectedComponents = [ selComponents.rustc selComponents.rust-src ]; + selectedComponents = [ + selComponents.rustc + selComponents.rust-src + ]; } - diff --git a/shells/esp32-idf-rust.nix b/shells/esp32-idf-rust.nix new file mode 100644 index 0000000..7497761 --- /dev/null +++ b/shells/esp32-idf-rust.nix @@ -0,0 +1,42 @@ +{ pkgs ? import ../default.nix }: +pkgs.mkShell { + name = "esp-idf-esp32-rust"; + + buildInputs = with pkgs; [ + esp-idf-esp32 + + # Tools required to use ESP-IDF. + git + wget + gnumake + + flex + bison + gperf + pkg-config + cargo-generate + + cmake + ninja + + ncurses5 + + llvm-xtensa + llvm-xtensa-lib + rust-xtensa + + espflash + ldproxy + + python3 + python3Packages.pip + python3Packages.virtualenv + ]; + shellHook = '' + # fixes libstdc++ issues and libgl.so issues + export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [ pkgs.libxml2 pkgs.zlib pkgs.stdenv.cc.cc.lib ]} + export ESP_IDF_VERSION=v4.4.1 + export LIBCLANG_PATH=${pkgs.llvm-xtensa-lib}/lib + export RUSTFLAGS="--cfg espidf_time64" + ''; +}