nixpkgs/pkgs/servers/home-assistant/build-custom-component/default.nix
Martin Weinelt 7d10db1506
buildHomeAssistantComponent: support custom sentences
Custom components can also ship with sentences that extend the grammar-
based voice infrastructur of Home Assistant.
2024-07-17 22:29:39 +02:00

44 lines
842 B
Nix

{ lib
, home-assistant
, makeSetupHook
}:
{ owner
, domain
, version
, format ? "other"
, ...
}@args:
let
manifestRequirementsCheckHook = import ./manifest-requirements-check-hook.nix {
inherit makeSetupHook;
inherit (home-assistant) python;
};
in
home-assistant.python.pkgs.buildPythonPackage (
{
pname = "${owner}/${domain}";
inherit format;
installPhase = ''
runHook preInstall
mkdir $out
cp -r ./custom_components/ $out/
# optionally copy sentences, if they exist
cp -r ./custom_sentences/ $out/ || true
runHook postInstall
'';
nativeCheckInputs = with home-assistant.python.pkgs; [
importlib-metadata
manifestRequirementsCheckHook
packaging
] ++ (args.nativeCheckInputs or []);
} // builtins.removeAttrs args [ "nativeCheckInputs" ]
)