blob: 1cde3f025e467f140d34ea3856ccc451afc97e94 (
plain) (
blame)
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
44
45
46
47
48
49
50
51
|
#! /usr/bin/env sh
set -eu
root="$(git rev-parse --show-toplevel)"
wrong_arg=false
use_dirty=true
for arg in "$@"; do
case "$arg" in
--dirty)
use_dirty=true
;;
--clean)
use_dirty=false
;;
*)
echo "arg '$arg' is not known."
wrong_arg=true
;;
esac
done
if [ "$wrong_arg" = true ]; then
exit 2
fi
if [ "$use_dirty" = "false" ]; then
tmp="$(mktemp -d -t "server_build_script_XXXXX")"
trap 'rm -r "$tmp"' EXIT
git archive --format=tar.gz HEAD | {
cd "$tmp"
tar -xz
}
cd "$tmp"
fi
for host in "server2" "server3"; do
nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --print-out-paths --option max-jobs 1
result_file="$root/result-$host"
if [ -L "$result_file" ]; then
rm "$result_file"
fi
nix-store --add-root "$result_file" --realise "$(readlink -f ./result)"
rm ./result
done
# vim: ft=sh
|