depot/ops/nixos/lib/latest_system_closure.sh

11 lines
382 B
Bash
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash jq curl unzip
set -euo pipefail
tmpdir="$(mktemp -d)"
trap '{ rm -rf -- "$tmpdir"; }' EXIT
curl -so "$tmpdir/archive.zip" 'https://hg.lukegb.com/api/v4/projects/lukegb%2Fdepot/jobs/artifacts/branch%2Fdefault/download?job=nixCache'
unzip -d "$tmpdir" -q -o "$tmpdir/archive.zip"
jq -r ".\"$(hostname)\"" "$tmpdir/systems.json"