diff --git a/nix/cache.nix b/nix/cache.nix index 2305640..daadc80 100644 --- a/nix/cache.nix +++ b/nix/cache.nix @@ -20,7 +20,10 @@ in writeShellApplication { packer ]; text = '' - mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET" + push="''${1:-yes}" + if [ "$push" == "yes" ]; then + mc alias set storage "$STORAGE_URL" root "$MINIO_SECRET" + fi mkdir -p cache '' + (concatStringsSep "\n" ( map (d: '' @@ -29,7 +32,9 @@ in writeShellApplication { # shellcheck disable=SC2143 if [ -z "$(mc ls storage/isos/cache/ | grep "$sha")" ]; then curl -L --retry 3 --retry-all-errors -o "cache/$sha.iso" "$url" - mc put "cache/$sha.iso" "storage/isos/cache/$sha.iso" + if [ "$push" == "yes" ]; then + mc put "cache/$sha.iso" "storage/isos/cache/$sha.iso" + fi else echo "Skipping ${d.distro} - cache/$sha.iso" fi