Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; };
Expand Down
40 changes: 19 additions & 21 deletions pkgs/rust-xtensa-bin.nix
Original file line number Diff line number Diff line change
@@ -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 { };
Expand All @@ -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=";
};
};
};
Expand All @@ -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
];
}

42 changes: 42 additions & 0 deletions shells/esp32-idf-rust.nix
Original file line number Diff line number Diff line change
@@ -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"
'';
}