From cbc4188b6803cb0c0d8aabf8752e552810f09b2d Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 11 Jan 2017 00:36:05 +0100 Subject: [PATCH] home-manager: improve robustness With this commit the activation script is run only if nix-build succeeded. --- home-manager/home-manager | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/home-manager/home-manager b/home-manager/home-manager index f50dc446..47c9ebd1 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -12,14 +12,14 @@ function doRebuild() { local wrkdir wrkdir="$(mktemp -d)" - nix-build --show-trace \ - "@HOME_MANAGER_EXPR_PATH@" \ - --argstr modulesPath "@MODULES_PATH@" \ - --argstr confPath "$confFile" \ - -A activation-script \ - -o "$wrkdir/generation" - - "$wrkdir/generation/activate" + if nix-build --show-trace \ + "@HOME_MANAGER_EXPR_PATH@" \ + --argstr modulesPath "@MODULES_PATH@" \ + --argstr confPath "$confFile" \ + -A activation-script \ + -o "$wrkdir/generation" ; then + "$wrkdir/generation/activate" + fi rm -r "$wrkdir" }