Files
nix-config/modules/nixos/homeassistant/dashboards/default.nix
2026-03-20 10:43:32 -05:00

26 lines
468 B
Nix

{
config,
lib,
namespace,
...
}:
let
cfg = config.${namespace}.services.home-assistant;
in
{
imports = [ ./options.nix ];
config = lib.mkIf (cfg.enable && cfg.dashboards != [ ]) {
${namespace}.home.file = lib.genAttrs cfg.dashboards (
dashboard:
let
dashboardFile = "homeassistant/lovelace/${dashboard.title}.yaml";
in
{
text = lib.generators.toYAML { } dashboard;
force = true;
}
);
};
}