home-assistant-custom-lovelace-modules.navbar-card: use finalAttrs, add update script, support aarch64-linux (#508170)
This commit is contained in:
@@ -4,24 +4,24 @@
|
||||
fetchFromGitHub,
|
||||
bun,
|
||||
nodejs-slim,
|
||||
nix-update-script,
|
||||
writableTmpDirAsHomeHook,
|
||||
}:
|
||||
|
||||
let
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "navbar-card";
|
||||
version = "1.6.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "joseluis9595";
|
||||
repo = "lovelace-navbar-card";
|
||||
tag = "v${version}";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-ngKsH83nrDglRQBdQhJzMC8/TRV+uL21vi2ovsLEPuY=";
|
||||
};
|
||||
|
||||
# Create node_modules as a separate derivation
|
||||
node_modules = stdenv.mkDerivation {
|
||||
pname = "${pname}-node_modules";
|
||||
inherit version src;
|
||||
pname = "${finalAttrs.pname}-node_modules";
|
||||
inherit (finalAttrs) version src;
|
||||
|
||||
nativeBuildInputs = [
|
||||
bun
|
||||
@@ -40,6 +40,7 @@ let
|
||||
--frozen-lockfile \
|
||||
--ignore-scripts \
|
||||
--no-progress \
|
||||
--omit=optional \
|
||||
--production
|
||||
|
||||
runHook postBuild
|
||||
@@ -57,15 +58,10 @@ let
|
||||
# Required else we get errors that our fixed-output derivation references store paths
|
||||
dontFixup = true;
|
||||
|
||||
outputHash = "sha256-F8nNDBl/BYhtwggaZd61oibYE4j5u7WPVjLG8P4UEcc=";
|
||||
outputHashAlgo = "sha256";
|
||||
outputHash = "sha256-By1ZTJ+cZO+vhs0BL8HSu36k+dvG0WPRnuUwIoaclnw=";
|
||||
outputHashMode = "recursive";
|
||||
};
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit pname version src;
|
||||
|
||||
nativeBuildInputs = [
|
||||
bun
|
||||
nodejs-slim
|
||||
@@ -75,7 +71,7 @@ stdenv.mkDerivation {
|
||||
runHook preConfigure
|
||||
|
||||
# Copy node_modules from the separate derivation
|
||||
cp -R ${node_modules}/node_modules .
|
||||
cp -R ${finalAttrs.node_modules}/node_modules .
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
@@ -84,7 +80,7 @@ stdenv.mkDerivation {
|
||||
runHook preBuild
|
||||
|
||||
# Build the project using bun
|
||||
bun build src/navbar-card.ts --outfile=dist/navbar-card.js --target=browser
|
||||
NODE_ENV=production bun build src/navbar-card.ts --outfile=dist/navbar-card.js --target=browser
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
@@ -98,13 +94,25 @@ stdenv.mkDerivation {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.entrypoint = "navbar-card.js";
|
||||
passthru = {
|
||||
entrypoint = "navbar-card.js";
|
||||
updateScript = nix-update-script {
|
||||
extraArgs = [
|
||||
"--subpackage"
|
||||
"node_modules"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Navbar Card for Home Assistant's Lovelace UI - easily navigate through dashboards";
|
||||
homepage = "https://github.com/joseluis9595/lovelace-navbar-card";
|
||||
changelog = "https://github.com/joseluis9595/lovelace-navbar-card/releases/tag/v${version}";
|
||||
changelog = "https://github.com/joseluis9595/lovelace-navbar-card/releases/tag/v${finalAttrs.version}";
|
||||
license = lib.licenses.mit;
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
maintainers = [ lib.maintainers.jamiemagee ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user