feat(hass): update material you theme to material-you-utilities

This commit is contained in:
matt1432 2025-04-18 20:27:34 -04:00
parent 354ea274c8
commit faf2773052
5 changed files with 50 additions and 19 deletions
configurations/homie/modules/home-assistant
scopedPackages/lovelace-components
custom-sidebar
default.nix
material-rounded-theme
material-you-utilities

View file

@ -7,14 +7,12 @@
}: let
inherit (lib) attrValues singleton;
inherit (pkgs.writers) writeYAML;
material-rounded-theme-src = pkgs.scopedPackages.lovelace-components.material-rounded-theme.src;
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";
"themes/material_you.yaml".source = "${pkgs.scopedPackages.lovelace-components.material-rounded-theme}/share/material_you.yaml";
"www/sidebar-config.yaml".source = writeYAML "sidebar" {
id = "my-sidebar";
@ -100,7 +98,7 @@ in {
(pkgs.scopedPackages.lovelace-components)
big-slider-card
custom-sidebar
material-rounded-theme
material-you-utilities
;
};
@ -110,10 +108,20 @@ in {
"big-slider-card"
"card-mod"
"custom-sidebar-yaml"
"material-rounded-theme"
"material-you-utilities"
];
};
config.panel_custom = [
{
name = "material-you-panel";
url_path = "material-you-configuration";
sidebar_title = "Material You Utilities";
sidebar_icon = "mdi:material-design";
module_url = "/local/nixos-lovelace-modules/material-you-utilities.js";
}
];
config.template = [
{
sensor = singleton {

View file

@ -2,7 +2,6 @@
# nix build inputs
lib,
stdenv,
concatTextFile,
custom-sidebar-src,
# deps
nodejs,

View file

@ -9,4 +9,5 @@ in {
big-slider-card = callPackage ./big-slider-card;
custom-sidebar = callPackage ./custom-sidebar;
material-rounded-theme = callPackage ./material-rounded-theme;
material-you-utilities = callPackage ./material-you-utilities;
})

View file

@ -1,33 +1,26 @@
{
# nix build inputs
lib,
buildNpmPackage,
stdenv,
fetchFromGitHub,
...
}: let
pname = "material-rounded-theme";
version = "3.1.5";
version = "4.0.2";
in
buildNpmPackage {
stdenv.mkDerivation {
inherit pname version;
src = fetchFromGitHub {
owner = "Nerwyn";
repo = pname;
rev = version;
hash = "sha256-NvIAwuvy5SGs35ScmODXDwSrFdtRvYUhrzzI5WRH1WQ=";
hash = "sha256-ZsajvWYUbrOUVTmzSIyNiEUsCgURuYdah5Ra5NSmep8=";
};
postPatch = ''
substituteInPlace ./webpack.config.js --replace-fail \
"git branch --show-current" "echo main"
'';
npmDepsHash = "sha256-Ph+qIViLVTfVDJPnO7wlYdLTRY8CwXayTqkdKDAt/ac=";
installPhase = ''
mkdir $out
cp ./dist/* $out
mkdir -p $out/share
cp ./src/material_you.yaml $out/share
'';
meta = {

View file

@ -0,0 +1,30 @@
{
buildNpmPackage,
fetchFromGitHub,
...
}: let
pname = "material-you-utilities";
version = "1.0.4";
in
buildNpmPackage {
inherit pname version;
src = fetchFromGitHub {
owner = "Nerwyn";
repo = "ha-${pname}";
rev = version;
hash = "sha256-iyGy6dpHZMtU2ap+smZUlLYnFKs6s8SaGAC9Y3jdoiA=";
};
postPatch = ''
substituteInPlace ./webpack.config.js --replace-fail \
"git branch --show-current" "echo main"
'';
installPhase = ''
mkdir $out
cp ./dist/material-you-utilities.min.js $out/material-you-utilities.js
'';
npmDepsHash = "sha256-5cc610/BhX19k2iREYVoE3c43yDmRJsE0Nvrq/gAVjY=";
}