mirror of
https://github.com/NixOS/nix
synced 2025-06-30 19:57:59 +02:00
Add --update-input flag to update a specific flake input
Typical usage: $ nix flake update ~/Misc/eelco-configurations/hagbard --update-input nixpkgs to update the 'nixpkgs' input of a flake while leaving every other input unchanged. The argument is an input path, so you can do e.g. '--update-input dwarffs/nixpkgs' to update an input of an input. Fixes #2928.
This commit is contained in:
parent
88b44b1e94
commit
b9fb372075
6 changed files with 76 additions and 15 deletions
|
@ -72,6 +72,22 @@ std::optional<LockedInput *> LockedInputs::findInput(const InputPath & path)
|
|||
return (LockedInput *) pos;
|
||||
}
|
||||
|
||||
void LockedInputs::removeInput(const InputPath & path)
|
||||
{
|
||||
assert(!path.empty());
|
||||
|
||||
LockedInputs * pos = this;
|
||||
|
||||
for (size_t n = 0; n < path.size(); n++) {
|
||||
auto i = pos->inputs.find(path[n]);
|
||||
if (i == pos->inputs.end()) return;
|
||||
if (n + 1 == path.size())
|
||||
pos->inputs.erase(i);
|
||||
else
|
||||
pos = &i->second;
|
||||
}
|
||||
}
|
||||
|
||||
nlohmann::json LockFile::toJson() const
|
||||
{
|
||||
auto json = LockedInputs::toJson();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue