diff --git a/pkgs/by-name/es/esphome/esp32-post-build-esptool-reference.patch b/pkgs/by-name/es/esphome/esp32-post-build-esptool-reference.patch new file mode 100644 index 000000000000..6f323145e85f --- /dev/null +++ b/pkgs/by-name/es/esphome/esp32-post-build-esptool-reference.patch @@ -0,0 +1,13 @@ +diff --git a/esphome/components/esp32/post_build.py.script b/esphome/components/esp32/post_build.py.script +index c99521423..e29821d7e 100644 +--- a/esphome/components/esp32/post_build.py.script ++++ b/esphome/components/esp32/post_build.py.script +@@ -88,8 +88,6 @@ def merge_factory_bin(source, target, env): + output_path = firmware_path.with_suffix(".factory.bin") + python_exe = f'"{env.subst("$PYTHONEXE")}"' + cmd = [ +- python_exe, +- "-m", + "esptool", + "--chip", + chip, diff --git a/pkgs/by-name/es/esphome/package.nix b/pkgs/by-name/es/esphome/package.nix index 8ddc1417ae04..fce4a85e7f8c 100644 --- a/pkgs/by-name/es/esphome/package.nix +++ b/pkgs/by-name/es/esphome/package.nix @@ -44,6 +44,14 @@ python.pkgs.buildPythonApplication rec { hash = "sha256-LOHsiSiqeCLrKLcVfAiPZl54aDTaYuKw073h0XMDiTE="; }; + patches = [ + # Use the esptool executable directly in the ESP32 post build script, that + # gets executed by platformio. This is required, because platformio uses its + # own python environment through `python -m esptool` and then fails to find + # the esptool library. + ./esp32-post-build-esptool-reference.patch + ]; + build-system = with python.pkgs; [ setuptools ];