aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-08-18 12:11:31 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-08-18 12:11:31 +0000
commit937ce0cd214c12276a2c373b515dc2541d1582fd (patch)
tree6777e06418010b54be923d780f81214adf1cce42 /scripts
parent966bd9d19fb43b6a6022572eb7d80c1e03bfaf3e (diff)
* Flag `--no-link' suppresses symlinking to the output path.
* Handle multiple derivations correctly.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/nix-build.in30
1 files changed, 19 insertions, 11 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index 321add884..9ae5a0ede 100755
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -8,27 +8,35 @@ if test -z "$nixExpr"; then
fi
extraArgs=
+noLink=
for i in "$@"; do
case "$i" in
+ --no-link)
+ noLink=1
+ ;;
-*)
extraArgs="$extraArgs $i"
;;
*)
- storeExpr=$(nix-instantiate "$i")
- for j in $storeExpr; do
+ storeExprs=$(nix-instantiate "$i")
+ for j in $storeExprs; do
echo "store expression is $j" >&2
done
- outPath=$(nix-store -qnfv $extraArgs $storeExpr)
- echo $outPath
- if test -e result; then
- if ! test -L result; then
- echo "cannot remove \`result\' (not a symlink)"
- exit 1
+ outPaths=$(nix-store -qnfv $extraArgs $storeExprs)
+ for j in $outPaths; do
+ echo "$j"
+ if test -z "$noLink"; then
+ if test -e result; then
+ if ! test -L result; then
+ echo "cannot remove \`result\' (not a symlink)"
+ exit 1
+ fi
+ rm result
+ fi
+ ln -s "$j" result
fi
- rm result
- fi
- ln -s $outPath result
+ done
;;
esac
done