nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 68 lines 1.3 kB view raw
1{ 2 home-assistant, 3 makeSetupHook, 4}: 5 6{ 7 owner, 8 domain, 9 version, 10 format ? "other", 11 ... 12}@args: 13 14let 15 manifestRequirementsCheckHook = import ./manifest-requirements-check-hook.nix { 16 inherit makeSetupHook; 17 inherit (home-assistant) python; 18 }; 19in 20home-assistant.python.pkgs.buildPythonPackage ( 21 { 22 pname = "${owner}/${domain}"; 23 inherit version format; 24 25 installPhase = '' 26 runHook preInstall 27 28 mkdir $out 29 if [[ -f ./manifest.json ]]; then 30 mkdir $out/custom_components 31 cp -R "$(realpath .)" "$out/custom_components/${domain}" 32 else 33 cp -r ./custom_components/ $out/ 34 fi 35 36 # optionally copy sentences, if they exist 37 if [[ -d ./custom_sentences ]]; then 38 cp -r ./custom_sentences/ $out/ 39 fi 40 41 runHook postInstall 42 ''; 43 44 nativeBuildInputs = 45 with home-assistant.python.pkgs; 46 [ 47 manifestRequirementsCheckHook 48 packaging 49 ] 50 ++ (args.nativeBuildInputs or [ ]); 51 52 passthru = { 53 isHomeAssistantComponent = true; 54 } 55 // args.passthru or { }; 56 57 meta = { 58 inherit (home-assistant.meta) platforms; 59 } 60 // args.meta or { }; 61 62 } 63 // removeAttrs args [ 64 "meta" 65 "nativeBuildInputs" 66 "passthru" 67 ] 68)