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
|
|
|
|
2005-02-01 12:36:25 +00:00
|
|
|
userName=$USER
|
|
|
|
if test -z "$username"; then userName="unknown"; fi
|
|
|
|
|
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"
|
|
|
|
;;
|
|
|
|
*)
|
2005-02-01 12:36:25 +00:00
|
|
|
storeExprs=$(@bindir@/nix-instantiate \
|
|
|
|
--add-root "@localstatedir@/nix/gcroots/nix-build/$userName-drv" \
|
|
|
|
"$i")
|
2004-08-18 12:11:31 +00:00
|
|
|
for j in $storeExprs; do
|
2004-06-22 15:17:04 +00:00
|
|
|
echo "store expression is $j" >&2
|
|
|
|
done
|
2005-02-01 12:36:25 +00:00
|
|
|
outPaths=$(@bindir@/nix-store \
|
|
|
|
--add-root "@localstatedir@/nix/gcroots/nix-build/$userName-out" \
|
|
|
|
-rv $extraArgs $storeExprs)
|
2004-08-18 12:11:31 +00:00
|
|
|
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
|