mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 20:39:04 +02:00
Merge pull request #148086 from mweinelt/hass-consider-extracomponents
This commit is contained in:
commit
0804405afb
|
@ -24,6 +24,8 @@ let
|
|||
|
||||
availableComponents = cfg.package.availableComponents;
|
||||
|
||||
explicitComponents = cfg.package.extraComponents;
|
||||
|
||||
usedPlatforms = config:
|
||||
if isAttrs config then
|
||||
optional (config ? platform) config.platform
|
||||
|
@ -42,10 +44,13 @@ let
|
|||
# } ];
|
||||
useComponentPlatform = component: elem component (usedPlatforms cfg.config);
|
||||
|
||||
# Returns whether component is used in config
|
||||
useExplicitComponent = component: elem component explicitComponents;
|
||||
|
||||
# Returns whether component is used in config or explicitly passed into package
|
||||
useComponent = component:
|
||||
hasAttrByPath (splitString "." component) cfg.config
|
||||
|| useComponentPlatform component;
|
||||
|| useComponentPlatform component
|
||||
|| useExplicitComponent component;
|
||||
|
||||
# List of components used in config
|
||||
extraComponents = filter useComponent availableComponents;
|
||||
|
|
|
@ -24,6 +24,11 @@ in {
|
|||
services.home-assistant = {
|
||||
inherit configDir;
|
||||
enable = true;
|
||||
package = (pkgs.home-assistant.override {
|
||||
extraComponents = [ "zha" ];
|
||||
}).overrideAttrs (oldAttrs: {
|
||||
doInstallCheck = false;
|
||||
});
|
||||
config = {
|
||||
homeassistant = {
|
||||
name = "Home";
|
||||
|
@ -87,6 +92,8 @@ in {
|
|||
with subtest("Check that capabilities are passed for emulated_hue to bind to port 80"):
|
||||
hass.wait_for_open_port(80)
|
||||
hass.succeed("curl --fail http://localhost:80/description.xml")
|
||||
with subtest("Check extra components are considered in systemd unit hardening"):
|
||||
hass.succeed("systemctl show -p DeviceAllow home-assistant.service | grep -q char-ttyUSB")
|
||||
with subtest("Print log to ease debugging"):
|
||||
output_log = hass.succeed("cat ${configDir}/home-assistant.log")
|
||||
print("\n### home-assistant.log ###\n")
|
||||
|
|
|
@ -888,7 +888,7 @@ in with py.pkgs; buildPythonApplication rec {
|
|||
'';
|
||||
|
||||
passthru = {
|
||||
inherit availableComponents;
|
||||
inherit availableComponents extraComponents;
|
||||
python = py;
|
||||
tests = {
|
||||
inherit (nixosTests) home-assistant;
|
||||
|
|
Loading…
Reference in a new issue