mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Use '#' instead of ':' to separate flakeref and attrpath
This is less ambiguous.
This commit is contained in:
parent
5961c94097
commit
5a0e98d1e5
2 changed files with 33 additions and 37 deletions
|
@ -404,7 +404,7 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
|||
|
||||
for (auto & s : ss) {
|
||||
|
||||
size_t colon;
|
||||
size_t hash;
|
||||
std::optional<Path> storePath;
|
||||
|
||||
if (s.compare(0, 1, "(") == 0)
|
||||
|
@ -417,8 +417,14 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
|||
Strings{"legacyPackages." + std::string(s, 8)}));
|
||||
}
|
||||
|
||||
else {
|
||||
else if ((hash = s.rfind('#')) != std::string::npos)
|
||||
result.push_back(std::make_shared<InstallableFlake>(
|
||||
*this,
|
||||
FlakeRef(std::string(s, 0, hash), true),
|
||||
std::string(s, hash + 1),
|
||||
getDefaultFlakeAttrPathPrefixes()));
|
||||
|
||||
else {
|
||||
std::exception_ptr flakeEx;
|
||||
|
||||
try {
|
||||
|
@ -434,17 +440,7 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
|||
} catch (BadFlakeRef &) {
|
||||
}
|
||||
|
||||
if ((colon = s.rfind(':')) != std::string::npos) {
|
||||
auto flakeRef = std::string(s, 0, colon);
|
||||
auto attrPath = std::string(s, colon + 1);
|
||||
result.push_back(std::make_shared<InstallableFlake>(
|
||||
*this,
|
||||
FlakeRef(flakeRef, true),
|
||||
attrPath,
|
||||
getDefaultFlakeAttrPathPrefixes()));
|
||||
}
|
||||
|
||||
else if (s.find('/') != std::string::npos && (storePath = follow(s)))
|
||||
if (s.find('/') != std::string::npos && (storePath = follow(s)))
|
||||
result.push_back(std::make_shared<InstallableStorePath>(*storePath));
|
||||
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue