diff --git a/configurations/homie/modules/home-assistant/frontend.nix b/configurations/homie/modules/home-assistant/frontend.nix index 1f6dd58d..1e84fb19 100644 --- a/configurations/homie/modules/home-assistant/frontend.nix +++ b/configurations/homie/modules/home-assistant/frontend.nix @@ -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 { diff --git a/scopedPackages/lovelace-components/custom-sidebar/default.nix b/scopedPackages/lovelace-components/custom-sidebar/default.nix index f907dbf4..fdd63cba 100644 --- a/scopedPackages/lovelace-components/custom-sidebar/default.nix +++ b/scopedPackages/lovelace-components/custom-sidebar/default.nix @@ -2,7 +2,6 @@ # nix build inputs lib, stdenv, - concatTextFile, custom-sidebar-src, # deps nodejs, diff --git a/scopedPackages/lovelace-components/default.nix b/scopedPackages/lovelace-components/default.nix index 55119757..c32ccadc 100644 --- a/scopedPackages/lovelace-components/default.nix +++ b/scopedPackages/lovelace-components/default.nix @@ -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; }) diff --git a/scopedPackages/lovelace-components/material-rounded-theme/default.nix b/scopedPackages/lovelace-components/material-rounded-theme/default.nix index c5fd9b0d..cc4be4d3 100644 --- a/scopedPackages/lovelace-components/material-rounded-theme/default.nix +++ b/scopedPackages/lovelace-components/material-rounded-theme/default.nix @@ -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 = { diff --git a/scopedPackages/lovelace-components/material-you-utilities/default.nix b/scopedPackages/lovelace-components/material-you-utilities/default.nix new file mode 100644 index 00000000..0be28096 --- /dev/null +++ b/scopedPackages/lovelace-components/material-you-utilities/default.nix @@ -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="; + }