I’m new to NixOS (v25.11). I am trying to begin programming for the ESP32 chip, but for now I am testing the Hello World example provided by Espressif, because I faced some errors when trying to start a new project and learned a lot on the way.
I followed the NixOS Wiki page and IDF repo README and used nix develop github:mirrexagon/nixpkgs-esp-dev#esp-idf-full to fetch the environment and load the shell from this repo: GitHub - mirrexagon/nixpkgs-esp-dev: Nix flake and overlay for ESP8266 and ESP32 development. · GitHub. That works, because when I copy the hello-world example and build it with idf.py build, it is built, so I can be certain about the PATH being set correctly.
However, I have trouble using qemu-system-xtensa. According to the ESP-IDF docs ( QEMU Emulator - ESP32-S3 - — ESP-IDF Programming Guide v6.0 documentation ), I can run it using idf.py qemu monitor. While inside the shell, running that command in the project folder produces this output:
Running qemu on socket://localhost:5555
Adding "qemu"'s dependency "all" to list of commands with default set of options.
Executing action: all (aliases: build)
Running ninja in directory /home/troy/esp/hello_world/build
Executing "ninja all"...
[1/4] cd /home/troy/esp/hello_world/build/esp-idf/esptool_py && /nix/store/yxn8caq88x7ncmsbvqn51wk7pwqmvivc-python3-3.../home/troy/esp/hello_world/build/partition_table/partition-table.bin /home/troy/esp/hello_world/build/hello_world.bin
hello_world.bin binary size 0x21850 bytes. Smallest app partition is 0x100000 bytes. 0xde7b0 bytes (87%) free.
[1/1] cd /home/troy/esp/hello_world/build/bootloader/esp-idf/esptool_py && /nix/store/yxn8caq88x7ncmsbvqn51wk7pwqmviv...ion_table/check_sizes.py --offset 0x8000 bootloader 0x1000 /home/troy/esp/hello_world/build/bootloader/bootloader.bin
Bootloader binary size 0x66c0 bytes. 0x940 bytes (8%) free.
[4/4] Completed 'bootloader'Executing action: qemu
qemu-system-xtensa is not installed. Please install it using "python $IDF_PATH/tools/idf_tools.py install qemu-xtensa" or build it from source if the pre-built version is not available for your platform.
After that, I tried to use the overlay that comes with the repo, because the overlay.nix file specifies the package for the QEMU fork. I cloned the repo into ~/.config/nixpkgs/overlays/, but that doesn’t solve the issue (I also tried just copying its overlay.nix and placing it under `~/.config/nixpkgs/`). I believe I’m missing a step, because I haven’t used overlays before.
Should I just use this GitHub - SFrijters/nix-qemu-espressif: Nix flake for qemu with ESP32 and ESP32C3 support, built from the Espressif fork - for an example of usage see https://github.com/SFrijters/nix-qemu-esp32c3-rust-example · GitHub instead? I find it odd because the IDF repo contains the QEMU package under pkgs/qemu-esp32, so why can’t I find the binary? What particular command should I use to load it into the shell?