mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 05:31:22 +00:00
nixos/home-assistant: consider extraComponents in hardening
Previously the extraComponents added to an overriden package would not have been considered in hardening measures enforced by the module. Home Assistant is warning the user about component definitions having moved away from YAML, so using an override to include support for a component might become the better way moving forward.
This commit is contained in:
parent
ab5a3f8226
commit
254dd2a102
|
@ -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;
|
||||
|
|
|
@ -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