bcb2f287e1
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
70 lines
1.5 KiB
Nix
70 lines
1.5 KiB
Nix
{ lib
|
|
, buildPythonPackage
|
|
, fetchFromGitHub
|
|
, pythonOlder
|
|
|
|
# build-system
|
|
, setuptools
|
|
|
|
# codegen
|
|
, hassil
|
|
, python
|
|
, pyyaml
|
|
, voluptuous
|
|
, regex
|
|
, jinja2
|
|
|
|
# tests
|
|
, pytest-xdist
|
|
, pytestCheckHook
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "home-assistant-intents";
|
|
version = "2024.6.5";
|
|
pyproject = true;
|
|
|
|
disabled = pythonOlder "3.9";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "home-assistant";
|
|
repo = "intents-package";
|
|
rev = "refs/tags/${version}";
|
|
hash = "sha256-2rACxdgvCWnyhfVRAVbLTaEAYquAkLnfxi7zeZYZslI=";
|
|
fetchSubmodules = true;
|
|
};
|
|
|
|
build-system = [
|
|
setuptools
|
|
|
|
# build-time codegen; https://github.com/home-assistant/intents/blob/main/requirements.txt#L1-L5
|
|
hassil
|
|
pyyaml
|
|
voluptuous
|
|
regex
|
|
jinja2
|
|
];
|
|
|
|
postInstall = ''
|
|
# https://github.com/home-assistant/intents-package/blob/main/script/package#L23-L24
|
|
PACKAGE_DIR=$out/${python.sitePackages}/home_assistant_intents
|
|
${python.pythonOnBuildForHost.interpreter} script/merged_output.py $PACKAGE_DIR/data
|
|
${python.pythonOnBuildForHost.interpreter} script/write_languages.py $PACKAGE_DIR/data > $PACKAGE_DIR/languages.py
|
|
'';
|
|
|
|
nativeCheckInputs = [
|
|
pytest-xdist
|
|
pytestCheckHook
|
|
];
|
|
|
|
pytestFlagsArray = [
|
|
"intents/tests"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "Intents to be used with Home Assistant";
|
|
homepage = "https://github.com/home-assistant/intents";
|
|
license = licenses.cc-by-40;
|
|
maintainers = teams.home-assistant.members;
|
|
};
|
|
}
|