nixpkgs/pkgs/tools/misc/esphome/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

140 lines
3.4 KiB
Nix
Raw Normal View History

{ lib
, callPackage
, python3Packages
, fetchFromGitHub
2023-12-19 12:31:47 +00:00
, installShellFiles
, platformio
, esptool
, git
, inetutils
, stdenv
}:
2019-01-10 18:38:38 +00:00
2021-06-16 20:01:02 +01:00
let
python = python3Packages.python.override {
packageOverrides = self: super: {
2023-12-19 12:31:47 +00:00
esphome-dashboard = self.callPackage ./dashboard.nix { };
};
};
2021-06-16 20:01:02 +01:00
in
python.pkgs.buildPythonApplication rec {
2019-01-18 15:13:58 +00:00
pname = "esphome";
version = "2024.2.0";
pyproject = true;
2019-01-10 18:38:38 +00:00
src = fetchFromGitHub {
owner = pname;
repo = pname;
2022-05-25 04:57:13 +01:00
rev = "refs/tags/${version}";
hash = "sha256-k8caA5Q4QcP7H1Nn5yvFsfExVwipAlFSb/DphkzYNtU=";
2019-01-10 18:38:38 +00:00
};
nativeBuildInputs = with python.pkgs; [
setuptools
2023-12-19 12:31:47 +00:00
argcomplete
installShellFiles
pythonRelaxDepsHook
];
pythonRelaxDeps = true;
postPatch = ''
# drop coverage testing
sed -i '/--cov/d' pytest.ini
2019-11-02 21:47:53 +00:00
'';
# Remove esptool and platformio from requirements
ESPHOME_USE_SUBPROCESS = "";
# esphome has optional dependencies it does not declare, they are
# loaded when certain config blocks are used, like `font`, `image`
# or `animation`.
# They have validation functions like:
# - validate_cryptography_installed
# - validate_pillow_installed
propagatedBuildInputs = with python.pkgs; [
2021-09-15 22:49:56 +01:00
aioesphomeapi
argcomplete
click
colorama
cryptography
2021-06-16 20:01:02 +01:00
esphome-dashboard
2021-10-20 20:46:58 +01:00
kconfiglib
icmplib
paho-mqtt
pillow
platformio
protobuf
pyparsing
pyserial
python-magic
pyyaml
requests
tornado
2021-10-20 20:46:58 +01:00
tzdata
tzlocal
voluptuous
];
2019-01-18 15:13:58 +00:00
makeWrapperArgs = [
# platformio is used in esphome/platformio_api.py
# esptool is used in esphome/__main__.py
# git is used in esphome/writer.py
# inetutils is used in esphome/dashboard/status/ping.py
"--prefix PATH : ${lib.makeBinPath [ platformio esptool git inetutils ]}"
"--prefix PYTHONPATH : ${python.pkgs.makePythonPath propagatedBuildInputs}" # will show better error messages
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}"
2019-01-18 15:13:58 +00:00
"--set ESPHOME_USE_SUBPROCESS ''"
2019-01-10 18:38:38 +00:00
];
# Needed for tests
__darwinAllowLocalNetworking = true;
nativeCheckInputs = with python3Packages; [
hypothesis
mock
2021-06-16 20:01:02 +01:00
pytest-asyncio
pytest-mock
pytestCheckHook
];
disabledTestPaths = [
# requires hypothesis 5.49, we have 6.x
# ImportError: cannot import name 'ip_addresses' from 'hypothesis.provisional'
"tests/unit_tests/test_core.py"
"tests/unit_tests/test_helpers.py"
];
postCheck = ''
2020-04-09 19:00:22 +01:00
$out/bin/esphome --help > /dev/null
'';
2019-01-10 18:38:38 +00:00
2023-12-19 12:31:47 +00:00
postInstall =
let
argcomplete = lib.getExe' python3Packages.argcomplete "register-python-argcomplete";
in
''
installShellCompletion --cmd esphome \
--bash <(${argcomplete} --shell bash esphome) \
--zsh <(${argcomplete} --shell zsh esphome) \
--fish <(${argcomplete} --shell fish esphome)
'';
2021-06-16 20:01:02 +01:00
passthru = {
dashboard = python.pkgs.esphome-dashboard;
2023-12-19 12:31:47 +00:00
updateScript = callPackage ./update.nix { };
2021-06-16 20:01:02 +01:00
};
2019-01-10 18:38:38 +00:00
meta = with lib; {
changelog = "https://github.com/esphome/esphome/releases/tag/${version}";
2019-01-10 18:38:38 +00:00
description = "Make creating custom firmwares for ESP32/ESP8266 super easy";
2020-04-09 19:00:22 +01:00
homepage = "https://esphome.io/";
license = with licenses; [
mit # The C++/runtime codebase of the ESPHome project (file extensions .c, .cpp, .h, .hpp, .tcc, .ino)
gpl3Only # The python codebase and all other parts of this codebase
];
maintainers = with maintainers; [ globin hexa ];
2023-11-27 01:17:53 +00:00
mainProgram = "esphome";
2019-01-10 18:38:38 +00:00
};
}