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