summaryrefslogtreecommitdiff
path: root/.github/eval-flake.sh
blob: 57f52c35798977afed5777ea2c6be0f8addfc58f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -euo pipefail

args=(
    --gc-roots-dir gc-roots
    --check-cache-status
    --force-recurse
    --option allow-import-from-derivation true
    --option accept-flake-config true
    --show-trace
    --flake
    '.#hydraJobs'
)

jobs=$(nix-eval-jobs "${args[@]}" | tee eval.json | jq -s '.')

errors=$(echo "$jobs" | jq -r '.[] | select(.error)')
[ "$errors" != "" ] && exit 1

echo "$jobs" | jq -c '
	def to_os:
		if .system == "x86_64-linux" then "ubuntu-latest"
		elif .system == "x86_64-darwin" then "macos-latest"
		else null
		end;

	{
		"include": [
			.[] | {
				attr,
				isCached,
				"os": to_os
			}
		]
	}
'