Merge pull request #223558 from vamega/karabiner-elements-update-script

karabiner-elements: Add updateScript
This commit is contained in:
Ilan Joselevich 2023-04-01 02:06:55 +03:00 committed by GitHub
commit 4a7fce0a52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -40,6 +40,8 @@ stdenv.mkDerivation rec {
cp "$out/Library/Application Support/org.pqrs/Karabiner-Elements/package-version" "$out/Library/Application Support/org.pqrs/Karabiner-Elements/version"
'';
passthru.updateScript = ./updater.sh;
meta = with lib; {
description = "Karabiner-Elements is a powerful utility for keyboard customization on macOS Sierra (10.12) or later.";
homepage = "https://karabiner-elements.pqrs.org/";

View file

@ -0,0 +1,13 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=./. -i bash -p curl jq common-updater-scripts
set -eo pipefail
new_version="$(curl -s "https://api.github.com/repos/pqrs-org/Karabiner-Elements/releases/latest" | jq -r '.tag_name | ltrimstr("v")')"
old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
if [[ "$new_version" == "$old_version" ]]; then
echo "Already up to date!"
exit 0
fi
update-source-version karabiner-elements "${new_version}"