nixos-install: more robust way of sourcing fresh version of self

This commit is contained in:
obadz 2016-08-07 01:17:41 +01:00
parent 918b11e64c
commit 57b7c3c545

View File

@ -214,9 +214,9 @@ fi
# Re-execute nixos-rebuild from the Nixpkgs tree.
if [ -z "$_NIXOS_REBUILD_REEXEC" -a -n "$canRun" ]; then
if p=$(nix-instantiate --find-file nixpkgs/nixos/modules/installer/tools/nixos-rebuild.sh "${extraBuildFlags[@]}"); then
if p=$(nix-build --no-out-link --expr 'with import <nixpkgs/nixos> {}; config.system.build.nixos-rebuild' "${extraBuildFlags[@]}"); then
export _NIXOS_REBUILD_REEXEC=1
exec $SHELL -e $p "${origArgs[@]}"
exec $p/bin/nixos-rebuild "${origArgs[@]}"
exit 1
fi
fi