mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-19 12:11:28 +00:00
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.
This commit is contained in:
parent
59a367bcab
commit
4a0b964b34
|
@ -49,14 +49,17 @@ let
|
||||||
useComponent = component:
|
useComponent = component:
|
||||||
hasAttrByPath (splitString "." component) cfg.config
|
hasAttrByPath (splitString "." component) cfg.config
|
||||||
|| useComponentPlatform component
|
|| useComponentPlatform component
|
||||||
|| useExplicitComponent component;
|
|| useExplicitComponent component
|
||||||
|
|| builtins.elem component cfg.extraComponents;
|
||||||
|
|
||||||
# Final list of components passed into the package to include required dependencies
|
# Final list of components passed into the package to include required dependencies
|
||||||
extraComponents = filter useComponent availableComponents;
|
extraComponents = filter useComponent availableComponents;
|
||||||
|
|
||||||
package = (cfg.package.override {
|
package = (cfg.package.override (oldArgs: {
|
||||||
inherit extraComponents;
|
# Respect overrides that already exist in the passed package and
|
||||||
});
|
# concat it with values passed via the module.
|
||||||
|
extraComponents = oldArgs.extraComponents ++ extraComponents;
|
||||||
|
}));
|
||||||
|
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -82,6 +85,31 @@ in {
|
||||||
description = "The config directory, where your <filename>configuration.yaml</filename> is located.";
|
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 {
|
config = mkOption {
|
||||||
type = types.submodule {
|
type = types.submodule {
|
||||||
freeformType = format.type;
|
freeformType = format.type;
|
||||||
|
|
Loading…
Reference in a new issue