From 6e7b0a0c0e44256ddc28476d926a638947339daf Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 16 Jan 2013 16:11:51 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20=E2=80=98nixos-rebuikd=20dry-run=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/installer/tools/nixos-rebuild.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/installer/tools/nixos-rebuild.sh b/modules/installer/tools/nixos-rebuild.sh index 28a1d228293..b9272f31ac6 100644 --- a/modules/installer/tools/nixos-rebuild.sh +++ b/modules/installer/tools/nixos-rebuild.sh @@ -96,10 +96,6 @@ done if [ -z "$action" ]; then showSyntax; fi -if [ "$action" = dry-run ]; then - extraBuildFlags+=(--dry-run) -fi - if [ -n "$rollback" ]; then buildNix= fi @@ -129,7 +125,7 @@ fi # First build Nix, since NixOS may require a newer version than the # current one. Of course, the same goes for Nixpkgs, but Nixpkgs is # more conservative. -if [ -n "$buildNix" ]; then +if [ "$action" != dry-run -a -n "$buildNix" ]; then echo "building Nix..." >&2 if ! nix-build '' -A config.environment.nix -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then if ! nix-build '' -A nixFallback -o $tmpDir/nix "${extraBuildFlags[@]}" > /dev/null; then @@ -150,6 +146,11 @@ if nixos=$(nix-instantiate --find-file nixos "${extraBuildFlags[@]}"); then fi +if [ "$action" = dry-run ]; then + extraBuildFlags+=(--dry-run) +fi + + # Either upgrade the configuration in the system profile (for "switch" # or "boot"), or just build it and create a symlink "result" in the # current directory (for "build" and "test").