proxypin: add update script

This commit is contained in:
emaryn
2025-04-21 10:53:48 +08:00
parent 77b5bffd0f
commit edbec42e0a
2 changed files with 36 additions and 0 deletions
+2
View File
@@ -38,6 +38,8 @@ flutter327.buildFlutterApplication rec {
install -Dm0644 assets/icon.png $out/share/pixmaps/proxypin.png
'';
passthru.updateScript = ./update.sh;
meta = {
description = "Capture HTTP(S) traffic software";
homepage = "https://github.com/wanghongenpin/proxypin";
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p yq nix bash coreutils nix-update common-updater-scripts ripgrep flutter
set -eou pipefail
PACKAGE_DIR="$(realpath "$(dirname "$0")")"
cd "$PACKAGE_DIR"/..
while ! test -f flake.nix; do cd ..; done
NIXPKGS_DIR="$PWD"
latestVersion=$(
list-git-tags --url=https://github.com/wanghongenpin/proxypin |
rg '^v(.*)' -r '$1' |
sort --version-sort |
tail -n1
)
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; proxypin.version or (lib.getVersion proxypin)" | tr -d '"')
if [[ "$currentVersion" == "$latestVersion" ]]; then
echo "package is up-to-date: $currentVersion"
exit 0
fi
nix-update --version=$latestVersion proxypin
export HOME="$(mktemp -d)"
src="$(nix-build --no-link "$NIXPKGS_DIR" -A proxypin.src)"
TMPDIR="$(mktemp -d)"
cp --recursive --no-preserve=mode "$src"/* $TMPDIR
cd $TMPDIR
flutter pub get
yq . pubspec.lock >"$PACKAGE_DIR"/pubspec.lock.json
rm -rf $TMPDIR