feat(hass): setup custom-sidebar

This commit is contained in:
matt1432 2024-10-16 20:12:23 -04:00
parent 4cd0058a01
commit e47f6ea0d7
10 changed files with 183 additions and 18 deletions
legacyPackages/lovelace-components
custom-sidebar
default.nix
material-symbols

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
'';
}