outline: fix updateScript

This commit is contained in:
Adam C. Stephens
2026-07-14 12:05:11 -04:00
parent bdc2fa0b31
commit 450e6f4683
2 changed files with 42 additions and 2 deletions
+1 -2
View File
@@ -3,7 +3,6 @@
lib,
fetchFromGitHub,
makeWrapper,
nix-update-script,
nodejs,
nixosTests,
yarn-berry_4,
@@ -70,7 +69,7 @@ stdenv.mkDerivation (finalAttrs: {
tests = {
basic-functionality = nixosTests.outline;
};
updateScript = nix-update-script { };
updateScript = ./update.sh;
# alias for nix-update to be able to find and update this attribute
inherit (finalAttrs) offlineCache;
};
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts coreutils curl git gnused jq nix-prefetch-github yarn-berry.yarn-berry-fetcher
set -o errexit -o nounset -o pipefail
package="outline"
owner="outline"
repo="outline"
package_dir="pkgs/by-name/${package::2}/${package}"
#
# package
#
current_version=$(nix-instantiate --eval --expr "with import ./. {}; ${package}.version" --raw)
echo "Current version: ${current_version}"
latest_version=$(curl --silent "https://api.github.com/repos/${owner}/${repo}/releases" | jq '.[0].tag_name' --raw-output | sed 's/^v//')
echo "Latest version: ${latest_version}"
if [[ "${current_version}" == "${latest_version}" ]]; then
echo "${package} is up to date: ${current_version}"
exit 0
fi
echo "Updating ${package} from ${current_version} to ${latest_version}"
update-source-version "${package}" "${latest_version}"
#
# yarn deps
#
echo "Regenerating missing-hashes.json…"
src_path=$(nix-build --attr "${package}.src" --no-link)
yarn-berry-fetcher missing-hashes "${src_path}/yarn.lock" >"${package_dir}/missing-hashes.json"
echo "Updating offline cache hash…"
update-source-version "${package}" --ignore-same-version --source-key=offlineCache
echo "Done."