From 3ad55657876b3d698c6434875abab01941323589 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Thu, 21 Mar 2024 08:52:06 -0500 Subject: [PATCH 1/4] sketchybar-app-font: 2.0.12 -> 2.0.14 Also added icon_map.sh and icon_map.lua artifacts --- .../fonts/sketchybar-app-font/default.nix | 51 +++++++++++++++---- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/pkgs/data/fonts/sketchybar-app-font/default.nix b/pkgs/data/fonts/sketchybar-app-font/default.nix index cd9af9a9c5f4..c337448a72e6 100644 --- a/pkgs/data/fonts/sketchybar-app-font/default.nix +++ b/pkgs/data/fonts/sketchybar-app-font/default.nix @@ -1,23 +1,56 @@ +let + artifacts = [ "shell" "lua" "font" ]; +in { lib , stdenvNoCC , fetchurl +, artifactList ? artifacts }: - -stdenvNoCC.mkDerivation (finalAttrs: { +let pname = "sketchybar-app-font"; - version = "2.0.12"; + version = "2.0.14"; - src = fetchurl { - url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${finalAttrs.version}/sketchybar-app-font.ttf"; - hash = "sha256-qACf4eWDeubBmJV0ApWidp2ESLREi5qiLliWCXoMBKY="; + selectedSources = map (themeName: builtins.getAttr themeName sources) artifactList; + sources = { + font = fetchurl { + url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${version}/sketchybar-app-font.ttf"; + hash = "sha256-lGzNLBtM+1Cl9tTB4yKkc46ZqDjyt8J0EPNTM/eAziY="; + }; + lua = fetchurl { + url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${version}/icon_map.lua"; + hash = "sha256-YLr7dlKliKLUEK18uG4ouXfLqodVpcDQzfu+H1+oe/w="; + }; + shell = fetchurl { + url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${version}/icon_map.sh"; + hash = "sha256-ZT/k6Vk/nO6mq1yplXaWyz9HxqwEiVWba+rk+pIRZq4="; + }; }; +in +lib.checkListOfEnum "${pname}: artifacts" artifacts artifactList + stdenvNoCC.mkDerivation +{ + inherit pname version; - dontUnpack = true; + srcs = selectedSources; + + unpackPhase = '' + for s in $selectedSources; do + b=$(basename $s) + cp $s ''${b#*-} + done + ''; installPhase = '' runHook preInstall - install -Dm644 $src $out/share/fonts/truetype/sketchybar-app-font.ttf + '' + lib.optionalString (lib.elem "font" artifactList) '' + install -Dm644 ${sources.font} "$out/share/fonts/truetype/sketchybar-app-font.ttf" + + '' + lib.optionalString (lib.elem "shell" artifactList) '' + install -Dm755 ${sources.shell} "$out/bin/icon_map.sh" + + '' + lib.optionalString (lib.elem "lua" artifactList) '' + install -Dm644 ${sources.lua} "$out/lib/${pname}/icon_map.lua" runHook postInstall ''; @@ -31,4 +64,4 @@ stdenvNoCC.mkDerivation (finalAttrs: { license = lib.licenses.cc0; maintainers = with lib.maintainers; [ khaneliman ]; }; -}) +} From 2f21ef168393c9398a4485f4d5234cf017a55db4 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Fri, 22 Mar 2024 20:38:17 -0500 Subject: [PATCH 2/4] sketchybar-app-font: 2.0.14 -> 2.0.15 --- pkgs/data/fonts/sketchybar-app-font/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/data/fonts/sketchybar-app-font/default.nix b/pkgs/data/fonts/sketchybar-app-font/default.nix index c337448a72e6..a06f8dde820b 100644 --- a/pkgs/data/fonts/sketchybar-app-font/default.nix +++ b/pkgs/data/fonts/sketchybar-app-font/default.nix @@ -8,13 +8,13 @@ in }: let pname = "sketchybar-app-font"; - version = "2.0.14"; + version = "2.0.15"; selectedSources = map (themeName: builtins.getAttr themeName sources) artifactList; sources = { font = fetchurl { url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${version}/sketchybar-app-font.ttf"; - hash = "sha256-lGzNLBtM+1Cl9tTB4yKkc46ZqDjyt8J0EPNTM/eAziY="; + hash = "sha256-s1mnoHEozmDNsW0P4z97fupAVElxikia0TYLVHJPAM4="; }; lua = fetchurl { url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${version}/icon_map.lua"; From 4a99c31cd1cbd4ff4f84371d4d36ec606e461670 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Wed, 27 Mar 2024 14:09:50 -0500 Subject: [PATCH 3/4] sketchybar-app-font: add meta.passthru.updateScript --- .../fonts/sketchybar-app-font/default.nix | 130 +++++++++++------- 1 file changed, 77 insertions(+), 53 deletions(-) diff --git a/pkgs/data/fonts/sketchybar-app-font/default.nix b/pkgs/data/fonts/sketchybar-app-font/default.nix index a06f8dde820b..0acd401462be 100644 --- a/pkgs/data/fonts/sketchybar-app-font/default.nix +++ b/pkgs/data/fonts/sketchybar-app-font/default.nix @@ -4,64 +4,88 @@ in { lib , stdenvNoCC , fetchurl +, common-updater-scripts +, curl +, jq +, writeShellScript , artifactList ? artifacts }: -let - pname = "sketchybar-app-font"; - version = "2.0.15"; - - selectedSources = map (themeName: builtins.getAttr themeName sources) artifactList; - sources = { - font = fetchurl { - url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${version}/sketchybar-app-font.ttf"; - hash = "sha256-s1mnoHEozmDNsW0P4z97fupAVElxikia0TYLVHJPAM4="; - }; - lua = fetchurl { - url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${version}/icon_map.lua"; - hash = "sha256-YLr7dlKliKLUEK18uG4ouXfLqodVpcDQzfu+H1+oe/w="; - }; - shell = fetchurl { - url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${version}/icon_map.sh"; - hash = "sha256-ZT/k6Vk/nO6mq1yplXaWyz9HxqwEiVWba+rk+pIRZq4="; - }; - }; -in -lib.checkListOfEnum "${pname}: artifacts" artifacts artifactList +lib.checkListOfEnum "sketchybar-app-font: artifacts" artifacts artifactList stdenvNoCC.mkDerivation -{ - inherit pname version; + (finalAttrs: + let + selectedSources = map (artifact: builtins.getAttr artifact finalAttrs.passthru.sources) artifactList; + in + { + pname = "sketchybar-app-font"; + version = "2.0.15"; - srcs = selectedSources; + srcs = selectedSources; - unpackPhase = '' - for s in $selectedSources; do - b=$(basename $s) - cp $s ''${b#*-} - done - ''; + unpackPhase = '' + runHook preUnpack - installPhase = '' - runHook preInstall + for s in $selectedSources; do + b=$(basename $s) + cp $s ''${b#*-} + done - '' + lib.optionalString (lib.elem "font" artifactList) '' - install -Dm644 ${sources.font} "$out/share/fonts/truetype/sketchybar-app-font.ttf" - - '' + lib.optionalString (lib.elem "shell" artifactList) '' - install -Dm755 ${sources.shell} "$out/bin/icon_map.sh" - - '' + lib.optionalString (lib.elem "lua" artifactList) '' - install -Dm644 ${sources.lua} "$out/lib/${pname}/icon_map.lua" - - runHook postInstall - ''; - - meta = { - description = "A ligature-based symbol font and a mapping function for sketchybar"; - longDescription = '' - A ligature-based symbol font and a mapping function for sketchybar, inspired by simple-bar's usage of community-contributed minimalistic app icons. + runHook postUnpack ''; - homepage = "https://github.com/kvndrsslr/sketchybar-app-font"; - license = lib.licenses.cc0; - maintainers = with lib.maintainers; [ khaneliman ]; - }; -} + + installPhase = '' + runHook preInstall + + '' + lib.optionalString (lib.elem "font" artifactList) '' + install -Dm644 ${finalAttrs.passthru.sources.font} "$out/share/fonts/truetype/sketchybar-app-font.ttf" + + '' + lib.optionalString (lib.elem "shell" artifactList) '' + install -Dm755 ${finalAttrs.passthru.sources.shell} "$out/bin/icon_map.sh" + + '' + lib.optionalString (lib.elem "lua" artifactList) '' + install -Dm644 ${finalAttrs.passthru.sources.lua} "$out/lib/sketchybar-app-font/icon_map.lua" + + runHook postInstall + ''; + + passthru = { + sources = { + font = fetchurl { + url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${finalAttrs.version}/sketchybar-app-font.ttf"; + hash = "sha256-s1mnoHEozmDNsW0P4z97fupAVElxikia0TYLVHJPAM4="; + }; + lua = fetchurl { + url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${finalAttrs.version}/icon_map.lua"; + hash = "sha256-YLr7dlKliKLUEK18uG4ouXfLqodVpcDQzfu+H1+oe/w="; + }; + shell = fetchurl { + url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${finalAttrs.version}/icon_map.sh"; + hash = "sha256-ZT/k6Vk/nO6mq1yplXaWyz9HxqwEiVWba+rk+pIRZq4="; + }; + }; + + updateScript = writeShellScript "update-sketchybar-app-font" '' + set -o errexit + export PATH="${lib.makeBinPath [ curl jq common-updater-scripts ]}" + NEW_VERSION=$(curl --silent https://api.github.com/repos/kvndrsslr/sketchybar-app-font/releases/latest | jq '.tag_name | ltrimstr("v")' --raw-output) + if [[ "${finalAttrs.version}" = "$NEW_VERSION" ]]; then + echo "The new version same as the old version." + exit 0 + fi + for artifact in ${lib.escapeShellArgs (lib.mapAttrsToList(a: _: a) finalAttrs.passthru.sources)}; do + update-source-version "sketchybar-app-font" "0" "${lib.fakeHash}" --source-key="sources.$artifact" + update-source-version "sketchybar-app-font" "$NEW_VERSION" --source-key="sources.$artifact" + done + ''; + }; + + meta = { + description = "A ligature-based symbol font and a mapping function for sketchybar"; + longDescription = '' + A ligature-based symbol font and a mapping function for sketchybar, inspired by simple-bar's usage of community-contributed minimalistic app icons. + ''; + homepage = "https://github.com/kvndrsslr/sketchybar-app-font"; + license = lib.licenses.cc0; + maintainers = with lib.maintainers; [ khaneliman ]; + }; + }) From 897a8681d3f08839ddb69217fff27f97aaae6309 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Wed, 27 Mar 2024 14:28:39 -0500 Subject: [PATCH 4/4] sketchybar-app-font: 2.0.15 -> 2.0.16 --- pkgs/data/fonts/sketchybar-app-font/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/data/fonts/sketchybar-app-font/default.nix b/pkgs/data/fonts/sketchybar-app-font/default.nix index 0acd401462be..c131069e9e74 100644 --- a/pkgs/data/fonts/sketchybar-app-font/default.nix +++ b/pkgs/data/fonts/sketchybar-app-font/default.nix @@ -18,7 +18,7 @@ lib.checkListOfEnum "sketchybar-app-font: artifacts" artifacts artifactList in { pname = "sketchybar-app-font"; - version = "2.0.15"; + version = "2.0.16"; srcs = selectedSources; @@ -52,15 +52,15 @@ lib.checkListOfEnum "sketchybar-app-font: artifacts" artifacts artifactList sources = { font = fetchurl { url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${finalAttrs.version}/sketchybar-app-font.ttf"; - hash = "sha256-s1mnoHEozmDNsW0P4z97fupAVElxikia0TYLVHJPAM4="; + hash = "sha256-mZ3LmkL54NNQzXuCyWVNlAIod3T5/aGKvnLZjZ/GYdw="; }; lua = fetchurl { url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${finalAttrs.version}/icon_map.lua"; - hash = "sha256-YLr7dlKliKLUEK18uG4ouXfLqodVpcDQzfu+H1+oe/w="; + hash = "sha256-8daDECZ8hsoyh4Rp3xbkYgPSamCylrzf8zzyu/iwZEc="; }; shell = fetchurl { url = "https://github.com/kvndrsslr/sketchybar-app-font/releases/download/v${finalAttrs.version}/icon_map.sh"; - hash = "sha256-ZT/k6Vk/nO6mq1yplXaWyz9HxqwEiVWba+rk+pIRZq4="; + hash = "sha256-h0rGkzy1smDL2guvvgeUVUD0q4n9LDKDLQJahbWHgWA="; }; };