From 02a501705a11f14ddc21a215c01ed3c1c16a007c Mon Sep 17 00:00:00 2001
From: Cornelius Mika <cornelius.mika@gmail.com>
Date: Thu, 17 Aug 2017 10:16:26 +0200
Subject: [PATCH] home-manager: show full script path on activation error

Run the activation script in its original nix-store location so that
Bash error messages show the real script location instead of 'wrkdir',
which gets deleted right after the script exits.
---
 home-manager/home-manager | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/home-manager/home-manager b/home-manager/home-manager
index f599d9008..45fe0e1cb 100644
--- a/home-manager/home-manager
+++ b/home-manager/home-manager
@@ -91,8 +91,9 @@ function doSwitch() {
     local wrkdir
     wrkdir="$(mktemp -d)"
 
+    local generation
     local exitCode=0
-    doBuild "$wrkdir/generation" && "$wrkdir/generation/activate" || exitCode=1
+    generation=$(doBuild "$wrkdir/result") && $generation/activate || exitCode=1
 
     # Because the previous command never fails, the script keeps running and
     # $wrkdir is always removed.