mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 19:49:45 +01:00
home-manager: properly forward exit codes
This commit is contained in:
parent
2452979efe
commit
398c0b36a3
1 changed files with 4 additions and 14 deletions
|
@ -248,14 +248,12 @@ function doBuild() {
|
||||||
|
|
||||||
setFlakeAttribute
|
setFlakeAttribute
|
||||||
if [[ -v FLAKE_CONFIG_URI ]]; then
|
if [[ -v FLAKE_CONFIG_URI ]]; then
|
||||||
local exitCode=0
|
|
||||||
nix build \
|
nix build \
|
||||||
"${PASSTHROUGH_OPTS[@]}" \
|
"${PASSTHROUGH_OPTS[@]}" \
|
||||||
${DRY_RUN+--dry-run} \
|
${DRY_RUN+--dry-run} \
|
||||||
${NO_OUT_LINK+--no-link} \
|
${NO_OUT_LINK+--no-link} \
|
||||||
"$FLAKE_CONFIG_URI.activationPackage" \
|
"$FLAKE_CONFIG_URI.activationPackage" \
|
||||||
|| exitCode=1
|
|| return
|
||||||
return $exitCode
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setWorkDir
|
setWorkDir
|
||||||
|
@ -263,26 +261,21 @@ function doBuild() {
|
||||||
local newsInfo
|
local newsInfo
|
||||||
newsInfo=$(buildNews)
|
newsInfo=$(buildNews)
|
||||||
|
|
||||||
local exitCode
|
|
||||||
doBuildAttr \
|
doBuildAttr \
|
||||||
${NO_OUT_LINK+--no-out-link} \
|
${NO_OUT_LINK+--no-out-link} \
|
||||||
--attr activationPackage \
|
--attr activationPackage \
|
||||||
&& exitCode=0 || exitCode=1
|
|| return
|
||||||
|
|
||||||
presentNews "$newsInfo"
|
presentNews "$newsInfo"
|
||||||
|
|
||||||
return $exitCode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function doSwitch() {
|
function doSwitch() {
|
||||||
setFlakeAttribute
|
setFlakeAttribute
|
||||||
if [[ -v FLAKE_CONFIG_URI ]]; then
|
if [[ -v FLAKE_CONFIG_URI ]]; then
|
||||||
local exitCode=0
|
|
||||||
nix run \
|
nix run \
|
||||||
"${PASSTHROUGH_OPTS[@]}" \
|
"${PASSTHROUGH_OPTS[@]}" \
|
||||||
"$FLAKE_CONFIG_URI.activationPackage" \
|
"$FLAKE_CONFIG_URI.activationPackage" \
|
||||||
|| exitCode=1
|
|| return
|
||||||
return $exitCode
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
setWorkDir
|
setWorkDir
|
||||||
|
@ -291,7 +284,6 @@ function doSwitch() {
|
||||||
newsInfo=$(buildNews)
|
newsInfo=$(buildNews)
|
||||||
|
|
||||||
local generation
|
local generation
|
||||||
local exitCode=0
|
|
||||||
|
|
||||||
# Build the generation and run the activate script. Note, we
|
# Build the generation and run the activate script. Note, we
|
||||||
# specify an output link so that it is treated as a GC root. This
|
# specify an output link so that it is treated as a GC root. This
|
||||||
|
@ -302,11 +294,9 @@ function doSwitch() {
|
||||||
doBuildAttr \
|
doBuildAttr \
|
||||||
--out-link "$generation" \
|
--out-link "$generation" \
|
||||||
--attr activationPackage \
|
--attr activationPackage \
|
||||||
&& "$generation/activate" || exitCode=1
|
&& "$generation/activate" || return
|
||||||
|
|
||||||
presentNews "$newsInfo"
|
presentNews "$newsInfo"
|
||||||
|
|
||||||
return $exitCode
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function doListGens() {
|
function doListGens() {
|
||||||
|
|
Loading…
Reference in a new issue