Add OH-addons package

This commit is contained in:
Simonas Kazlauskas
2023-02-22 02:23:37 +02:00
parent a6f82efdaa
commit d2b58b8a8b
7 changed files with 38 additions and 5 deletions

9
openhab-addons.nix Normal file
View File

@@ -0,0 +1,9 @@
{ fetchurl }:
let
version = builtins.readFile ./version;
sha256 = builtins.readFile ./openhab-addons.sha256;
in fetchurl {
url = "https://github.com/openhab/openhab-distro/releases/download/${version}/openhab-addons-${version}.kar";
inherit sha256;
}

1
openhab-addons.sha256 Normal file
View File

@@ -0,0 +1 @@
730b96b8acf84f44ed9df46cd58f1bd2e6afd3b498abe62f796da074ca932594

View File

@@ -9,12 +9,15 @@
stdenv, stdenv,
}: }:
stdenv.mkDerivation rec { let
pname = "openhab";
version = builtins.readFile ./version; version = builtins.readFile ./version;
sha256 = builtins.readFile ./openhab.sha256;
in stdenv.mkDerivation rec {
inherit version;
pname = "openhab";
src = fetchurl { src = fetchurl {
url = "https://github.com/openhab/openhab-distro/releases/download/${version}/openhab-${version}.tar.gz"; url = "https://github.com/openhab/openhab-distro/releases/download/${version}/openhab-${version}.tar.gz";
sha256 = builtins.readFile ./sha256; inherit sha256;
}; };
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];
buildInputs = [ bash ]; buildInputs = [ bash ];

1
openhab.sha256 Normal file
View File

@@ -0,0 +1 @@
551451292ead9ca440b0d224d60d7f68629f9949dcec8874effa7991650e31df

1
sha256
View File

@@ -1 +0,0 @@
sha256-VRRRKS6tnKRAsNIk1g1/aGKfmUnc7Ih07/p5kWUOMd8=

20
update.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq ripgrep gawk
set -eux
readarray -t RELEASES <<<"$(curl https://api.github.com/repos/openhab/openhab-distro/tags | jq -r '.[].name' | rg '^\d+\.\d+\.\d+*$')"
MOST_RECENT=${RELEASES[0]}
echo -n "$MOST_RECENT" > version
curl -L https://github.com/openhab/openhab-distro/releases/download/"$MOST_RECENT"/openhab-"$MOST_RECENT".tar.gz \
| sha256sum \
| cut -d" " -f1 \
| tr -d '\n' \
> openhab.sha256
curl -L https://github.com/openhab/openhab-distro/releases/download/"$MOST_RECENT"/openhab-addons-"$MOST_RECENT".kar \
| sha256sum \
| cut -d" " -f1 \
| tr -d '\n' \
> openhab-addons.sha256

View File

@@ -1 +1 @@
3.4.2 3.4.2