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