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,
|
|
|
|
material-symbols-src,
|
2024-10-06 05:45:08 -04:00
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (lib) concatStringsSep getExe;
|
|
|
|
inherit (pkgs.writers) writeYAML;
|
|
|
|
|
|
|
|
themes = [
|
|
|
|
"${caule-themes-src}/themes/caule-themes-pack-1.yaml"
|
|
|
|
"${dracul-ha-src}/themes/dracul-ha.yaml"
|
2024-10-06 20:33:37 -04:00
|
|
|
"${material-rounded-theme-src}/themes/material_rounded.yaml"
|
2024-10-06 05:45:08 -04:00
|
|
|
];
|
|
|
|
in {
|
|
|
|
systemd.services.home-assistant.preStart = let
|
|
|
|
WorkingDirectory = "/var/lib/hass";
|
|
|
|
in
|
|
|
|
getExe (pkgs.writeShellApplication {
|
|
|
|
name = "ha-themes";
|
|
|
|
text = ''
|
|
|
|
mkdir -p ${WorkingDirectory}/themes
|
|
|
|
cp -f ${concatStringsSep " " themes} ${WorkingDirectory}/themes
|
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
2024-09-05 21:33:06 -04:00
|
|
|
services.home-assistant = {
|
2024-10-06 20:33:37 -04:00
|
|
|
customLovelaceModules = builtins.attrValues {
|
|
|
|
inherit
|
|
|
|
(pkgs.home-assistant-custom-lovelace-modules)
|
|
|
|
card-mod
|
|
|
|
;
|
|
|
|
|
|
|
|
material-symbols = pkgs.stdenv.mkDerivation {
|
|
|
|
pname = "material-symbols";
|
2024-10-06 22:16:59 -04:00
|
|
|
version = "0.0.0+${material-symbols-src.shortRev}";
|
2024-10-06 20:33:37 -04:00
|
|
|
src = material-symbols-src;
|
|
|
|
phases = ["installPhase"];
|
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
|
|
|
cp $src/dist/material-symbols.js $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-10-06 05:45:08 -04:00
|
|
|
config.frontend = {
|
|
|
|
themes = "!include_dir_merge_named themes";
|
2024-10-06 20:33:37 -04:00
|
|
|
extra_module_url = ["/local/nixos-lovelace-modules/card-mod.js"];
|
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"
|
|
|
|
];
|
|
|
|
}
|
2024-10-07 15:15:29 -04:00
|
|
|
{
|
|
|
|
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";
|
2024-09-05 21:33:06 -04:00
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
2024-09-05 21:33:06 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|