mirror of
https://github.com/NixOS/nix
synced 2025-06-30 19:57:59 +02:00
Add flag --override-input to override specific lock file entries
E.g. $ nix flake update ~/Misc/eelco-configurations/hagbard \ --override-input 'dwarffs/nixpkgs' ../my-nixpkgs overrides the 'nixpkgs' input of the 'dwarffs' input of the top-level flake. Fixes #2837.
This commit is contained in:
parent
e53c89a643
commit
f68bed7f67
8 changed files with 75 additions and 26 deletions
|
@ -1,5 +1,6 @@
|
|||
#include "lockfile.hh"
|
||||
#include "store-api.hh"
|
||||
#include "fetchers/regex.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
@ -104,4 +105,20 @@ void LockFile::write(const Path & path) const
|
|||
writeFile(path, fmt("%s\n", *this));
|
||||
}
|
||||
|
||||
InputPath parseInputPath(std::string_view s)
|
||||
{
|
||||
InputPath path;
|
||||
|
||||
for (auto & elem : tokenizeString<std::vector<std::string>>(s, "/")) {
|
||||
if (!std::regex_match(elem, fetchers::flakeIdRegex))
|
||||
throw Error("invalid flake input path element '%s'", elem);
|
||||
path.push_back(elem);
|
||||
}
|
||||
|
||||
if (path.empty())
|
||||
throw Error("flake input path is empty");
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue