nixos-config/packages/art/lotte/updater.nix

20 lines
589 B
Nix
Raw Normal View History

2024-11-10 21:20:25 +00:00
{
nix-prefetch-git,
curl,
jq,
2024-11-11 09:26:19 +00:00
lib,
2024-11-10 21:20:25 +00:00
}:
2024-11-11 09:26:19 +00:00
let
srcInfo = lib.importJSON ./source.json;
in
2024-11-10 21:20:25 +00:00
''
echo "lotte-art: Checking for updates"
2024-11-11 09:26:19 +00:00
CURRENT_COMMIT=$(${curl}/bin/curl https://git.chir.rs/api/v1/repos/darkkirb/lotte-art/commits | ${jq}/bin/jq -r '.[0].sha')
KNOWN_COMMIT=${srcInfo.rev}
if [ $CURRENT_COMMIT != $KNOWN_COMMIT ]; then
2024-11-10 21:20:25 +00:00
echo "lotte-art: Updating from $KNOWN_COMMIT to $CURRENT_COMMIT"
${nix-prefetch-git}/bin/nix-prefetch-git https://git.chir.rs/darkkirb/lotte-art --fetch-lfs | ${jq}/bin/jq > packages/art/lotte/source.json
2024-11-11 09:26:19 +00:00
fi
2024-11-10 21:20:25 +00:00
echo "lotte-art: Done"
''