mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
937ce0cd21
* Handle multiple derivations correctly.
42 lines
1,004 B
Text
Executable file
42 lines
1,004 B
Text
Executable file
#! @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=$(nix-instantiate "$i")
|
|
for j in $storeExprs; do
|
|
echo "store expression is $j" >&2
|
|
done
|
|
outPaths=$(nix-store -qnfv $extraArgs $storeExprs)
|
|
for j in $outPaths; do
|
|
echo "$j"
|
|
if test -z "$noLink"; then
|
|
if test -e result; then
|
|
if ! test -L result; then
|
|
echo "cannot remove \`result\' (not a symlink)"
|
|
exit 1
|
|
fi
|
|
rm result
|
|
fi
|
|
ln -s "$j" result
|
|
fi
|
|
done
|
|
;;
|
|
esac
|
|
done
|