nixpkgs/pkgs/servers/home-assistant/build-custom-component/default.nix
Graham Bennett 31e60c2fbb
buildHomeAssistantComponent: init
Builder to package up custom components for Home Assistant.

These packages use `buildPythonPackage` with `format = "other"` and
rely on a custom install phase, that expects a standardized path,
and a custom check phase, that for now verifies python dependencies have
been satisified.

Co-Authored-By: Martin Weinelt <hexa@darmstadt.ccc.de>
Co-Authored-By: Sandro Jäckel <sandro.jaeckel@gmail.com>
2023-11-10 22:00:35 +01:00

39 lines
706 B
Nix

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