diff options
author | Nick Van den Broeck <nick.van.den.broeck666@gmail.com> | 2019-05-14 11:34:45 +0200 |
---|---|---|
committer | Nick Van den Broeck <nick.van.den.broeck666@gmail.com> | 2019-05-17 14:50:10 +0200 |
commit | ef6ae61503bed7afa73a45ca6a4fb3597a9e514d (patch) | |
tree | edf2dfcbf924ebddc1e06302c6c20f310d313b58 /src/nix/installables.cc | |
parent | 98f20dee41e9d4dccb5a6bbbd956ab856c5f7929 (diff) |
Lockfile handling in `resolveFlake` is fixed
Diffstat (limited to 'src/nix/installables.cc')
-rw-r--r-- | src/nix/installables.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc index 25f3f4f9d..a2a55d949 100644 --- a/src/nix/installables.cc +++ b/src/nix/installables.cc @@ -26,6 +26,16 @@ SourceExprCommand::SourceExprCommand() .longName("recreate-lock-file") .description("recreate lock file from scratch") .set(&recreateLockFile, true); + + mkFlag() + .longName("dont-save-lock-file") + .description("save the newly generated lock file") + .set(&saveLockFile, false); + + mkFlag() + .longName("no-registries") + .description("don't use flake registries") + .set(&noRegistries, true); } ref<EvalState> SourceExprCommand::getEvalState() @@ -158,10 +168,12 @@ struct InstallableFlake : InstallableValue Value * toValue(EvalState & state) override { auto vFlake = state.allocValue(); - if (std::get_if<FlakeRef::IsPath>(&flakeRef.data)) - updateLockFile(state, flakeRef.to_string(), cmd.recreateLockFile); - makeFlakeValue(state, flakeRef, cmd.recreateLockFile ? RecreateLockFile : UpdateLockFile, *vFlake); + HandleLockFile handle = cmd.noRegistries ? AllPure : + cmd.recreateLockFile ? + (cmd.saveLockFile ? RecreateLockFile : UseNewLockFile) + : (cmd.saveLockFile ? UpdateLockFile : UseUpdatedLockFile); + makeFlakeValue(state, flakeRef, handle, *vFlake); auto vProvides = (*vFlake->attrs->get(state.symbols.create("provides")))->value; |