summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorNicolas B. Pierron <nicolas.b.pierron@gmail.com>2014-12-19 23:00:52 +0100
committerNicolas B. Pierron <nicolas.b.pierron@gmail.com>2014-12-19 23:00:52 +0100
commitcd2f7ce9f9f10894c6d2a5995f06fb9d2a7f6795 (patch)
treef4dea63c952f676f49ee81bc91a6133dec09c04d /nixos/modules/installer
parentb2abfe54b3da8eddda3135561c0c841c3023966d (diff)
downloadnixlib-cd2f7ce9f9f10894c6d2a5995f06fb9d2a7f6795.tar
nixlib-cd2f7ce9f9f10894c6d2a5995f06fb9d2a7f6795.tar.gz
nixlib-cd2f7ce9f9f10894c6d2a5995f06fb9d2a7f6795.tar.bz2
nixlib-cd2f7ce9f9f10894c6d2a5995f06fb9d2a7f6795.tar.lz
nixlib-cd2f7ce9f9f10894c6d2a5995f06fb9d2a7f6795.tar.xz
nixlib-cd2f7ce9f9f10894c6d2a5995f06fb9d2a7f6795.tar.zst
nixlib-cd2f7ce9f9f10894c6d2a5995f06fb9d2a7f6795.zip
nixos-option: Improve error messages to avoid reporting internal location and traces.
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/tools/nixos-option.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh
index b5f69f07826c..4478059813d1 100644
--- a/nixos/modules/installer/tools/nixos-option.sh
+++ b/nixos/modules/installer/tools/nixos-option.sh
@@ -69,7 +69,18 @@ fi
 #############################
 
 evalNix(){
-  nix-instantiate - --eval-only "$@"
+  result=$(nix-instantiate - --eval-only "$@" 2>&1)
+  if test $? -eq 0; then
+      cat <<EOF
+$result
+EOF
+      return 0;
+  else
+      sed -n '/error/ { s/, at (string):[0-9]*:[0-9]*//; p; }' <<EOF
+$result
+EOF
+      return 1;
+  fi
 }
 
 evalAttr(){