This commit is contained in:
2026-03-20 10:43:32 -05:00
parent 3ee33e4bfd
commit 659cc20e38
8 changed files with 484 additions and 63 deletions

View File

@@ -0,0 +1,25 @@
{
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;
}
);
};
}

View File

@@ -0,0 +1,10 @@
{ lib, namespace, ... }:
with lib;
let
inherit (lib.${namespace}) mkOpt;
in
{
options.${namespace}.services.home-assistant.dashboards =
mkOpt (types.listOf types.attrs) [ ]
"Home Assistant dashboards configuration";
}

View File

@@ -8,7 +8,10 @@ let
cfg = config.${namespace}.services.home-assistant;
in
{
imports = [ ./options.nix ];
imports = [
./options.nix
./dashboards
];
config = lib.mkIf cfg.enable {
# This bypasses the component validation and places it directly in HA's data directory