fix(hass): use js module for material you theme
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-12-27 06:26:39 -05:00
parent 735521a8a5
commit 554e70d040
5 changed files with 56 additions and 0 deletions

View file

@ -48,6 +48,12 @@ const main = async() => {
));
}
if (args['m'] || args['material-rounded-theme']) {
console.log(updateCustomPackage(
'scopedPackages.x86_64-linux.lovelace-components.material-rounded-theme',
));
}
if (args['s'] || args['some-sass-language-server']) {
console.log(updateCustomPackage('some-sass-language-server'));
}
@ -91,6 +97,9 @@ const main = async() => {
console.log(updateCustomPackage(
'scopedPackages.x86_64-linux.lovelace-components.custom-sidebar',
));
console.log(updateCustomPackage(
'scopedPackages.x86_64-linux.lovelace-components.material-rounded-theme',
));
console.log(updateCustomPackage('some-sass-language-server'));
// nix-update executions

View file

@ -99,6 +99,7 @@ in {
inherit
(self.scopedPackages.${pkgs.system}.lovelace-components)
custom-sidebar
material-rounded-theme
;
};
@ -108,6 +109,7 @@ in {
"card-mod"
"light-entity-card"
"custom-sidebar-yaml"
"material-rounded-theme"
];
};

View file

@ -7,4 +7,5 @@ lib.makeScope pkgs.newScope (lovelace: let
callPackage = file: lovelace.callPackage file ({} // inputs);
in {
custom-sidebar = callPackage ./custom-sidebar;
material-rounded-theme = callPackage ./material-rounded-theme;
})

View file

@ -0,0 +1,31 @@
{
buildNpmPackage,
concatTextFile,
material-rounded-theme-src,
...
}: let
package = builtins.fromJSON (builtins.readFile "${material-rounded-theme-src}/package.json");
in
buildNpmPackage {
pname = package.name;
inherit (package) version;
src = material-rounded-theme-src;
postPatch = ''
substituteInPlace ./webpack.config.js --replace-fail "git branch --show-current" "echo main"
'';
npmDepsHash = "sha256-INI/9N4IutwVc56w5iMzLgPtW6KQMBWwVBGN0fTxNz8=";
installPhase = ''
mkdir $out
cp ./dist/* $out
'';
passthru.update = concatTextFile {
name = "update";
files = [./update.sh];
executable = true;
destination = "/bin/update";
};
}

View file

@ -0,0 +1,13 @@
#!/usr/bin/env bash
file="$FLAKE/scopedPackages/lovelace-components/material-rounded-theme/default.nix"
old_hash="$(sed -n 's/.*hash = "\(.*\)";/\1/p' "$file")"
sed -i "s/hash = .*/hash = \"\";/" "$file"
npm_hash="$(nix build "$FLAKE#scopedPackages.x86_64-linux.lovelace-components.material-rounded-theme" |& sed -n 's/.*got: *//p')"
if [[ "$npm_hash" != "$old_hash" ]]; then
sed -i "s#hash = .*#hash = \"$npm_hash\";#" "$file"
else
sed -i "s#hash = .*#hash = \"$old_hash\";#" "$file"
fi