Autoupdate swayimg

This commit is contained in:
Nathan McCarty 2023-05-14 18:54:38 -04:00
parent 4c08a978e0
commit ab2ae28c47
Signed by: thatonelutenist
SSH Key Fingerprint: SHA256:hwQEcmak9E6sdU9bXc98RHw/Xd1AhpB5HZT7ZSVJkRM
3 changed files with 30 additions and 6 deletions

View File

@ -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";
};

5
sources/swayimg.json Normal file
View File

@ -0,0 +1,5 @@
{
"version": "1.11",
"url": "https://github.com/artemsen/swayimg/archive/refs/tags/v1.11.tar.gz",
"hash": "sha256-t4U0F8rzySgZUQdkTfMbqAqQb8PsyhgNsoQau/rCdzY="
}

16
sources/update-sources.sh Executable file
View File

@ -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