nixpkgs/pkgs/servers/home-assistant/custom-components
Sigmanificient 543cd40ecc treewide: remove trailing space in description
Done using `grep -rP 'description\s+=\s+"[^"]+[ ]";' | cut -d ':' -f 1 |
xargs -i nvim {}` and sorting the opened files by hand, avoiding
generated packages list
2024-07-26 03:38:50 +02:00
..
adaptive_lighting
alarmo
auth-header
awtrix
better_thermostat
elevenlabs_tts
emporia_vue
epex_spot
frigate home-assistant-custom-components.frigate: 5.1.0 -> 5.2.0 2024-07-15 18:16:04 +01:00
govee-lan home-assistant-custom-components.govee-lan: tests are broken 2024-07-22 08:07:59 -07:00
gpio
homematicip_local
indego home-assistant-custom-components.indego: 5.5.0 -> 5.7.2 2024-07-15 23:55:10 +02:00
local_luftdaten
localtuya
mass home-assistant-custom-components.mass: init at 2024.6.2 2024-07-17 22:29:39 +02:00
midea-air-appliances-lan
midea_ac_lan
miele
moonraker
ntfy
omnik_inverter
prometheus_sensor
samsungtv-smart treewide: remove trailing space in description 2024-07-26 03:38:50 +02:00
sensi
smartir
smartthinq-sensors
spook
tuya_local
volkswagencarnet home-assistant-custom-components.volkswagencarnet: init at 5.0.3 2024-07-22 08:14:16 -07:00
waste_collection_schedule home-assistant-custom-components.waste_collection_schedule: 1.48.0 -> 2.0.1 2024-07-23 20:12:30 +01:00
xiaomi_gateway3
xiaomi_miot home-assistant-custom-components.xiaomi_miot: 0.7.18 -> 0.7.19 2024-07-17 14:11:55 +02:00
yassi
default.nix home-assistant-custom-components.volkswagencarnet: init at 5.0.3 2024-07-22 08:14:16 -07:00
README.md home-assistant-custom-components: fix typo 2024-07-22 08:14:17 -07:00

Packaging guidelines

buildHomeAssistantComponent

Custom components should be packaged using the buildHomeAssistantComponent function, that is provided at top-level. It builds upon buildPythonPackage but uses a custom install and check phase.

Python runtime dependencies can be directly consumed as unqualified function arguments. Pass them into propagatedBuildInputs, for them to be available to Home Assistant.

Out-of-tree components need to use Python packages from home-assistant.python.pkgs as to not introduce conflicting package versions into the Python environment.

Example Boilerplate:

{ lib
, buildHomeAssistantComponent
, fetchFromGitHub
}:

buildHomeAssistantComponent {
  # owner, domain, version

  src = fetchFromGithub {
    # owner, repo, rev, hash
  };

  propagatedBuildInputs = [
    # python requirements, as specified in manifest.json
  ];

  meta = with lib; {
    # changelog, description, homepage, license, maintainers
  };
}

Package attribute

The attribute name must reflect the domain as seen in the manifest.json, which in turn will match the python module name below in the custom_components/ directory.

Example:

The project mweinelt/ha-prometheus-sensor would receive the attribute name "prometheus_sensor", because both domain in the manifest.json as well as the module name are prometheus_sensor.

Package name

The pname attribute is a composition of both owner and domain.

Don't set pname, set owner and domain instead.

Exposing the domain attribute separately allows checking for conflicting components at eval time.

Manifest check

The buildHomeAssistantComponent builder uses a hook to check whether the dependencies specified in the manifest.json are present and inside the specified version range. It also makes sure derivation and manifest agree about the domain name.

There shouldn't be a need to disable this hook, but you can set dontCheckManifest to true in the derivation to achieve that.