chrysalis: set passthru.updateScript

This commit is contained in:
éclairevoyant 2024-01-19 15:40:40 -05:00
parent ee66b69564
commit 6d1da3580b
No known key found for this signature in database
GPG key ID: E3813AEAA02DB54B
2 changed files with 18 additions and 0 deletions

View file

@ -38,6 +38,8 @@ in appimageTools.wrapType2 rec {
install -Dm444 ${appimageContents}/usr/share/icons/hicolor/256x256/chrysalis.png -t $out/share/pixmaps
'';
passthru.updateScript = ./update.sh;
meta = with lib; {
description = "A graphical configurator for Kaleidoscope-powered keyboards";
homepage = "https://github.com/keyboardio/Chrysalis";

View file

@ -0,0 +1,16 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash --pure -p curl cacert jq
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
DRV_DIR="$PWD"
relinfo=$(curl -sL 'https://api.github.com/repos/keyboardio/chrysalis/releases' | jq 'map(select(.prerelease == false)) | max_by(.tag_name)')
newver=$(echo "$relinfo" | jq --raw-output '.tag_name' | sed 's|^v||')
hashurl=$(echo "$relinfo" | jq --raw-output '.assets[] | select(.name == "latest-linux.yml").browser_download_url')
newhash=$(curl -sL "$hashurl" | grep -Po '^sha512: \K.*')
sed -i package.nix \
-e "/^ version =/ s|\".*\"|\"$newver\"|" \
-e "/sha512-/ s|\".*\"|\"sha512-$newhash\"|" \