Skip to content

Instantly share code, notes, and snippets.

@LnL7
Last active September 20, 2018 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LnL7/81553319258460b4e04f0251133da1cc to your computer and use it in GitHub Desktop.
Save LnL7/81553319258460b4e04f0251133da1cc to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
hydra-job-revision() {
local jobseteval job=$1
shift 1
case "$job" in
*'/'*) ;;
*) job="nixpkgs/trunk/$job" ;;
esac
case "$job" in
'http://'*|'https://'*) ;;
*) job="https://hydra.nixos.org/job/$job" ;;
esac
jobseteval=$(curl -fsSL -H 'Content-Type: application/json' "$job/latest" | jq '.jobsetevals[0]')
curl -fsSL -H 'Accept: application/json' "''${job%/job*}/eval/$jobseteval" | jq -r '.jobsetevalinputs.nixpkgs.revision'
}
hydra-job-revision "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment