From 301f88dd02eafd923034d798c391130c08175499 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Fri, 9 Sep 2022 18:23:14 +0300 Subject: [PATCH 1/2] nerdfonts: add update.sh script to passthru --- pkgs/data/fonts/nerdfonts/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/data/fonts/nerdfonts/default.nix b/pkgs/data/fonts/nerdfonts/default.nix index 7c4db29467fb..dbbb26971baa 100644 --- a/pkgs/data/fonts/nerdfonts/default.nix +++ b/pkgs/data/fonts/nerdfonts/default.nix @@ -59,6 +59,7 @@ stdenv.mkDerivation rec { rm -rfv $out/share/fonts/truetype/NerdFonts/*Windows\ Compatible.* ''} ''; + passthru.updateScript = ./update.sh; meta = with lib; { description = "Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts"; From ea33175d186cfa05ead3cd082bf0a49907f20638 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 2 Mar 2023 10:16:55 +0200 Subject: [PATCH 2/2] nerdfonts: Don't update if no updates are available --- pkgs/data/fonts/nerdfonts/update.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/data/fonts/nerdfonts/update.sh b/pkgs/data/fonts/nerdfonts/update.sh index b4c4aaa7cf2b..53d240feddd8 100755 --- a/pkgs/data/fonts/nerdfonts/update.sh +++ b/pkgs/data/fonts/nerdfonts/update.sh @@ -5,9 +5,14 @@ latest_release=$(curl --silent https://api.github.com/repos/ryanoasis/nerd-fonts version=$(jq -r '.tag_name' <<<"$latest_release") dirname="$(dirname "$0")" -echo \""${version#v}"\" >"$dirname/version.nix" - -echo Using version "$version" +echo \""${version#v}"\" >"$dirname/version-new.nix" +if diff -q "$dirname/version-new.nix" "$dirname/version.nix"; then + echo No new version available, current: $version + exit 0 +else + echo Updated to version "$version" + mv "$dirname/version-new.nix" "$dirname/version.nix" +fi printf '{\n' > "$dirname/shas.nix"