esphome is still stuck on hypothesis 5.49 and tries to import things
that are gone in 6.0 and later. Using a package override here would be
costly as it would cause alot of rebuilds, as hypothesis is an integral
part of e.g. pytest.
We store esphome in the nix store, which results in its file permissions
being 0444. Esphome, when compiling a firmware image, will copy these
files from the nix store to a working directory. When updating between
versions it will notice these files changed and try to copy the new
version over, which would break, because the user had no write
permissions on the files.
❯ esphome compile 01e4ac.yml
INFO Reading configuration 01e4ac.yml...
INFO Detected timezone 'CET' with UTC offset 1 and daylight saving time from 27 March 02:00:00 to 30 October 03:00:00
INFO Generating C++ source...
ERROR Error copying file /nix/store/lmzrgl1arqfd98jcss4rsmmy6dbffddn-esphome-1.19.2/lib/python3.8/site-packages/esphome/components/api/api_connection.cpp to 01e4ac/src/esphome/components/api/api_connection.cpp: [Errno 13] Permission denied: '01e4ac/src/esphome/components/api/api_connection.cpp'
To fix this we modify chmod to 0644 just before esphome tries a copy
operation, which will fix permissions on existing working directories
just in time.