diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2018-07-16 03:57:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-16 03:57:37 +0000 |
commit | 1cfc4963a90f6b12148cddc9f7527641534415bd (patch) | |
tree | 206e62d2a8ba15e07b0dbddac7d9a824d66ce4ef /nixos/modules/installer | |
parent | 7307c35f3092efc753740a0b503663367f13edc1 (diff) | |
parent | 6f72b636019031de5bca89c63fc1a00a8b3d0768 (diff) | |
download | nixlib-1cfc4963a90f6b12148cddc9f7527641534415bd.tar nixlib-1cfc4963a90f6b12148cddc9f7527641534415bd.tar.gz nixlib-1cfc4963a90f6b12148cddc9f7527641534415bd.tar.bz2 nixlib-1cfc4963a90f6b12148cddc9f7527641534415bd.tar.lz nixlib-1cfc4963a90f6b12148cddc9f7527641534415bd.tar.xz nixlib-1cfc4963a90f6b12148cddc9f7527641534415bd.tar.zst nixlib-1cfc4963a90f6b12148cddc9f7527641534415bd.zip |
Merge pull request #43147 from Ma27/fix-nixos-option-evaluation
nixos/nixos-option: don't abort in case of evaluation errors
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r-- | nixos/modules/installer/tools/nixos-option.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh index 5141f3cd51cf..3f1e591b97b0 100644 --- a/nixos/modules/installer/tools/nixos-option.sh +++ b/nixos/modules/installer/tools/nixos-option.sh @@ -16,6 +16,7 @@ verbose=false nixPath="" option="" +exit_code=0 argfun="" for arg; do @@ -74,8 +75,13 @@ fi ############################# evalNix(){ + # disable `-e` flag, it's possible that the evaluation of `nix-instantiate` fails (e.g. due to broken pkgs) + set +e result=$(nix-instantiate ${nixPath:+$nixPath} - --eval-only "$@" 2>&1) - if test $? -eq 0; then + exit_code=$? + set -e + + if test $exit_code -eq 0; then cat <<EOF $result EOF @@ -87,7 +93,7 @@ EOF ' <<EOF $result EOF - return 1; + exit_code=1 fi } @@ -317,3 +323,5 @@ else echo $result fi fi + +exit $exit_code |