diff options
-rwxr-xr-x | bild | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -3,9 +3,23 @@ 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 -nix build -o "$BIZ_ROOT/_bild/$target" \ - -f $BIZ_ROOT/default.nix "$target" --show-trace +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 + |