2021-05-04 16:10:59 +01:00
|
|
|
{ lib
|
2023-01-27 01:40:06 +00:00
|
|
|
, callPackage
|
2023-11-15 13:55:39 +00:00
|
|
|
, python3Packages
|
2021-05-04 16:10:59 +01:00
|
|
|
, fetchFromGitHub
|
2023-12-19 12:31:47 +00:00
|
|
|
, installShellFiles
|
2021-05-04 16:10:59 +01:00
|
|
|
, platformio
|
2023-12-16 02:00:35 +00:00
|
|
|
, esptool
|
2021-05-04 16:10:59 +01:00
|
|
|
, git
|
2024-01-27 17:20:21 +00:00
|
|
|
, inetutils
|
2024-01-28 15:57:31 +00:00
|
|
|
, stdenv
|
2021-05-04 16:10:59 +01:00
|
|
|
}:
|
2019-01-10 18:38:38 +00:00
|
|
|
|
2021-06-16 20:01:02 +01:00
|
|
|
let
|
2023-11-15 13:55:39 +00:00
|
|
|
python = python3Packages.python.override {
|
2021-07-11 00:17:37 +01:00
|
|
|
packageOverrides = self: super: {
|
2023-12-19 12:31:47 +00:00
|
|
|
esphome-dashboard = self.callPackage ./dashboard.nix { };
|
2021-07-11 00:17:37 +01:00
|
|
|
};
|
|
|
|
};
|
2021-06-16 20:01:02 +01:00
|
|
|
in
|
2023-01-27 01:40:06 +00:00
|
|
|
python.pkgs.buildPythonApplication rec {
|
2019-01-18 15:13:58 +00:00
|
|
|
pname = "esphome";
|
2024-02-22 00:10:51 +00:00
|
|
|
version = "2024.2.0";
|
2023-12-16 02:00:35 +00:00
|
|
|
pyproject = true;
|
2019-01-10 18:38:38 +00:00
|
|
|
|
2021-05-04 16:10:59 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
2022-05-25 04:57:13 +01:00
|
|
|
rev = "refs/tags/${version}";
|
2024-02-22 00:10:51 +00:00
|
|
|
hash = "sha256-k8caA5Q4QcP7H1Nn5yvFsfExVwipAlFSb/DphkzYNtU=";
|
2019-01-10 18:38:38 +00:00
|
|
|
};
|
|
|
|
|
2023-12-16 02:00:35 +00:00
|
|
|
nativeBuildInputs = with python.pkgs; [
|
|
|
|
setuptools
|
2023-12-19 12:31:47 +00:00
|
|
|
argcomplete
|
|
|
|
installShellFiles
|
2024-02-22 00:10:51 +00:00
|
|
|
pythonRelaxDepsHook
|
2023-12-16 02:00:35 +00:00
|
|
|
];
|
|
|
|
|
2024-02-22 00:10:51 +00:00
|
|
|
pythonRelaxDeps = true;
|
2021-05-04 16:10:59 +01:00
|
|
|
|
2024-02-22 00:10:51 +00:00
|
|
|
postPatch = ''
|
2021-05-04 16:10:59 +01:00
|
|
|
# drop coverage testing
|
|
|
|
sed -i '/--cov/d' pytest.ini
|
2019-11-02 21:47:53 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-04 16:10:59 +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
|
2023-01-27 01:40:06 +00:00
|
|
|
propagatedBuildInputs = with python.pkgs; [
|
2021-09-15 22:49:56 +01:00
|
|
|
aioesphomeapi
|
2023-11-15 13:55:39 +00:00
|
|
|
argcomplete
|
2021-05-04 16:10:59 +01:00
|
|
|
click
|
|
|
|
colorama
|
|
|
|
cryptography
|
2021-06-16 20:01:02 +01:00
|
|
|
esphome-dashboard
|
2021-10-20 20:46:58 +01:00
|
|
|
kconfiglib
|
2024-02-22 00:10:51 +00:00
|
|
|
icmplib
|
2021-05-04 16:10:59 +01:00
|
|
|
paho-mqtt
|
|
|
|
pillow
|
2022-12-09 06:34:15 +00:00
|
|
|
platformio
|
2021-05-04 16:10:59 +01:00
|
|
|
protobuf
|
2023-05-17 12:26:27 +01:00
|
|
|
pyparsing
|
2021-05-04 16:10:59 +01:00
|
|
|
pyserial
|
2023-11-24 01:30:35 +00:00
|
|
|
python-magic
|
2021-05-04 16:10:59 +01:00
|
|
|
pyyaml
|
2022-10-16 23:30:03 +01:00
|
|
|
requests
|
2021-05-04 16:10:59 +01:00
|
|
|
tornado
|
2021-10-20 20:46:58 +01:00
|
|
|
tzdata
|
2021-05-04 16:10:59 +01:00
|
|
|
tzlocal
|
|
|
|
voluptuous
|
|
|
|
];
|
|
|
|
|
2019-01-18 15:13:58 +00:00
|
|
|
makeWrapperArgs = [
|
2024-01-26 17:26:37 +00:00
|
|
|
# platformio is used in esphome/platformio_api.py
|
|
|
|
# esptool is used in esphome/__main__.py
|
|
|
|
# git is used in esphome/writer.py
|
2024-01-27 17:20:21 +00:00
|
|
|
# inetutils is used in esphome/dashboard/status/ping.py
|
|
|
|
"--prefix PATH : ${lib.makeBinPath [ platformio esptool git inetutils ]}"
|
2024-02-07 00:10:54 +00:00
|
|
|
"--prefix PYTHONPATH : ${python.pkgs.makePythonPath propagatedBuildInputs}" # will show better error messages
|
2024-01-28 15:57:31 +00:00
|
|
|
"--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
|
|
|
];
|
|
|
|
|
2024-01-27 17:20:21 +00:00
|
|
|
# Needed for tests
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2023-11-15 13:55:39 +00:00
|
|
|
nativeCheckInputs = with python3Packages; [
|
2021-05-04 16:10:59 +01:00
|
|
|
hypothesis
|
|
|
|
mock
|
2021-06-16 20:01:02 +01:00
|
|
|
pytest-asyncio
|
2021-05-04 16:10:59 +01:00
|
|
|
pytest-mock
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2021-07-11 00:17:37 +01: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 16:10:59 +01:00
|
|
|
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 = {
|
2023-01-27 01:40:06 +00:00
|
|
|
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; {
|
2023-04-23 23:13:54 +01:00
|
|
|
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/";
|
2021-05-04 16:10:59 +01: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 11:41:44 +01:00
|
|
|
maintainers = with maintainers; [ globin hexa ];
|
2023-11-27 01:17:53 +00:00
|
|
|
mainProgram = "esphome";
|
2019-01-10 18:38:38 +00:00
|
|
|
};
|
|
|
|
}
|