2021-05-04 15:10:59 +00:00
|
|
|
{ lib
|
2023-01-27 01:40:06 +00:00
|
|
|
, callPackage
|
2021-05-04 15:10:59 +00:00
|
|
|
, python3
|
|
|
|
, fetchFromGitHub
|
|
|
|
, platformio
|
2022-11-27 20:27:41 +00:00
|
|
|
, esptool_3
|
2021-05-04 15:10:59 +00:00
|
|
|
, git
|
|
|
|
}:
|
2019-01-10 18:38:38 +00:00
|
|
|
|
2021-06-16 19:01:02 +00:00
|
|
|
let
|
2021-07-10 23:17:37 +00:00
|
|
|
python = python3.override {
|
|
|
|
packageOverrides = self: super: {
|
2022-02-10 04:03:20 +00:00
|
|
|
esphome-dashboard = self.callPackage ./dashboard.nix {};
|
2021-07-10 23:17:37 +00:00
|
|
|
};
|
|
|
|
};
|
2021-06-16 19:01:02 +00:00
|
|
|
in
|
2023-01-27 01:40:06 +00:00
|
|
|
python.pkgs.buildPythonApplication rec {
|
2019-01-18 15:13:58 +00:00
|
|
|
pname = "esphome";
|
2023-02-19 01:21:47 +00:00
|
|
|
version = "2023.2.2";
|
2021-11-17 09:34:09 +00:00
|
|
|
format = "setuptools";
|
2019-01-10 18:38:38 +00:00
|
|
|
|
2021-05-04 15:10:59 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
2022-05-25 03:57:13 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2023-02-19 01:21:47 +00:00
|
|
|
hash = "sha256-AhajZ9FaeG2WneYS2Gc8JU1Cii4StU+k+WMFF/fgP1w=";
|
2019-01-10 18:38:38 +00:00
|
|
|
};
|
|
|
|
|
2019-11-02 21:47:53 +00:00
|
|
|
postPatch = ''
|
2021-05-04 15:10:59 +00:00
|
|
|
# remove all version pinning (E.g tornado==5.1.1 -> tornado)
|
2020-09-15 19:47:26 +00:00
|
|
|
sed -i -e "s/==[0-9.]*//" requirements.txt
|
2021-05-04 15:10:59 +00:00
|
|
|
|
|
|
|
# drop coverage testing
|
|
|
|
sed -i '/--cov/d' pytest.ini
|
2019-11-02 21:47:53 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-04 15:10:59 +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
|
2023-01-27 01:40:06 +00:00
|
|
|
propagatedBuildInputs = with python.pkgs; [
|
2021-09-15 21:49:56 +00:00
|
|
|
aioesphomeapi
|
2021-05-04 15:10:59 +00:00
|
|
|
click
|
|
|
|
colorama
|
|
|
|
cryptography
|
2021-06-16 19:01:02 +00:00
|
|
|
esphome-dashboard
|
2021-05-04 15:10:59 +00:00
|
|
|
ifaddr
|
2021-10-20 19:46:58 +00:00
|
|
|
kconfiglib
|
2021-05-04 15:10:59 +00:00
|
|
|
paho-mqtt
|
|
|
|
pillow
|
2022-12-09 06:34:15 +00:00
|
|
|
platformio
|
2021-05-04 15:10:59 +00:00
|
|
|
protobuf
|
|
|
|
pyserial
|
|
|
|
pyyaml
|
2022-10-16 22:30:03 +00:00
|
|
|
requests
|
2021-05-04 15:10:59 +00:00
|
|
|
tornado
|
2021-10-20 19:46:58 +00:00
|
|
|
tzdata
|
2021-05-04 15:10:59 +00:00
|
|
|
tzlocal
|
|
|
|
voluptuous
|
|
|
|
];
|
|
|
|
|
2019-01-18 15:13:58 +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
|
2022-11-27 20:27:41 +00:00
|
|
|
"--prefix PATH : ${lib.makeBinPath [ platformio esptool_3 git ]}"
|
2019-01-18 15:13:58 +00:00
|
|
|
"--set ESPHOME_USE_SUBPROCESS ''"
|
2019-01-10 18:38:38 +00:00
|
|
|
];
|
|
|
|
|
2023-01-27 01:40:06 +00:00
|
|
|
nativeCheckInputs = with python.pkgs; [
|
2021-05-04 15:10:59 +00:00
|
|
|
hypothesis
|
|
|
|
mock
|
2021-06-16 19:01:02 +00:00
|
|
|
pytest-asyncio
|
2021-05-04 15:10:59 +00:00
|
|
|
pytest-mock
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2021-07-10 23:17:37 +00:00
|
|
|
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"
|
|
|
|
];
|
|
|
|
|
2021-05-04 15:10:59 +00:00
|
|
|
postCheck = ''
|
2020-04-09 18:00:22 +00:00
|
|
|
$out/bin/esphome --help > /dev/null
|
|
|
|
'';
|
2019-01-10 18:38:38 +00:00
|
|
|
|
2021-06-16 19:01:02 +00:00
|
|
|
passthru = {
|
2023-01-27 01:40:06 +00:00
|
|
|
dashboard = python.pkgs.esphome-dashboard;
|
2022-09-29 12:31:01 +00:00
|
|
|
updateScript = callPackage ./update.nix {};
|
2021-06-16 19:01:02 +00:00
|
|
|
};
|
|
|
|
|
2019-01-10 18:38:38 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Make creating custom firmwares for ESP32/ESP8266 super easy";
|
2020-04-09 18:00:22 +00:00
|
|
|
homepage = "https://esphome.io/";
|
2021-05-04 15:10:59 +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
|
|
|
|
];
|
2022-07-04 10:41:44 +00:00
|
|
|
maintainers = with maintainers; [ globin hexa ];
|
2019-01-10 18:38:38 +00:00
|
|
|
};
|
|
|
|
}
|