diff options
author | Martin Weinelt <hexa@darmstadt.ccc.de> | 2022-01-30 02:35:34 +0100 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2022-02-15 23:41:48 +0100 |
commit | 4a0b964b34c5ace3071a2fa3a0160ef179314893 (patch) | |
tree | 90560f9a336345ddb51ce883679dc0cc35f3b2ac | |
parent | 59a367bcabae16ec0c18df29fda4b09dfa36ba53 (diff) |
nixos/home-assistant: add extraComponents option
It simply should not be required to override the package for such a common use case, especially since the module usually adds another override on top to inherit extraComponents.
-rw-r--r-- | nixos/modules/services/home-automation/home-assistant.nix | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/nixos/modules/services/home-automation/home-assistant.nix b/nixos/modules/services/home-automation/home-assistant.nix index 3c1b5b199d4c9..59a8868996980 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 <filename>configuration.yaml</filename> 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 <link xlink:href="https://www.home-assistant.io/integrations/">components</link> that have their dependencies included in the package. + + The component name can be found in the URL, for example <literal>https://www.home-assistant.io/integrations/ffmpeg/</literal> would map to <literal>ffmpeg</literal>. + ''; + }; + config = mkOption { type = types.submodule { freeformType = format.type; |