homebridge-config-ui-x: 5.14.0 -> 5.16.0 (#485458)

This commit is contained in:
Sandro
2026-02-10 16:03:33 +00:00
committed by GitHub
2 changed files with 85 additions and 5 deletions
@@ -8,27 +8,28 @@
python3,
cacert,
versionCheckHook,
nodejs_22,
}:
buildNpmPackage (finalAttrs: {
buildNpmPackage.override { nodejs = nodejs_22; } (finalAttrs: {
pname = "homebridge-config-ui-x";
version = "5.14.0";
version = "5.16.0";
src = fetchFromGitHub {
owner = "homebridge";
repo = "homebridge-config-ui-x";
tag = "v${finalAttrs.version}";
hash = "sha256-CAdzkFuVuJtHoUUDBIRRzxRJiOtGUJFzS/lczYXTfRw=";
hash = "sha256-LXOfpOmYEeHDL0uMvRSG4q51k00tyKBEU6XP6UFm/RY=";
};
# Deps hash for the root package
npmDepsHash = "sha256-73Xt2R3COL0WPgtqn3ZwGTmOHrNqHONrX3hQCU/v5y0=";
npmDepsHash = "sha256-MUfDMHxnwEBjv76NoJ6CYP3YJ+us0Nn/MUFcR1NFQAE=";
# Deps src and hash for ui subdirectory
npmDeps_ui = fetchNpmDeps {
name = "npm-deps-ui";
src = "${finalAttrs.src}/ui";
hash = "sha256-xtXAeTBryQt4FMvK3oXHJ3DdB/3umrSrmqZ3IIDgq2s=";
hash = "sha256-GB17rJ2D1yXl/lxM8pQl2e2xnakgA8JLX7sbbdk3P5M=";
};
# Need to also run npm ci in the ui subdirectory
@@ -59,6 +60,8 @@ buildNpmPackage (finalAttrs: {
];
doInstallCheck = true;
passthru.updateScript = ./update.sh;
meta = {
description = "Configure Homebridge, monitor and backup from a browser";
homepage = "https://github.com/homebridge/homebridge-config-ui-x";
+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl jq gnugrep gnused git nix
# shellcheck shell=bash
set -euo pipefail
nixpkgs="$(pwd)"
cd "$(readlink -e "$(dirname "${BASH_SOURCE[0]}")")"
pkg="(import $nixpkgs/default.nix {}).homebridge-config-ui-x"
nix_eval() {
nix eval --json --impure --expr "$pkg.$1" | jq -r
}
# Build a fixed-output derivation with an empty hash to get the correct one
nix_prefetch() {
local attr="$1"
local expr="let src = $pkg.$attr; in (src.overrideAttrs or (f: src // f src)) (_: { outputHash = \"\"; outputHashAlgo = \"sha256\"; })"
nix-build --impure --no-out-link --expr "$expr" 2>&1 | tr -s ' ' | grep -oP 'got:\s+\K\S+' || true
}
update_src_hash() {
echo "Updating source hash..."
local old_hash new_hash
old_hash=$(nix_eval "src.outputHash")
new_hash=$(nix_prefetch "src")
if [ -z "$new_hash" ]; then
echo "ERROR: Failed to determine new source hash"
exit 1
fi
sed -i "s|$old_hash|$new_hash|g" package.nix
}
update_npm_deps_hash() {
echo "Updating npm dependencies hash..."
local old_hash new_hash
old_hash=$(nix_eval "npmDeps.outputHash")
new_hash=$(nix_prefetch "npmDeps")
if [ -z "$new_hash" ]; then
echo "ERROR: Failed to determine new npm deps hash"
exit 1
fi
sed -i "s|$old_hash|$new_hash|g" package.nix
}
update_npm_deps_ui_hash() {
echo "Updating ui npm dependencies hash..."
local old_hash new_hash
old_hash=$(nix_eval "npmDeps_ui.outputHash")
new_hash=$(nix_prefetch "npmDeps_ui")
if [ -z "$new_hash" ]; then
echo "ERROR: Failed to determine new npm deps ui hash"
exit 1
fi
sed -i "s|$old_hash|$new_hash|g" package.nix
}
LATEST_VERSION=$(curl -fsSL ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/homebridge/homebridge-config-ui-x/releases/latest" \
| jq -r '.tag_name' \
| sed 's/^v//')
CURRENT_VERSION=$(nix_eval "version")
if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then
echo "homebridge-config-ui-x is already up to date at version $CURRENT_VERSION"
exit 0
fi
echo "Updating homebridge-config-ui-x from $CURRENT_VERSION to $LATEST_VERSION"
sed -i "s/version = \"$CURRENT_VERSION\"/version = \"$LATEST_VERSION\"/" package.nix
update_src_hash
update_npm_deps_hash
update_npm_deps_ui_hash
echo "Successfully updated homebridge-config-ui-x from $CURRENT_VERSION to $LATEST_VERSION"