jellyseerr: fix update script
This commit is contained in:
parent
c339c066b8
commit
c01bd02dd4
@ -1,36 +1,32 @@
|
|||||||
{ lib
|
{
|
||||||
, fetchFromGitHub
|
lib,
|
||||||
, makeWrapper
|
mkYarnPackage,
|
||||||
, mkYarnPackage
|
fetchFromGitHub,
|
||||||
, nodejs
|
fetchYarnDeps,
|
||||||
, fetchYarnDeps
|
makeWrapper,
|
||||||
, python3
|
nodejs,
|
||||||
|
python3,
|
||||||
|
sqlite,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
|
||||||
pin = lib.importJSON ./pin.json;
|
|
||||||
in
|
|
||||||
|
|
||||||
mkYarnPackage rec {
|
mkYarnPackage rec {
|
||||||
pname = "jellyseerr";
|
pname = "jellyseerr";
|
||||||
inherit (pin) version;
|
version = "1.8.1";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "Fallenbagel";
|
owner = "Fallenbagel";
|
||||||
repo = "jellyseerr";
|
repo = "jellyseerr";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = pin.srcHash;
|
hash = "sha256-B8Hnpi4XwK0WrHRgj7OSVUh49oRH9SVEHdzGbnDa8p8=";
|
||||||
};
|
};
|
||||||
|
|
||||||
packageJSON = ./package.json;
|
packageJSON = ./package.json;
|
||||||
|
|
||||||
offlineCache = fetchYarnDeps {
|
offlineCache = fetchYarnDeps {
|
||||||
yarnLock = "${src}/yarn.lock";
|
yarnLock = "${src}/yarn.lock";
|
||||||
sha256 = pin.yarnSha256;
|
hash = "sha256-ME19kHlVw0Q5oCytYQCUj4Ek0+712NkqB6eozOtF6/k=";
|
||||||
};
|
};
|
||||||
|
|
||||||
doDist = false;
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
nodejs
|
nodejs
|
||||||
makeWrapper
|
makeWrapper
|
||||||
@ -38,16 +34,23 @@ mkYarnPackage rec {
|
|||||||
|
|
||||||
# Fixes "SQLite package has not been found installed" at launch
|
# Fixes "SQLite package has not been found installed" at launch
|
||||||
pkgConfig.sqlite3 = {
|
pkgConfig.sqlite3 = {
|
||||||
nativeBuildInputs = [ nodejs.pkgs.node-pre-gyp python3 ];
|
nativeBuildInputs = [
|
||||||
|
nodejs.pkgs.node-pre-gyp
|
||||||
|
python3
|
||||||
|
sqlite
|
||||||
|
];
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
export CPPFLAGS="-I${nodejs}/include/node"
|
export CPPFLAGS="-I${nodejs}/include/node"
|
||||||
node-pre-gyp install --prefer-offline --build-from-source --nodedir=${nodejs}/include/node
|
node-pre-gyp install --prefer-offline --build-from-source --nodedir=${nodejs}/include/node --sqlite=${sqlite.dev}
|
||||||
rm -r build-tmp-napi-v6
|
rm -r build-tmp-napi-v6
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
pkgConfig.bcrypt = {
|
pkgConfig.bcrypt = {
|
||||||
nativeBuildInputs = [ nodejs.pkgs.node-pre-gyp python3 ];
|
nativeBuildInputs = [
|
||||||
|
nodejs.pkgs.node-pre-gyp
|
||||||
|
python3
|
||||||
|
];
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
export CPPFLAGS="-I${nodejs}/include/node"
|
export CPPFLAGS="-I${nodejs}/include/node"
|
||||||
node-pre-gyp install --prefer-offline --build-from-source --nodedir=${nodejs}/include/node
|
node-pre-gyp install --prefer-offline --build-from-source --nodedir=${nodejs}/include/node
|
||||||
@ -72,6 +75,8 @@ mkYarnPackage rec {
|
|||||||
--set NODE_ENV production
|
--set NODE_ENV production
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
doDist = false;
|
||||||
|
|
||||||
passthru.updateScript = ./update.sh;
|
passthru.updateScript = ./update.sh;
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "1.8.1",
|
|
||||||
"srcHash": "sha256-B8Hnpi4XwK0WrHRgj7OSVUh49oRH9SVEHdzGbnDa8p8=",
|
|
||||||
"yarnSha256": "ME19kHlVw0Q5oCytYQCUj4Ek0+712NkqB6eozOtF6/k="
|
|
||||||
}
|
|
@ -1,39 +1,16 @@
|
|||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
#!nix-shell -i bash -p nix curl jq prefetch-yarn-deps nix-prefetch-github
|
#!nix-shell -i bash -p curl jq common-updater-scripts nix prefetch-yarn-deps
|
||||||
|
|
||||||
set -euo pipefail
|
set -eu -o pipefail
|
||||||
|
|
||||||
if [[ "$#" -gt 1 || "$1" == -* ]]; then
|
version=${1:-$(curl -s https://api.github.com/repos/Fallenbagel/jellyseerr/releases/latest | jq --raw-output '.tag_name[1:]')}
|
||||||
echo "Regenerates packaging data for jellyseerr."
|
update-source-version jellyseerr $version
|
||||||
echo "Usage: $0 [git release tag]"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
tag="$1"
|
nix_file=$(nix-instantiate --eval --strict -A "jellyseerr.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')
|
||||||
|
nix_dir=$(dirname $nix_file)
|
||||||
|
cp $(nix-instantiate --eval --expr 'with import ./default.nix { }; "${jellyseerr.src}/package.json"' | sed 's/"//g') $nix_dir
|
||||||
|
|
||||||
if [ -z "$tag" ]; then
|
old_yarn_hash=$(nix-instantiate --eval --strict -A "jellyseerr.offlineCache.outputHash" | tr -d '"' | sed -re 's|[+]|\\&|g')
|
||||||
tag="$(
|
lock_file=$(nix-instantiate --eval --expr 'with import ./default.nix { }; "${jellyseerr.src}/yarn.lock"' | sed 's/"//g')
|
||||||
curl "https://api.github.com/repos/Fallenbagel/jellyseerr/releases?per_page=1" |
|
new_yarn_hash=$(nix hash to-sri --type sha256 $(prefetch-yarn-deps $lock_file))
|
||||||
jq -r '.[0].tag_name'
|
sed -i "$nix_file" -re "s|\"$old_yarn_hash\"|\"$new_yarn_hash\"|"
|
||||||
)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
src="https://raw.githubusercontent.com/Fallenbagel/jellyseerr/$tag"
|
|
||||||
src_hash=$(nix-prefetch-github Fallenbagel jellyseerr --rev ${tag} | jq -r .sha256)
|
|
||||||
|
|
||||||
tmpdir=$(mktemp -d)
|
|
||||||
trap 'rm -rf "$tmpdir"' EXIT
|
|
||||||
|
|
||||||
pushd $tmpdir
|
|
||||||
curl -O "$src/yarn.lock"
|
|
||||||
yarn_sha256=$(prefetch-yarn-deps yarn.lock)
|
|
||||||
popd
|
|
||||||
|
|
||||||
curl -O "$src/package.json"
|
|
||||||
cat > pin.json << EOF
|
|
||||||
{
|
|
||||||
"version": "$(echo $tag | grep -P '(\d|\.)+' -o)",
|
|
||||||
"srcHash": "sha256-$src_hash",
|
|
||||||
"yarnSha256": "$yarn_sha256"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
Loading…
Reference in New Issue
Block a user