* Flag `--no-link' suppresses symlinking to the output path.
* Handle multiple derivations correctly.
This commit is contained in:
parent
966bd9d19f
commit
937ce0cd21
1 changed files with 19 additions and 11 deletions
|
@ -8,19 +8,25 @@ if test -z "$nixExpr"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
extraArgs=
|
extraArgs=
|
||||||
|
noLink=
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
case "$i" in
|
case "$i" in
|
||||||
|
--no-link)
|
||||||
|
noLink=1
|
||||||
|
;;
|
||||||
-*)
|
-*)
|
||||||
extraArgs="$extraArgs $i"
|
extraArgs="$extraArgs $i"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
storeExpr=$(nix-instantiate "$i")
|
storeExprs=$(nix-instantiate "$i")
|
||||||
for j in $storeExpr; do
|
for j in $storeExprs; do
|
||||||
echo "store expression is $j" >&2
|
echo "store expression is $j" >&2
|
||||||
done
|
done
|
||||||
outPath=$(nix-store -qnfv $extraArgs $storeExpr)
|
outPaths=$(nix-store -qnfv $extraArgs $storeExprs)
|
||||||
echo $outPath
|
for j in $outPaths; do
|
||||||
|
echo "$j"
|
||||||
|
if test -z "$noLink"; then
|
||||||
if test -e result; then
|
if test -e result; then
|
||||||
if ! test -L result; then
|
if ! test -L result; then
|
||||||
echo "cannot remove \`result\' (not a symlink)"
|
echo "cannot remove \`result\' (not a symlink)"
|
||||||
|
@ -28,7 +34,9 @@ for i in "$@"; do
|
||||||
fi
|
fi
|
||||||
rm result
|
rm result
|
||||||
fi
|
fi
|
||||||
ln -s $outPath result
|
ln -s "$j" result
|
||||||
|
fi
|
||||||
|
done
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue