diff options
author | Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> | 2023-10-31 16:19:05 +0100 |
---|---|---|
committer | Lunaphied <lunaphied@lunaphied.me> | 2024-03-25 17:36:24 -0600 |
commit | 86881226b0e51c204f07385b7b57743c23e34d44 (patch) | |
tree | 737e75ee7cc6ec8932b850ff6f20adfc4e285628 /src/libexpr/flake/flake.cc | |
parent | aa7653608d4d0028bb98af491aec76b2fea7f882 (diff) |
Merge pull request #8817 from iFreilicht/flake-update-lock-overhaul
Overhaul `nix flake update` and `nix flake lock` UX
(cherry picked from commit 12a0ae73dbb37becefa5a442eb4532ff0de9ce65)
Change-Id: Iff3b4f4235ebb1948ec612036b39ab29e4ca22b2
Diffstat (limited to 'src/libexpr/flake/flake.cc')
-rw-r--r-- | src/libexpr/flake/flake.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index d96f2b22e..2c51f8752 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -451,8 +451,8 @@ LockedFlake lockFlake( assert(input.ref); - /* Do we have an entry in the existing lock file? And we - don't have a --update-input flag for this input? */ + /* Do we have an entry in the existing lock file? + And the input is not in updateInputs? */ std::shared_ptr<LockedNode> oldLock; updatesUsed.insert(inputPath); @@ -476,9 +476,8 @@ LockedFlake lockFlake( node->inputs.insert_or_assign(id, childNode); - /* If we have an --update-input flag for an input - of this input, then we must fetch the flake to - update it. */ + /* If we have this input in updateInputs, then we + must fetch the flake to update it. */ auto lb = lockFlags.inputUpdates.lower_bound(inputPath); auto mustRefetch = @@ -620,7 +619,7 @@ LockedFlake lockFlake( for (auto & i : lockFlags.inputUpdates) if (!updatesUsed.count(i)) - warn("the flag '--update-input %s' does not match any input", printInputPath(i)); + warn("'%s' does not match any input of this flake", printInputPath(i)); /* Check 'follows' inputs. */ newLockFile.check(); @@ -655,14 +654,14 @@ LockedFlake lockFlake( bool lockFileExists = pathExists(outputLockFilePath); + auto s = chomp(diff); if (lockFileExists) { - auto s = chomp(diff); if (s.empty()) warn("updating lock file '%s'", outputLockFilePath); else warn("updating lock file '%s':\n%s", outputLockFilePath, s); } else - warn("creating lock file '%s'", outputLockFilePath); + warn("creating lock file '%s':\n%s", outputLockFilePath, s); std::optional<std::string> commitMessage = std::nullopt; |