zigbee2mqtt: convert to buildNpmPackage and adopt
Using buildNpmPackage simplifies the whole package alot and even allows us to use the generic nix-update-script instead of a bespoke one.
This commit is contained in:
parent
94306da1a4
commit
feb66d6fd8
@ -1,30 +1,45 @@
|
||||
{ pkgs, stdenv, nixosTests }:
|
||||
let
|
||||
package = (import ./node.nix { inherit pkgs; inherit (stdenv.hostPlatform) system; }).package;
|
||||
in
|
||||
package.override rec {
|
||||
version = "1.28.0";
|
||||
reconstructLock = true;
|
||||
{ lib
|
||||
, buildNpmPackage
|
||||
, fetchFromGitHub
|
||||
, python3
|
||||
, nixosTests
|
||||
, nix-update-script
|
||||
}:
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
buildNpmPackage rec {
|
||||
pname = "zigbee2mqtt";
|
||||
version = "1.28.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Koenkk";
|
||||
repo = "zigbee2mqtt";
|
||||
rev = version;
|
||||
sha256 = "0GVU2bjghFdNyXljUGzxO71qhbHMVoO7I4E2c237+mw=";
|
||||
hash = "sha256-0GVU2bjghFdNyXljUGzxO71qhbHMVoO7I4E2c237+mw=";
|
||||
};
|
||||
|
||||
npmDepsHash = "sha256-LcPJtvtnBcPRVrdBWeHr7yznh26NwQpJxJZidX5rHVQ=";
|
||||
|
||||
nativeBuildInputs = [
|
||||
python3
|
||||
];
|
||||
|
||||
passthru.tests.zigbee2mqtt = nixosTests.zigbee2mqtt;
|
||||
passthru.updateScript = ./update.sh;
|
||||
passthru.updateScript = nix-update-script {
|
||||
attrPath = pname;
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
npm run build
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
meta = with lib; {
|
||||
changelog = "https://github.com/Koenkk/zigbee2mqtt/releases/tag/${version}";
|
||||
description = "Zigbee to MQTT bridge using zigbee-shepherd";
|
||||
license = licenses.gpl3;
|
||||
homepage = "https://github.com/Koenkk/zigbee2mqtt";
|
||||
maintainers = with maintainers; [ sweber ];
|
||||
license = licenses.gpl3;
|
||||
longDescription = ''
|
||||
Allows you to use your Zigbee devices without the vendor's bridge or gateway.
|
||||
|
||||
It bridges events and allows you to control your Zigbee devices via MQTT.
|
||||
In this way you can integrate your Zigbee devices with whatever smart home infrastructure you are using.
|
||||
'';
|
||||
maintainers = with maintainers; [ sweber hexa ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
|
7214
pkgs/servers/zigbee2mqtt/node-packages.nix
generated
7214
pkgs/servers/zigbee2mqtt/node-packages.nix
generated
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
||||
# This file has been generated by node2nix 1.11.1. Do not edit!
|
||||
|
||||
{pkgs ? import <nixpkgs> {
|
||||
inherit system;
|
||||
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-14_x"}:
|
||||
|
||||
let
|
||||
nodeEnv = import ../../development/node-packages/node-env.nix {
|
||||
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
|
||||
inherit pkgs nodejs;
|
||||
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
||||
};
|
||||
in
|
||||
import ./node-packages.nix {
|
||||
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
|
||||
inherit nodeEnv;
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p nodePackages.node2nix curl jq nix-update common-updater-scripts
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(dirname "$0")"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
CURRENT_VERSION=$(nix eval -f ../../.. --raw zigbee2mqtt.version)
|
||||
TARGET_VERSION="$(curl https://api.github.com/repos/Koenkk/zigbee2mqtt/releases/latest | jq -r ".tag_name")"
|
||||
|
||||
if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" ]]; then
|
||||
echo "zigbee2mqtt is up-to-date: ${CURRENT_VERSION}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ZIGBEE2MQTT=https://github.com/Koenkk/zigbee2mqtt/raw/$TARGET_VERSION
|
||||
curl -LO $ZIGBEE2MQTT/package.json
|
||||
curl -LO $ZIGBEE2MQTT/package-lock.json
|
||||
|
||||
node2nix \
|
||||
--composition node.nix \
|
||||
--lock package-lock.json \
|
||||
--development \
|
||||
--no-copy-node-env \
|
||||
--node-env ../../development/node-packages/node-env.nix \
|
||||
--nodejs-14 \
|
||||
--output node-packages.nix
|
||||
|
||||
rm package.json package-lock.json
|
||||
|
||||
(
|
||||
cd ../../../
|
||||
update-source-version zigbee2mqtt "$TARGET_VERSION"
|
||||
)
|
Loading…
Reference in New Issue
Block a user