aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-02-27 05:46:59 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-02-27 05:46:59 +0000
commit7863036634ccb07e1933cd0b106fc27d5c073004 (patch)
tree36bf7f334b739269eb741813a68adde714f67293 /src/nix/flake.cc
parent90d76fa399de4e207ea14ec4c0dd65434f60c152 (diff)
parentf0ad29acc1f2c9e82679c3af434a8bf185f36b94 (diff)
Merge remote-tracking branch 'obsidian/path-info' into ca-drv-exotic
Diffstat (limited to 'src/nix/flake.cc')
-rw-r--r--src/nix/flake.cc34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index b9cde5d6d..2f0c468a8 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -104,6 +104,14 @@ struct CmdFlakeUpdate : FlakeCommand
return "update flake lock file";
}
+ CmdFlakeUpdate()
+ {
+ /* Remove flags that don't make sense. */
+ removeFlag("recreate-lock-file");
+ removeFlag("update-input");
+ removeFlag("no-update-lock-file");
+ }
+
std::string doc() override
{
return
@@ -113,7 +121,30 @@ struct CmdFlakeUpdate : FlakeCommand
void run(nix::ref<nix::Store> store) override
{
- /* Use --refresh by default for 'nix flake update'. */
+ settings.tarballTtl = 0;
+
+ lockFlags.recreateLockFile = true;
+
+ lockFlake();
+ }
+};
+
+struct CmdFlakeLock : FlakeCommand
+{
+ std::string description() override
+ {
+ return "create missing lock file entries";
+ }
+
+ std::string doc() override
+ {
+ return
+ #include "flake-lock.md"
+ ;
+ }
+
+ void run(nix::ref<nix::Store> store) override
+ {
settings.tarballTtl = 0;
lockFlake();
@@ -1006,6 +1037,7 @@ struct CmdFlake : NixMultiCommand
CmdFlake()
: MultiCommand({
{"update", []() { return make_ref<CmdFlakeUpdate>(); }},
+ {"lock", []() { return make_ref<CmdFlakeLock>(); }},
{"info", []() { return make_ref<CmdFlakeInfo>(); }},
{"list-inputs", []() { return make_ref<CmdFlakeListInputs>(); }},
{"check", []() { return make_ref<CmdFlakeCheck>(); }},