iosevka: add update script

As outlined in the previous commit, we just need to update the source
URL in node-packages.json, and wait for node-packages.nix to be rebuilt
from it.
This commit is contained in:
Aluísio Augusto Silva Gonçalves 2020-10-31 09:49:59 -03:00
parent e6bc641ef4
commit 26ce7f2607
No known key found for this signature in database
GPG key ID: DA6EA2FACDB1CBD2
2 changed files with 25 additions and 0 deletions

View file

@ -89,6 +89,10 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true;
passthru = {
updateScript = ./update-default.sh;
};
meta = with stdenv.lib; {
homepage = "https://be5invis.github.io/Iosevka";
downloadPage = "https://github.com/be5invis/Iosevka/releases";

View file

@ -0,0 +1,21 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts coreutils gawk replace
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
nixpkgs=../../../..
repo=https://github.com/be5invis/Iosevka
# Discover the latest version.
current_version=$(nix-instantiate "$nixpkgs" --eval --strict -A iosevka.version | tr -d '"')
new_version=$(list-git-tags "$repo" | sort --reverse --version-sort | awk 'match($0, /^v([0-9.]+)$/, m) { print m[1]; exit; }')
if [[ "$new_version" == "$current_version" ]]; then
echo "iosevka: no update found"
exit
fi
# Update the source package in nodePackages.
current_source="$repo/archive/v$current_version.tar.gz"
new_source="$repo/archive/v$new_version.tar.gz"
replace-literal -ef "$current_source" "$new_source" ../../../development/node-packages/node-packages.json
echo "iosevka: $current_version -> $new_version (after nodePackages update)"