lix/scripts/nix-build.in
Eelco Dolstra c505702265 * Fix and simplify the garbage collector (it's still not concurrent,
though).  In particular it's now much easier to register a GC root.
  Just place a symlink to whatever store path it is that you want to
  keep in /nix/var/nix/gcroots.
2005-01-27 15:21:29 +00:00

42 lines
980 B
Plaintext

#! @shell@ -e
nixExpr=$1
if test -z "$nixExpr"; then
echo "syntax: $0 NIX-EXPR..." >&2
exit 1
fi
extraArgs=
noLink=
for i in "$@"; do
case "$i" in
--no-link)
noLink=1
;;
-*)
extraArgs="$extraArgs $i"
;;
*)
storeExprs=$(@bindir@/nix-instantiate "$i")
for j in $storeExprs; do
echo "store expression is $j" >&2
done
outPaths=$(@bindir@/nix-store -rv $extraArgs $storeExprs)
for j in $outPaths; do
echo "$j"
if test -z "$noLink"; then
if test -L result; then
rm result
elif test -e result; then
echo "cannot remove \`result' (not a symlink)"
exit 1
fi
ln -s "$j" result
fi
done
;;
esac
done