2004-06-22 15:12:34 +00:00
|
|
|
#! @shell@ -e
|
|
|
|
|
|
|
|
nixExpr=$1
|
|
|
|
|
|
|
|
if test -z "$nixExpr"; then
|
|
|
|
echo "syntax: $0 NIX-EXPR..." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
extraArgs=
|
2004-08-18 12:11:31 +00:00
|
|
|
noLink=
|
2004-06-22 15:12:34 +00:00
|
|
|
|
|
|
|
for i in "$@"; do
|
|
|
|
case "$i" in
|
2004-08-18 12:11:31 +00:00
|
|
|
--no-link)
|
|
|
|
noLink=1
|
|
|
|
;;
|
2004-06-22 15:12:34 +00:00
|
|
|
-*)
|
|
|
|
extraArgs="$extraArgs $i"
|
|
|
|
;;
|
|
|
|
*)
|
2004-08-18 12:11:31 +00:00
|
|
|
storeExprs=$(nix-instantiate "$i")
|
|
|
|
for j in $storeExprs; do
|
2004-06-22 15:17:04 +00:00
|
|
|
echo "store expression is $j" >&2
|
|
|
|
done
|
2004-08-18 12:11:31 +00:00
|
|
|
outPaths=$(nix-store -qnfv $extraArgs $storeExprs)
|
|
|
|
for j in $outPaths; do
|
|
|
|
echo "$j"
|
|
|
|
if test -z "$noLink"; then
|
2004-10-31 12:01:16 +00:00
|
|
|
if test -L result; then
|
2004-08-18 12:11:31 +00:00
|
|
|
rm result
|
2004-10-31 12:01:16 +00:00
|
|
|
elif test -e result; then
|
|
|
|
echo "cannot remove \`result' (not a symlink)"
|
|
|
|
exit 1
|
2004-08-18 12:11:31 +00:00
|
|
|
fi
|
|
|
|
ln -s "$j" result
|
2004-07-28 13:32:45 +00:00
|
|
|
fi
|
2004-08-18 12:11:31 +00:00
|
|
|
done
|
2004-06-22 15:12:34 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|