blob: fdd3dd713b87cda0c081c757ab4d44dd79774543 (
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
|
#!/usr/bin/env bash
set -ex
prefix=$(echo $PWD | sed -e "s|^$BIZ_ROOT/*||g" -e "s|/|.|g")
if [[ "$prefix" == "" ]]
then
# TODO: make this accept any number of build targets
target="$1"
else
target="$prefix.$1"
fi
log=$(mktemp)
nix-build \
-o "$BIZ_ROOT/_bild/$target" \
$BIZ_ROOT/default.nix \
--attr "$target" \
--show-trace \
2>&1 \
| tee $log
if [[ ${PIPESTATUS[0]} != 0 ]]
then
o=$(gawk "match(\$0, /'(.*)'\sfailed/, a) {print a[1]}" $log \
| head -n 1)
nix log $o
fi
|