3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/misc/esphome/default.nix

108 lines
2.5 KiB
Nix
Raw Normal View History

{ lib
2021-06-16 20:01:02 +01:00
, pkgs
, python3
, fetchFromGitHub
, platformio
, esptool
, git
}:
2019-01-10 18:38:38 +00:00
2021-06-16 20:01:02 +01:00
let
python = python3.override {
packageOverrides = self: super: {
esphome-dashboard = pkgs.callPackage ./dashboard.nix {};
};
};
2021-06-16 20:01:02 +01:00
in
with python.pkgs; buildPythonApplication rec {
2019-01-18 15:13:58 +00:00
pname = "esphome";
2021-08-04 17:10:33 +01:00
version = "1.20.4";
2019-01-10 18:38:38 +00:00
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "v${version}";
2021-08-04 17:10:33 +01:00
sha256 = "sha256-Z2/7J8F9o+ZY+7Q9bpAT79yHqUFyJu9usu4XI4PhpCI=";
2019-01-10 18:38:38 +00:00
};
patches = [
# fix missing write permissions on src files before modifing them
./fix-src-permissions.patch
];
2019-11-02 21:47:53 +00: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 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 = [
click
colorama
cryptography
2021-06-16 20:01:02 +01:00
esphome-dashboard
ifaddr
paho-mqtt
pillow
protobuf
pyserial
pyyaml
tornado
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
"--prefix PATH : ${lib.makeBinPath [ platformio esptool git ]}"
"--set ESPHOME_USE_SUBPROCESS ''"
2019-01-10 18:38:38 +00:00
];
checkInputs = [
hypothesis
mock
2021-06-16 20:01:02 +01:00
pytest-asyncio
pytest-mock
2021-05-19 02:09:19 +01:00
pytest-sugar
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
2021-06-16 20:01:02 +01:00
passthru = {
dashboard = esphome-dashboard;
};
2019-01-10 18:38:38 +00:00
meta = with lib; {
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
];
2021-05-04 13:34:18 +01:00
maintainers = with maintainers; [ globin elseym hexa ];
2019-01-10 18:38:38 +00:00
};
}