aboutsummaryrefslogtreecommitdiff
path: root/src/nix/installables.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/installables.cc')
-rw-r--r--src/nix/installables.cc18
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;