feat(hass): setup ui declaratively
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-10-06 05:45:08 -04:00
parent a6dd198820
commit 52d0196dc1
4 changed files with 91 additions and 7 deletions

View file

@ -1,12 +1,68 @@
{dracul-ha-src, ...}: {
{
caule-themes-src,
dracul-ha-src,
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"
];
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
'';
});
services.home-assistant = {
config = {
# GUI
frontend = {
themes = "!include ${dracul-ha-src}/themes/dracul-ha.yaml";
};
lovelace = {
config.frontend = {
themes = "!include_dir_merge_named themes";
};
lovelaceConfig = {
title = "Our House";
views = [
{
path = "home";
title = "Home";
cards = [
{
type = "entities";
entities = [
"switch.smartplug1"
"switch.smartplug3"
];
}
];
}
];
};
config.lovelace.dashboards = {
esphome-dash = {
title = "ESPHome";
icon = "mdi:car-esp";
mode = "yaml";
show_in_sidebar = true;
require_admin = true;
filename = writeYAML "esphome.yaml" {
strategy = {
type = "iframe";
url = "https://esphome.nelim.org";
};
};
};
};
};

17
flake.lock generated
View file

@ -172,6 +172,22 @@
"type": "github"
}
},
"caule-themes-src": {
"flake": false,
"locked": {
"lastModified": 1696467225,
"narHash": "sha256-biNz3ZO3nFfEgchoPu9M3lXiTj9BDxkUaZiCNq0Jy8M=",
"owner": "ricardoquecria",
"repo": "caule-themes-pack-1",
"rev": "0ec8a4b7acf63d8618bcf2fdd968d6256e998acb",
"type": "github"
},
"original": {
"owner": "ricardoquecria",
"repo": "caule-themes-pack-1",
"type": "github"
}
},
"curseforge-server-downloader-src": {
"flake": false,
"locked": {
@ -1547,6 +1563,7 @@
"bat-theme-src": "bat-theme-src",
"bazarr-bulk": "bazarr-bulk",
"caddy-plugins": "caddy-plugins",
"caule-themes-src": "caule-themes-src",
"discord-overlay": "discord-overlay",
"dracul-ha-src": "dracul-ha-src",
"dracula-plymouth-src": "dracula-plymouth-src",

View file

@ -44,6 +44,12 @@
repo = "nixos-caddy-cloudflare";
type = "github";
};
caule-themes-src = {
flake = false;
owner = "ricardoquecria";
repo = "caule-themes-pack-1";
type = "github";
};
discord-overlay = {
inputs.nixpkgs.follows = "nixpkgs";
owner = "matt1432";

View file

@ -226,6 +226,11 @@ let
owner = "berti24";
repo = "dracul-ha";
}
{
name = "caule-themes-src";
owner = "ricardoquecria";
repo = "caule-themes-pack-1";
}
# Nvim plugins
{