feat(hass): setup custom-sidebar
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-10-16 20:12:23 -04:00
parent 4cd0058a01
commit e47f6ea0d7
10 changed files with 160 additions and 18 deletions

View file

@ -2,8 +2,8 @@
caule-themes-src, caule-themes-src,
dracul-ha-src, dracul-ha-src,
material-rounded-theme-src, material-rounded-theme-src,
material-symbols-src,
pkgs, pkgs,
self,
... ...
}: let }: let
inherit (pkgs.writers) writeYAML; inherit (pkgs.writers) writeYAML;
@ -13,6 +13,70 @@ in {
"themes/caule.yaml".source = "${caule-themes-src}/themes/caule-themes-pack-1.yaml"; "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/dracul-ha.yaml".source = "${dracul-ha-src}/themes/dracul-ha.yaml";
"themes/material_rounded.yaml".source = "${material-rounded-theme-src}/themes/material_rounded.yaml"; "themes/material_rounded.yaml".source = "${material-rounded-theme-src}/themes/material_rounded.yaml";
"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";
}
];
};
}; };
customLovelaceModules = builtins.attrValues { customLovelaceModules = builtins.attrValues {
@ -21,21 +85,19 @@ in {
card-mod card-mod
; ;
material-symbols = pkgs.stdenv.mkDerivation { inherit
pname = "material-symbols"; (self.legacyPackages.${pkgs.system}.lovelace-components)
version = "0.0.0+${material-symbols-src.shortRev}"; material-symbols
src = material-symbols-src; custom-sidebar
phases = ["installPhase"]; ;
installPhase = ''
mkdir $out
cp $src/dist/material-symbols.js $out
'';
};
}; };
config.frontend = { config.frontend = {
themes = "!include_dir_merge_named themes"; themes = "!include_dir_merge_named themes";
extra_module_url = ["/local/nixos-lovelace-modules/card-mod.js"]; extra_module_url = map (p: "/local/nixos-lovelace-modules/${p}.js") [
"card-mod"
"custom-sidebar-yaml"
];
}; };
config.template = [ config.template = [

Binary file not shown.

BIN
flake.nix

Binary file not shown.

View file

@ -180,12 +180,12 @@ let
srcs = [ srcs = [
# Home-assistant # Home-assistant
## Components
{ {
name = "extended-ollama-conversation-src"; name = "extended-ollama-conversation-src";
owner = "TheNimaj"; owner = "TheNimaj";
repo = "extended_ollama_conversation"; repo = "extended_ollama_conversation";
} }
{ {
owner = "m50"; owner = "m50";
repo = "ha-fallback-conversation"; repo = "ha-fallback-conversation";
@ -199,6 +199,7 @@ let
owner = "net-daemon"; owner = "net-daemon";
repo = "integration"; repo = "integration";
} }
### SpotifyPlus
{ {
name = "spotifyplus-src"; name = "spotifyplus-src";
owner = "thlucas1"; owner = "thlucas1";
@ -214,12 +215,16 @@ let
owner = "thlucas1"; owner = "thlucas1";
repo = "SpotifyWebApiPython"; repo = "SpotifyWebApiPython";
} }
###
## Voice
{ {
name = "wakewords-src"; name = "wakewords-src";
owner = "fwartner"; owner = "fwartner";
repo = "home-assistant-wakewords-collection"; repo = "home-assistant-wakewords-collection";
} }
## Themes
{ {
owner = "berti24"; owner = "berti24";
repo = "dracul-ha"; repo = "dracul-ha";
@ -233,10 +238,16 @@ let
owner = "Nerwyn"; owner = "Nerwyn";
repo = "material-rounded-theme"; repo = "material-rounded-theme";
} }
## Lovelace Components
{ {
owner = "beecho01"; owner = "beecho01";
repo = "material-symbols"; repo = "material-symbols";
} }
{
owner = "elchininet";
repo = "custom-sidebar";
}
# Nvim plugins # Nvim plugins
{ {

View file

@ -11,7 +11,8 @@
(pkgs.callPackage file ({inherit mkVersion;} // inputs)); (pkgs.callPackage file ({inherit mkVersion;} // inputs));
in { in {
dracula = mkScope ./dracula; dracula = mkScope ./dracula;
hass-components = mkScope ./hass-components;
firefoxAddons = mkScope ./firefox-addons; firefoxAddons = mkScope ./firefox-addons;
hass-components = mkScope ./hass-components;
lovelace-components = mkScope ./lovelace-components;
mpvScripts = mkScope ./mpv-scripts; mpvScripts = mkScope ./mpv-scripts;
} }

View file

@ -1,5 +1,9 @@
{pkgs, ...} @ inputs: {
pkgs.lib.makeScope pkgs.newScope (drac: { lib,
pkgs,
...
} @ inputs:
lib.makeScope pkgs.newScope (drac: {
bat = drac.callPackage ./bat.nix { bat = drac.callPackage ./bat.nix {
inherit (inputs) bat-theme-src mkVersion; inherit (inputs) bat-theme-src mkVersion;
}; };

View file

@ -1,5 +1,9 @@
{pkgs, ...} @ inputs: {
pkgs.lib.makeScope pkgs.newScope (hass: let lib,
pkgs,
...
} @ inputs:
lib.makeScope pkgs.newScope (hass: let
buildHassComponent = file: extraArgs: buildHassComponent = file: extraArgs:
hass.callPackage file (inputs // extraArgs // {}); hass.callPackage file (inputs // extraArgs // {});
in { in {

View file

@ -0,0 +1,34 @@
{
custom-sidebar-src,
nodejs,
pnpm,
stdenv,
...
}: let
package = builtins.fromJSON (builtins.readFile "${custom-sidebar-src}/package.json");
in
stdenv.mkDerivation (finalAttrs: {
pname = "custom-sidebar";
inherit (package) version;
src = custom-sidebar-src;
nativeBuildInputs = [
nodejs
pnpm.configHook
];
buildPhase = ''
npm run build
'';
installPhase = ''
mkdir $out
cp ./dist/* $out
'';
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-oERAaN/0uyImDRlxJIdKutFh3jYFJQh2KAeM1LXBpjU=";
};
})

View file

@ -0,0 +1,11 @@
{
lib,
pkgs,
...
} @ inputs:
lib.makeScope pkgs.newScope (lovelace: let
callPackage = file: lovelace.callPackage file ({} // inputs);
in {
custom-sidebar = callPackage ./custom-sidebar;
material-symbols = callPackage ./material-symbols;
})

View file

@ -0,0 +1,15 @@
{
material-symbols-src,
stdenv,
...
}:
stdenv.mkDerivation {
pname = "material-symbols";
version = "0.0.0+${material-symbols-src.shortRev}";
src = material-symbols-src;
phases = ["installPhase"];
installPhase = ''
mkdir $out
cp $src/dist/material-symbols.js $out
'';
}