15 python = python3Packages.python.override {
17 packageOverrides = self: super: {
18 esphome-dashboard = self.callPackage ./dashboard.nix { };
22 python.pkgs.buildPythonApplication rec {
24 version = "2024.10.2";
27 src = fetchFromGitHub {
30 rev = "refs/tags/${version}";
31 hash = "sha256-WEsFgmwH6OGkAn1c0h/HBhBJr2329YHSKMZzjEDTKNg=";
34 build-systems = with python.pkgs; [
43 pythonRelaxDeps = true;
51 substituteInPlace pyproject.toml \
52 --replace-fail "setuptools==" "setuptools>=" \
53 --replace-fail "wheel~=" "wheel>="
55 # ensure component dependencies are available
56 cat requirements_optional.txt >> requirements.txt
57 # relax strict runtime version check
58 substituteInPlace esphome/components/font/__init__.py \
59 --replace-fail "10.2.0" "${python.pkgs.pillow.version}"
62 # Remove esptool and platformio from requirements
63 env.ESPHOME_USE_SUBPROCESS = "";
65 # esphome has optional dependencies it does not declare, they are
66 # loaded when certain config blocks are used, like `font`, `image`
68 # They have validation functions like:
69 # - validate_cryptography_installed
70 # - validate_pillow_installed
71 dependencies = with python.pkgs; [
99 # platformio is used in esphome/platformio_api.py
100 # esptool is used in esphome/__main__.py
101 # git is used in esphome/writer.py
102 # inetutils is used in esphome/dashboard/status/ping.py
103 "--prefix PATH : ${lib.makeBinPath [ platformio esptool git inetutils ]}"
104 "--prefix PYTHONPATH : ${python.pkgs.makePythonPath dependencies}" # will show better error messages
105 "--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}"
106 "--set ESPHOME_USE_SUBPROCESS ''"
110 __darwinAllowLocalNetworking = true;
112 nativeCheckInputs = with python3Packages; [
122 $out/bin/esphome --help > /dev/null
127 argcomplete = lib.getExe' python3Packages.argcomplete "register-python-argcomplete";
130 installShellCompletion --cmd esphome \
131 --bash <(${argcomplete} --shell bash esphome) \
132 --zsh <(${argcomplete} --shell zsh esphome) \
133 --fish <(${argcomplete} --shell fish esphome)
137 dashboard = python.pkgs.esphome-dashboard;
138 updateScript = callPackage ./update.nix { };
139 tests = { inherit (nixosTests) esphome; };
143 changelog = "https://github.com/esphome/esphome/releases/tag/${version}";
144 description = "Make creating custom firmwares for ESP32/ESP8266 super easy";
145 homepage = "https://esphome.io/";
146 license = with licenses; [
147 mit # The C++/runtime codebase of the ESPHome project (file extensions .c, .cpp, .h, .hpp, .tcc, .ino)
148 gpl3Only # The python codebase and all other parts of this codebase
150 maintainers = with maintainers; [ globin hexa ];
151 mainProgram = "esphome";