From 0238865a16a01a53e2b437592dd10c3d17867cbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charlotte=20=F0=9F=A6=9D=20Delenk?= Date: Mon, 11 Nov 2024 10:26:19 +0100 Subject: [PATCH] use bash for updater --- packages/art/lotte/updater.nix | 12 ++++++++---- packages/updater.nix | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/art/lotte/updater.nix b/packages/art/lotte/updater.nix index 3b3182eb..73d5c4f4 100644 --- a/packages/art/lotte/updater.nix +++ b/packages/art/lotte/updater.nix @@ -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" '' diff --git a/packages/updater.nix b/packages/updater.nix index 443f2898..502e5725 100644 --- a/packages/updater.nix +++ b/packages/updater.nix @@ -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} ''