diff --git a/packages/swayimg/default.nix b/packages/swayimg/default.nix index 20d468f..94daf6a 100644 --- a/packages/swayimg/default.nix +++ b/packages/swayimg/default.nix @@ -2,15 +2,18 @@ , makeDesktopItem, wayland, wayland-protocols, json_c, libxkbcommon, fontconfig , giflib, libjpeg, libjxl, libpng, librsvg, libwebp, libheif, libtiff, libexif , bash-completion, ... }: - -stdenv.mkDerivation rec { +let + vals = builtins.fromJSON (builtins.readFile ../../sources/swayimg.json); + version = vals.version; + url = vals.url; + hash = vals.hash; +in stdenv.mkDerivation rec { pname = "swayimg"; - version = "1.11"; + inherit version; src = fetchurl { - url = - "https://github.com/artemsen/swayimg/archive/refs/tags/v${version}.tar.gz"; - hash = "sha256-t4U0F8rzySgZUQdkTfMbqAqQb8PsyhgNsoQau/rCdzY="; + inherit url; + inherit hash; name = "${pname}-${version}.tar.gz"; }; diff --git a/sources/swayimg.json b/sources/swayimg.json new file mode 100644 index 0000000..b197310 --- /dev/null +++ b/sources/swayimg.json @@ -0,0 +1,5 @@ +{ + "version": "1.11", + "url": "https://github.com/artemsen/swayimg/archive/refs/tags/v1.11.tar.gz", + "hash": "sha256-t4U0F8rzySgZUQdkTfMbqAqQb8PsyhgNsoQau/rCdzY=" +} diff --git a/sources/update-sources.sh b/sources/update-sources.sh new file mode 100755 index 0000000..7fefc52 --- /dev/null +++ b/sources/update-sources.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -exou pipefail + +DIRECTORY=$(realpath "$(dirname "$0")") + +# Update swayimg +SWAYIMG_VERSION=$(curl https://api.github.com/repos/artemsen/swayimg/tags | jq -r ".[0].name" | tr -d "v") +SWAYIMG_URL="https://github.com/artemsen/swayimg/archive/refs/tags/v$SWAYIMG_VERSION.tar.gz" +SWAYIMG_HASH=$(nix-prefetch fetchurl --url "$SWAYIMG_URL" -s) +jq --null-input \ + --arg version "$SWAYIMG_VERSION" \ + --arg url "$SWAYIMG_URL" \ + --arg hash "$SWAYIMG_HASH" \ + '{"version": $version, "url": $url, "hash": $hash}' \ + > $DIRECTORY/swayimg.json