about summary refs log tree commit diff
path: root/scripts/nix-build.in
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-07-28T13·32+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-07-28T13·32+0000
commite8a95108c0df56b95de9252e1cef1f74546f7f40 (patch)
treec2033786dda93406634d213b04ee864976d776c8 /scripts/nix-build.in
parent9bf7a5f516c9f6a9445e76d3166d173f5ab958bb (diff)
* Nix-build places a symlink `result' in the current directory to the
  store object just built.

Diffstat (limited to 'scripts/nix-build.in')
-rwxr-xr-xscripts/nix-build.in11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index c02f869bde55..321add884f24 100755
--- a/scripts/nix-build.in
+++ b/scripts/nix-build.in
@@ -19,7 +19,16 @@ for i in "$@"; do
             for j in $storeExpr; do
                 echo "store expression is $j" >&2
             done
-            nix-store -qnfv $extraArgs $storeExpr
+            outPath=$(nix-store -qnfv $extraArgs $storeExpr)
+            echo $outPath
+            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 $outPath result
             ;;
     esac
 done