kavita: add passthru.updateScript
This commit is contained in:
parent
0bb68542f2
commit
44cdc74071
@ -67,7 +67,10 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.tests = { inherit (nixosTests) kavita; };
|
||||
passthru = {
|
||||
tests = { inherit (nixosTests) kavita; };
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "A fast, feature rich, cross platform reading server";
|
||||
|
20
pkgs/servers/web-apps/kavita/update.sh
Executable file
20
pkgs/servers/web-apps/kavita/update.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p common-updater-scripts curl jq nix-prefetch-github prefetch-npm-deps
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
latest_version=$(curl -s https://api.github.com/repos/Kareadita/Kavita/releases/latest | jq -r '.tag_name' | tr -d v)
|
||||
|
||||
pushd "$(mktemp -d)"
|
||||
curl -s https://raw.githubusercontent.com/Kareadita/Kavita/v${latest_version}/UI/Web/package-lock.json -o package-lock.json
|
||||
npmDepsHash=$(prefetch-npm-deps package-lock.json)
|
||||
rm -f package-lock.json
|
||||
popd
|
||||
|
||||
update-source-version kavita "$latest_version"
|
||||
|
||||
$(nix-build -A kavita.backend.fetch-deps --no-out-link)
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
sed -E 's#\bnpmDepsHash = ".*?"#npmDepsHash = "'"$npmDepsHash"'"#' -i default.nix
|
||||
|
Loading…
Reference in New Issue
Block a user