From e8a95108c0df56b95de9252e1cef1f74546f7f40 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <e.dolstra@tudelft.nl>
Date: Wed, 28 Jul 2004 13:32:45 +0000
Subject: [PATCH] * Nix-build places a symlink `result' in the current
 directory to the   store object just built.

---
 scripts/nix-build.in | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/scripts/nix-build.in b/scripts/nix-build.in
index c02f869bd..321add884 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
-- 
GitLab