This is a flake that knows how to build and flash MicroPython. It can either be invoked directly to build a basic firmware, or it can be used as an input flake and be used as a tool to build a custom firmware.
nix run github:jonahbron/micropython-builder#flash-esp32c3-generic
Warning
Because a network connection is currently required to build firmware for ESP32 devices, flashing directly from the terminal will only work on non-x86_64 systems. You must create your own flake with your own sha256.
Builds fail without Internet access (IDFGH-12120) (PACMAN-808) #54
See examples directory or a real project for how to use this builder in your own flake. The examples are also a flake and can be run directly.
nix build ./examples#
Note
Contributions of other MicroPython ports/boards are extremely welcome!
- Flake package that can be run like
nix build .#esp32c3-generic
- Default output is firmware.bin
- Other output portions can be accessed too
nix build .#esp32GenericC3.bootloader
- Flake package that can be run like
nix run .#flash-esp32-generic
- Flake library that can be called like
buildMicroPythonFirmware
- Allows specifying the port/board
- Accepts arguments pointing to manifest.py
- Accepts arguments pointing to user_c_modules
- Allow patch phase script
- Allow overriding the micropython source
- Allow overriding the micropython-lib source
- Flake library that can be called like
flashMicroPythonFirmware
- Make interface more ergonomic, require less knowledge
- Make fixed-output derivations optional
- Factor out common ESP32 expressions
- Allow generating firmware with LittleFS partitions/other partition table customizations
- Add nix formatter
- Flake template
- GitHub Action that attempts to regularly update dependencies
- Contribute into nixpkgs?