2021-05-20 23:08:51 +00:00
|
|
|
{ lib
|
2021-06-28 23:13:55 +00:00
|
|
|
, pkgs
|
2021-05-20 23:08:51 +00:00
|
|
|
, python3
|
|
|
|
, fetchFromGitHub
|
|
|
|
, platformio
|
|
|
|
, esptool
|
|
|
|
, git
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
let
|
|
|
|
esphome-dashboard = pkgs.callPackage ./dashboard.nix {};
|
|
|
|
in
|
2021-05-20 23:08:51 +00:00
|
|
|
python3.pkgs.buildPythonApplication rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "esphome";
|
2021-06-28 23:13:55 +00:00
|
|
|
version = "1.19.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-06-28 23:13:55 +00:00
|
|
|
sha256 = "029ykjk24h21b0s0gha6kv9pvgallin6marzkb2vfbvr3icsmbz2";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
patches = [
|
|
|
|
# fix missing write permissions on src files before modifing them
|
|
|
|
./fix-src-permissions.patch
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
2021-05-20 23:08:51 +00:00
|
|
|
# remove all version pinning (E.g tornado==5.1.1 -> tornado)
|
2020-10-07 09:15:18 +00:00
|
|
|
sed -i -e "s/==[0-9.]*//" requirements.txt
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
# drop coverage testing
|
|
|
|
sed -i '/--cov/d' pytest.ini
|
|
|
|
|
|
|
|
# migrate use of hypothesis internals to be compatible with hypothesis>=5.32.1
|
|
|
|
# https://github.com/esphome/issues/issues/2021
|
|
|
|
substituteInPlace tests/unit_tests/strategies.py --replace \
|
|
|
|
"@st.defines_strategy_with_reusable_values" \
|
|
|
|
"@st.defines_strategy(force_reusable_values=True)"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +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 python3.pkgs; [
|
|
|
|
click
|
|
|
|
colorama
|
|
|
|
cryptography
|
2021-06-28 23:13:55 +00:00
|
|
|
esphome-dashboard
|
2021-05-20 23:08:51 +00:00
|
|
|
ifaddr
|
|
|
|
paho-mqtt
|
|
|
|
pillow
|
|
|
|
protobuf
|
|
|
|
pyserial
|
|
|
|
pyyaml
|
|
|
|
tornado
|
|
|
|
tzlocal
|
|
|
|
voluptuous
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
makeWrapperArgs = [
|
|
|
|
# platformio is used in esphomeyaml/platformio_api.py
|
|
|
|
# esptool is used in esphomeyaml/__main__.py
|
|
|
|
# git is used in esphomeyaml/writer.py
|
|
|
|
"--prefix PATH : ${lib.makeBinPath [ platformio esptool git ]}"
|
|
|
|
"--set ESPHOME_USE_SUBPROCESS ''"
|
|
|
|
];
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
checkInputs = with python3.pkgs; [
|
|
|
|
hypothesis
|
|
|
|
mock
|
2021-06-28 23:13:55 +00:00
|
|
|
pytest-asyncio
|
2021-05-20 23:08:51 +00:00
|
|
|
pytest-mock
|
|
|
|
pytest-sugar
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
postCheck = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
$out/bin/esphome --help > /dev/null
|
|
|
|
'';
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
passthru = {
|
|
|
|
dashboard = esphome-dashboard;
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Make creating custom firmwares for ESP32/ESP8266 super easy";
|
|
|
|
homepage = "https://esphome.io/";
|
2021-05-20 23:08:51 +00:00
|
|
|
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
|
|
|
|
];
|
2021-05-04 21:07:42 +00:00
|
|
|
maintainers = with maintainers; [ globin elseym hexa ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|