home-manager: improve robustness

With this commit the activation script is run only if nix-build
succeeded.
This commit is contained in:
Robert Helgesson 2017-01-11 00:36:05 +01:00
parent a617aeaa73
commit cbc4188b68
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86

View file

@ -12,14 +12,14 @@ function doRebuild() {
local wrkdir local wrkdir
wrkdir="$(mktemp -d)" wrkdir="$(mktemp -d)"
nix-build --show-trace \ if nix-build --show-trace \
"@HOME_MANAGER_EXPR_PATH@" \ "@HOME_MANAGER_EXPR_PATH@" \
--argstr modulesPath "@MODULES_PATH@" \ --argstr modulesPath "@MODULES_PATH@" \
--argstr confPath "$confFile" \ --argstr confPath "$confFile" \
-A activation-script \ -A activation-script \
-o "$wrkdir/generation" -o "$wrkdir/generation" ; then
"$wrkdir/generation/activate"
"$wrkdir/generation/activate" fi
rm -r "$wrkdir" rm -r "$wrkdir"
} }