f34ce41345
GitOrigin-RevId: b73c2221a46c13557b1b3be9c2070cc42cf01eb3
47 lines
941 B
Nix
47 lines
941 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 []);
|
|
|
|
passthru = {
|
|
isHomeAssistantComponent = true;
|
|
} // args.passthru or { };
|
|
|
|
} // builtins.removeAttrs args [ "nativeCheckInputs" "passthru" ]
|
|
)
|