diff options
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r-- | src/nix-env/nix-env.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 10b95dad168c..8a7f5f0596b8 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -58,6 +58,7 @@ struct Globals bool removeAll; string forceName; bool prebuiltOnly; + bool lazyGeneration; }; @@ -510,7 +511,7 @@ static void installDerivations(Globals & globals, if (globals.dryRun) return; if (createUserEnv(*globals.state, allElems, - profile, settings.envKeepDerivations, lockToken)) break; + profile, settings.envKeepDerivations, lockToken, globals.lazyGeneration)) break; } } @@ -524,6 +525,8 @@ static void opInstall(Globals & globals, Strings opFlags, Strings opArgs) globals.preserveInstalled = true; else if (arg == "--remove-all" || arg == "-r") globals.removeAll = true; + else if (arg == "--lazy-generation") + globals.lazyGeneration = true; else throw UsageError(format("unknown flag ‘%1%’") % arg); } @@ -617,7 +620,7 @@ static void upgradeDerivations(Globals & globals, if (globals.dryRun) return; if (createUserEnv(*globals.state, newElems, - globals.profile, settings.envKeepDerivations, lockToken)) break; + globals.profile, settings.envKeepDerivations, lockToken, globals.lazyGeneration)) break; } } @@ -681,7 +684,7 @@ static void opSetFlag(Globals & globals, Strings opFlags, Strings opArgs) /* Write the new user environment. */ if (createUserEnv(*globals.state, installedElems, - globals.profile, settings.envKeepDerivations, lockToken)) break; + globals.profile, settings.envKeepDerivations, lockToken, globals.lazyGeneration)) break; } } @@ -718,7 +721,8 @@ static void opSet(Globals & globals, Strings opFlags, Strings opArgs) } debug(format("switching to new user environment")); - Path generation = createGeneration(globals.profile, drv.queryOutPath()); + Path generation = createGeneration(globals.profile, drv.queryOutPath(), + globals.lazyGeneration); switchLink(globals.profile, generation); } @@ -751,7 +755,7 @@ static void uninstallDerivations(Globals & globals, Strings & selectors, if (globals.dryRun) return; if (createUserEnv(*globals.state, newElems, - profile, settings.envKeepDerivations, lockToken)) break; + profile, settings.envKeepDerivations, lockToken, globals.lazyGeneration)) break; } } @@ -1355,6 +1359,7 @@ int main(int argc, char * * argv) globals.preserveInstalled = false; globals.removeAll = false; globals.prebuiltOnly = false; + globals.lazyGeneration = false; parseCmdLine(argc, argv, [&](Strings::iterator & arg, const Strings::iterator & end) { Operation oldOp = op; |