diff --git a/nixos/modules/services/home-automation/home-assistant.nix b/nixos/modules/services/home-automation/home-assistant.nix index 3c1b5b199d4c..59a886899698 100644 --- a/nixos/modules/services/home-automation/home-assistant.nix +++ b/nixos/modules/services/home-automation/home-assistant.nix @@ -49,14 +49,17 @@ let useComponent = component: hasAttrByPath (splitString "." component) cfg.config || useComponentPlatform component - || useExplicitComponent component; + || useExplicitComponent component + || builtins.elem component cfg.extraComponents; # Final list of components passed into the package to include required dependencies extraComponents = filter useComponent availableComponents; - package = (cfg.package.override { - inherit extraComponents; - }); + package = (cfg.package.override (oldArgs: { + # Respect overrides that already exist in the passed package and + # concat it with values passed via the module. + extraComponents = oldArgs.extraComponents ++ extraComponents; + })); in { imports = [ @@ -82,6 +85,31 @@ in { description = "The config directory, where your configuration.yaml is located."; }; + extraComponents = mkOption { + type = types.listOf (types.enum availableComponents); + default = [ + # List of components required to complete the onboarding + "default_config" + "met" + "esphome" + ]; + example = literalExpression '' + [ + "analytics" + "default_config" + "esphome" + "my" + "shopping_list" + "wled" + ] + ''; + description = '' + List of components that have their dependencies included in the package. + + The component name can be found in the URL, for example https://www.home-assistant.io/integrations/ffmpeg/ would map to ffmpeg. + ''; + }; + config = mkOption { type = types.submodule { freeformType = format.type;