{ 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; } ); }; }