···6 cfg = config.services.home-assistant;
78 configFile = pkgs.writeText "configuration.yaml" (builtins.toJSON cfg.config);
00000000000009in {
10 meta.maintainers = with maintainers; [ dotlambda ];
11···29 };
30 frontend = { };
31 http = { };
032 }
33 '';
34 description = ''
···48 '';
49 description = ''
50 Home Assistant package to use.
51- Most Home Assistant components require additional dependencies,
52- which are best specified by overriding <literal>pkgs.home-assistant</literal>.
53- You can find the dependencies by searching for failed imports in your log or by looking at this list:
54- <link xlink:href="https://github.com/home-assistant/home-assistant/blob/master/requirements_all.txt"/>
00000000000055 '';
56 };
57 };
···67 '';
68 serviceConfig = {
69 ExecStart = ''
70- ${cfg.package}/bin/hass --config "${cfg.configDir}"
71 '';
72 User = "hass";
73 Group = "hass";
···6 cfg = config.services.home-assistant;
78 configFile = pkgs.writeText "configuration.yaml" (builtins.toJSON cfg.config);
9+10+ availableComponents = pkgs.home-assistant.availableComponents;
11+12+ # Returns whether component is used in config
13+ useComponent = component: hasAttrByPath (splitString "." component) cfg.config;
14+15+ # List of components used in config
16+ extraComponents = filter useComponent availableComponents;
17+18+ package = if cfg.autoExtraComponents
19+ then (cfg.package.override { inherit extraComponents; })
20+ else cfg.package;
21+22in {
23 meta.maintainers = with maintainers; [ dotlambda ];
24···42 };
43 frontend = { };
44 http = { };
45+ feedreader.urls = [ "https://nixos.org/blogs.xml" ];
46 }
47 '';
48 description = ''
···62 '';
63 description = ''
64 Home Assistant package to use.
65+ Override <literal>extraPackages</literal> in order to add additional dependencies.
66+ '';
67+ };
68+69+ autoExtraComponents = mkOption {
70+ default = true;
71+ type = types.bool;
72+ description = ''
73+ If set to <literal>true</literal>, the components used in <literal>config</config>
74+ are set as the specified package's <literal>extraComponents</literal>.
75+ This in turn adds all packaged dependencies to the derivation.
76+ You might still see import errors in your log.
77+ In this case, you will need to package the necessary dependencies yourself
78+ or ask for someone else to package them.
79+ If a dependency is packaged but not automatically added to this list,
80+ you might need to specify it in <literal>extraPackages</literal>.
81 '';
82 };
83 };
···93 '';
94 serviceConfig = {
95 ExecStart = ''
96+ ${package}/bin/hass --config "${cfg.configDir}"
97 '';
98 User = "hass";
99 Group = "hass";