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

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

109 lines
2.5 KiB
Nix
Raw Normal View History

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