nixos-configs/devices/homie/modules/home-assistant/frontend.nix

167 lines
3.6 KiB
Nix
Raw Normal View History

2024-10-06 05:45:08 -04:00
{
caule-themes-src,
dracul-ha-src,
2024-10-06 20:33:37 -04:00
material-rounded-theme-src,
2024-10-06 05:45:08 -04:00
pkgs,
2024-10-16 20:12:23 -04:00
self,
2024-10-06 05:45:08 -04:00
...
}: let
inherit (pkgs.writers) writeYAML;
in {
services.home-assistant = {
configFiles = {
"themes/caule.yaml".source = "${caule-themes-src}/themes/caule-themes-pack-1.yaml";
"themes/dracul-ha.yaml".source = "${dracul-ha-src}/themes/dracul-ha.yaml";
"themes/material_rounded.yaml".source = "${material-rounded-theme-src}/themes/material_rounded.yaml";
2024-10-16 20:12:23 -04:00
"www/sidebar-config.yaml".source = writeYAML "sidebar" {
id = "my-sidebar";
order = [
# Top
{
item = "overview";
order = 1;
}
{
match = "href";
item = "calendar";
order = 2;
}
{
match = "href";
item = "todo";
order = 3;
}
# Bottom
{
bottom = true;
item = "esphome";
order = 5;
}
{
bottom = true;
item = "logbook";
order = 7;
}
{
bottom = true;
icon = "mdi:tools";
item = "developer tools";
name = "Developer tools";
order = 9;
}
{
bottom = true;
item = "settings";
order = 11;
}
# Hidden
{
hide = true;
item = "map";
}
{
hide = true;
item = "energy";
}
{
hide = true;
item = "history";
}
{
hide = true;
item = "media";
}
];
};
};
2024-10-22 20:28:11 -04:00
customComponents = builtins.attrValues {
inherit
(self.legacyPackages.${pkgs.system}.hass-components)
material-symbols
;
};
2024-10-06 20:33:37 -04:00
customLovelaceModules = builtins.attrValues {
inherit
(pkgs.home-assistant-custom-lovelace-modules)
card-mod
;
2024-10-16 20:12:23 -04:00
inherit
(self.legacyPackages.${pkgs.system}.lovelace-components)
custom-sidebar
;
2024-10-06 20:33:37 -04:00
};
2024-10-06 05:45:08 -04:00
config.frontend = {
themes = "!include_dir_merge_named themes";
2024-10-16 20:12:23 -04:00
extra_module_url = map (p: "/local/nixos-lovelace-modules/${p}.js") [
"card-mod"
"custom-sidebar-yaml"
];
2024-10-06 05:45:08 -04:00
};
2024-10-06 22:16:59 -04:00
config.template = [
{
sensor = [
{
name = "Material Rounded Base Color Matt";
unique_id = "material_rounded_base_color_matt";
state = ''{{ states("sensor.pixel_8_accent_color") }}'';
}
];
}
];
2024-10-06 05:45:08 -04:00
lovelaceConfig = {
title = "Our House";
views = [
{
path = "home";
title = "Home";
cards = [
{
type = "entities";
entities = [
"switch.smartplug1"
"switch.smartplug3"
];
}
{
type = "entities";
entities = [
"timer.assist_timer1"
"timer.assist_timer2"
"timer.assist_timer3"
];
}
2024-10-06 05:45:08 -04:00
];
}
];
};
config.lovelace.dashboards = {
esphome-dash = {
title = "ESPHome";
icon = "mdi:car-esp";
mode = "yaml";
2024-10-06 05:45:08 -04:00
show_in_sidebar = true;
require_admin = true;
filename = writeYAML "esphome.yaml" {
strategy = {
type = "iframe";
url = "https://esphome.nelim.org";
};
};
};
};
};
}