Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/svelterust/esp32

Rust with Xtensa support Nix using flakes.
https://github.com/svelterust/esp32

esp32 rust

Last synced: 3 months ago
JSON representation

Rust with Xtensa support Nix using flakes.

Awesome Lists containing this project

README

        

# esp32

Rust with Xtensa support for Nix using flakes.

```
$ nix flake show github:knarkzel/esp32
└───packages
└───x86_64-linux
└───esp32: package 'esp32'
$ nix build github:knarkzel/esp32#esp32
$ ls -a result
. .. .cargo .rustup
```

## Minimal example

```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
esp32 = {
url = "github:knarkzel/esp32";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = {
self,
nixpkgs,
esp32,
}: let
pkgs = import nixpkgs {system = "x86_64-linux";};
idf-rust = esp32.packages.x86_64-linux.esp32;
in {
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = [
idf-rust
];

shellHook = ''
export PATH="${idf-rust}/.rustup/toolchains/esp/bin:$PATH"
export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
'';
};
};
}
```

## Getting started

Use the above flake, then follow the [Rust on ESP Book](https://esp-rs.github.io/book/writing-your-own-application/generate-project-from-template.html).

## Notes

When building from source, you need a huge amount of memory, about 36 GB.
To create temporary swap, use following commands:

```
$ fallocate -l 36G /tmp/swap; mkswap /tmp/swap; swapon /tmp/swap
```