Fix ‘nixos-rebuikd dry-run’

This commit is contained in:
Eelco Dolstra 2013-01-16 16:11:51 +01:00
parent e65a49f00f
commit 6e7b0a0c0e

View File

@ -96,10 +96,6 @@ done
if [ -z "$action" ]; then showSyntax; fi if [ -z "$action" ]; then showSyntax; fi
if [ "$action" = dry-run ]; then
extraBuildFlags+=(--dry-run)
fi
if [ -n "$rollback" ]; then if [ -n "$rollback" ]; then
buildNix= buildNix=
fi fi
@ -129,7 +125,7 @@ fi
# First build Nix, since NixOS may require a newer version than the # First build Nix, since NixOS may require a newer version than the
# current one. Of course, the same goes for Nixpkgs, but Nixpkgs is # current one. Of course, the same goes for Nixpkgs, but Nixpkgs is
# more conservative. # more conservative.
if [ -n "$buildNix" ]; then if [ "$action" != dry-run -a -n "$buildNix" ]; then
echo "building Nix..." >&2 echo "building Nix..." >&2
if ! nix-build '<nixos>' -A config.environment.nix -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then if ! nix-build '<nixos>' -A config.environment.nix -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then
if ! nix-build '<nixos>' -A nixFallback -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then if ! nix-build '<nixos>' -A nixFallback -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then
@ -150,6 +146,11 @@ if nixos=$(nix-instantiate --find-file nixos "${extraBuildFlags[@]}"); then
fi fi
if [ "$action" = dry-run ]; then
extraBuildFlags+=(--dry-run)
fi
# Either upgrade the configuration in the system profile (for "switch" # Either upgrade the configuration in the system profile (for "switch"
# or "boot"), or just build it and create a symlink "result" in the # or "boot"), or just build it and create a symlink "result" in the
# current directory (for "build" and "test"). # current directory (for "build" and "test").