use bash for updater

This commit is contained in:
Charlotte 🦝 Delenk 2024-11-11 10:26:19 +01:00
parent 2ed51d604a
commit 0238865a16
2 changed files with 11 additions and 6 deletions

View file

@ -2,14 +2,18 @@
nix-prefetch-git,
curl,
jq,
lib,
}:
let
srcInfo = lib.importJSON ./source.json;
in
''
echo "lotte-art: Checking for updates"
set CURRENT_COMMIT $(${curl}/bin/curl https://git.chir.rs/api/v1/repos/darkkirb/lotte-art/commits | ${jq}/bin/jq -r '.[0].sha')
set KNOWN_COMMIT $(${jq}/bin/jq -r '.rev' packages/art/lotte/source.json)
if [ $CURRENT_COMMIT != $KNOWN_COMMIT ];
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
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
end
fi
echo "lotte-art: Done"
''

View file

@ -2,12 +2,13 @@
lib,
callPackage,
writeScriptBin,
fish,
bash,
}:
let
script = lib.concatMapStringsSep "\n" (f: callPackage "${f}/updater.nix" { }) [ ./art ];
in
writeScriptBin "updater" ''
#!${fish}/bin/fish
#!${bash}/bin/bash
set -euxo pipefail
${script}
''