From 64e622d47e88df019eb75c40002555f797d10375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alja=C5=BE=20Mur=20Er=C5=BEen?= Date: Thu, 2 Jan 2025 12:15:13 +0100 Subject: [PATCH 1/3] esp32 rust shell --- flake.nix | 1 + shells/esp32-idf-rust.nix | 42 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 shells/esp32-idf-rust.nix 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/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" + ''; +} From edf7a7ef2902b66933b34d953e613e7d8d12b2d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alja=C5=BE=20Mur=20Er=C5=BEen?= Date: Sun, 19 Jan 2025 16:49:20 +0100 Subject: [PATCH 2/3] Update rust version to 1.84 --- pkgs/rust-xtensa-bin.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/rust-xtensa-bin.nix b/pkgs/rust-xtensa-bin.nix index acf9892..be5fd80 100644 --- a/pkgs/rust-xtensa-bin.nix +++ b/pkgs/rust-xtensa-bin.nix @@ -1,4 +1,4 @@ -{ version ? "1.80.0.0" +{ version ? "1.84.0.0" , callPackage , rust , lib @@ -32,11 +32,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-W2XeX5SLAxyfX6X+vUygPl1ChZPiNGWRyG02vm7+xsQ="; }; 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-FYWHR6kv+r9QN2tPkBJ5GcZupA6XSPMRJbxoGRhWRLA="; }; }; }; @@ -45,7 +45,7 @@ in assert stdenv.system == "x86_64-linux"; mkAggregated { pname = "rust-xtensa"; - date = "2024-06-06"; + date = "2025-01-19"; inherit version; availableComponents = selComponents; selectedComponents = [ selComponents.rustc selComponents.rust-src ]; From 29bd2fad27229f1f5389763befe96123814b04fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alja=C5=BE=20Mur=20Er=C5=BEen?= Date: Sat, 7 Jun 2025 14:27:33 +0200 Subject: [PATCH 3/3] Update to rust 1.86.0 --- pkgs/rust-xtensa-bin.nix | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/pkgs/rust-xtensa-bin.nix b/pkgs/rust-xtensa-bin.nix index be5fd80..7ad337e 100644 --- a/pkgs/rust-xtensa-bin.nix +++ b/pkgs/rust-xtensa-bin.nix @@ -1,26 +1,22 @@ -{ version ? "1.84.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-W2XeX5SLAxyfX6X+vUygPl1ChZPiNGWRyG02vm7+xsQ="; + 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-FYWHR6kv+r9QN2tPkBJ5GcZupA6XSPMRJbxoGRhWRLA="; + hash = "sha256-EPoxNiYUk6XZfU886bmLruXMWCiXEf5vJCSY/09lspo="; }; }; }; @@ -45,9 +41,11 @@ in assert stdenv.system == "x86_64-linux"; mkAggregated { pname = "rust-xtensa"; - date = "2025-01-19"; + date = "2025-06-07"; inherit version; availableComponents = selComponents; - selectedComponents = [ selComponents.rustc selComponents.rust-src ]; + selectedComponents = [ + selComponents.rustc + selComponents.rust-src + ]; } -