From 001b3f06ecf7356cdef53f4ece4ba1cd87b97e77 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 4 Aug 2008 14:58:50 +0000 Subject: [PATCH] * `nix-env --set': support --dry-run. --- src/nix-env/nix-env.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 2f2f263f5..fa053d348 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -791,10 +791,17 @@ static void opSet(Globals & globals, DrvInfo & drv(elems.front()); - if (drv.queryDrvPath(globals.state) != "") - store->buildDerivations(singleton(drv.queryDrvPath(globals.state))); - else + if (drv.queryDrvPath(globals.state) != "") { + PathSet paths = singleton(drv.queryDrvPath(globals.state)); + printMissing(paths); + if (globals.dryRun) return; + store->buildDerivations(paths); + } + else { + printMissing(singleton(drv.queryOutPath(globals.state))); + if (globals.dryRun) return; store->ensurePath(drv.queryOutPath(globals.state)); + } debug(format("switching to new user environment")); Path generation = createGeneration(globals.profile, drv.queryOutPath(globals.state));