about summary refs log tree commit diff
path: root/src/nix-env/nix-env.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-08-04T14·58+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-08-04T14·58+0000
commit001b3f06ecf7356cdef53f4ece4ba1cd87b97e77 (patch)
treefabe3ad8fb6e7645c12aa124281028b2da2a6f2e /src/nix-env/nix-env.cc
parent7592f48c83b2f333fa7c5e85fd2fb64445b1c6ca (diff)
* `nix-env --set': support --dry-run.
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r--src/nix-env/nix-env.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 2f2f263f54a1..fa053d348411 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<PathSet>(drv.queryDrvPath(globals.state)));
-    else
+    if (drv.queryDrvPath(globals.state) != "") {
+        PathSet paths = singleton<PathSet>(drv.queryDrvPath(globals.state));
+        printMissing(paths);
+        if (globals.dryRun) return;
+        store->buildDerivations(paths);
+    }
+    else {
+        printMissing(singleton<PathSet>(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));