-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_remote.sh
More file actions
executable file
·43 lines (37 loc) · 1.19 KB
/
build_remote.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.19 KB
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
37
38
39
40
41
42
43
#!/usr/bin/env bash
set -euo pipefail
if [[ ${CI_MODE:-} != "" ]]; then
exec nix build "$@"
fi
cmd="nix"
if command -v nom &>/dev/null; then
cmd="nom"
fi
# Associative array: name -> builder config
declare -A builder_configs
builder_configs["nix-builder"]="ssh-ng://nix-ssh@fde3:b424:b5ce:1:be24:11ff:feb5:580c x86_64-linux /root/.ssh/id_ed25519 8 100 kvm,big-parallel,nixos-test"
builder_configs["iehsrv995"]="ssh://iehadmin@iehsrv995.ieh.kit.edu x86_64-linux /root/.ssh/id_ed25519 32 100 kvm,big-parallel,nixos-test"
# Build the builders string based on --only-builders filter (must be first argument)
if [[ "${1:-}" == "--only-builders" ]]; then
IFS=',' read -ra selected <<< "$2"
shift 2
else
selected=("${!builder_configs[@]}")
fi
builders=""
for builder in "${selected[@]}"; do
if [[ -v "builder_configs[$builder]" ]]; then
if [[ -n "$builders" ]]; then
builders+=$'\n'
fi
builders+="${builder_configs[$builder]}"
else
echo "Error: Unknown builder '$builder'" >&2
exit 1
fi
done
exec "$cmd" build \
--option always-allow-substitutes true \
--option builders-use-substitutes true \
--builders "$builders" \
"$@"