Nix devshell for Rust on ESP32 with pre-built compiler in a strict Bubblewrap sandbox

1 Like

Hi! More details in the README, but a tl;dr:

The ESP Rust toolchain story is a bit unusual, because the Xtensa architecture support is not yet available in the mainline Rust:

  • The esp-rs/rust fork ships pre-built rustc/rustdoc binaries.

  • It’s similar with Espressif ESP GCC toolchain.

  • Those binaries are big, powerful, and hard to audit.

  • At the same time, fully rebuilding the forked compiler from source in every project is slow, fragile, and requires lots of RAM.

[…]

We use Bubblewrap for this which is a “low-level unprivileged sandboxing tool used by Flatpak and similar projects.”

In effect: you can use the convenient upstream pre-builts for rustc/rustdoc (and the ESP GCC/GDB toolchain), without giving them almost any access to your machine.