switch-prebuilt: update

This commit is contained in:
Luke Granger-Brown 2023-01-21 18:52:15 +00:00
parent e31acba002
commit c8f1d10e4e

View file

@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: Apache-2.0
{ depot, pkgs, ... }:
{ depot, system, pkgs, ... }:
pkgs.writeShellScriptBin "switch-prebuilt" ''
set -ue
@ -14,9 +14,11 @@ pkgs.writeShellScriptBin "switch-prebuilt" ''
tmpdir="$(mktemp -d)"
trap '{ rm -rf -- "$tmpdir"; }' EXIT
${pkgs.curl}/bin/curl -so "$tmpdir/archive.zip" 'https://hg.lukegb.com/api/v4/projects/lukegb%2Fdepot/jobs/artifacts/branch%2Fdefault/download?job=nixCache'
${pkgs.curl}/bin/curl -so "$tmpdir/archive.zip" 'https://hg.lukegb.com/api/v4/projects/lukegb%2Fdepot/jobs/artifacts/branch%2Fdefault/download?job=nixCache-${system}'
${pkgs.unzip}/bin/unzip -d "$tmpdir" -q -o "$tmpdir/archive.zip"
system="$(${pkgs.jq}/bin/jq -r ".\"$(hostname)\"" "$tmpdir/systems.json")"
echo "Switching to system ''$system"
fi
if [[ ! -e "$system" ]]; then