fix(esphome): add patch to fix python env
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
277a462031
commit
6e2c84a050
1 changed files with 38 additions and 1 deletions
|
@ -47,6 +47,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
# Fixes https://github.com/NixOS/nixpkgs/issues/339557
|
||||||
users = {
|
users = {
|
||||||
users.esphome = {
|
users.esphome = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
@ -56,7 +57,42 @@ in {
|
||||||
groups.esphome = {};
|
groups.esphome = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/issues/339557
|
# Fixes https://github.com/NixOS/nixpkgs/issues/370611
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(final: prev: {
|
||||||
|
esphome = prev.esphome.overrideAttrs (o: {
|
||||||
|
patches = [
|
||||||
|
(builtins.toFile "post-build.patch" ''
|
||||||
|
--- a/esphome/components/esp32/post_build.py.script
|
||||||
|
+++ b/esphome/components/esp32/post_build.py.script
|
||||||
|
@@ -2,10 +2,13 @@
|
||||||
|
|
||||||
|
# pylint: disable=E0602
|
||||||
|
Import("env") # noqa
|
||||||
|
+#print(env.Dump())
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
+os.environ["PATH"] = os.path.dirname(env.get("PYTHONEXE")) + os.pathsep + os.environ["PATH"]
|
||||||
|
+
|
||||||
|
if os.environ.get("ESPHOME_USE_SUBPROCESS") is None:
|
||||||
|
try:
|
||||||
|
import esptool
|
||||||
|
@@ -63,6 +66,7 @@ def esp32_create_combined_bin(source, target, env):
|
||||||
|
esptool.main(cmd)
|
||||||
|
else:
|
||||||
|
subprocess.run(["esptool.py", *cmd])
|
||||||
|
+ #subprocess.run([env.get("PYTHONEXE"), "/var/lib/esphome/.platformio/packages/tool-esptoolpy/esptool.py", *cmd])
|
||||||
|
|
||||||
|
|
||||||
|
def esp32_copy_ota_bin(source, target, env):
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
});
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
systemd.services.esphome = {
|
systemd.services.esphome = {
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
(optionalAttrs (cfg.firmwareConfigs != {}) {
|
(optionalAttrs (cfg.firmwareConfigs != {}) {
|
||||||
|
@ -94,6 +130,7 @@ in {
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
// {
|
// {
|
||||||
|
# Fixes https://github.com/NixOS/nixpkgs/issues/339557
|
||||||
DynamicUser = mkForce "off";
|
DynamicUser = mkForce "off";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue