nix: Support nixpkgs.<attrpath> for compatibility

This commit is contained in:
Eelco Dolstra 2019-04-08 16:22:04 +02:00
parent d2875f6782
commit 4023ae4cdf

View file

@ -203,6 +203,12 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
if (s.compare(0, 1, "(") == 0) if (s.compare(0, 1, "(") == 0)
result.push_back(std::make_shared<InstallableExpr>(*this, s)); result.push_back(std::make_shared<InstallableExpr>(*this, s));
else if (hasPrefix(s, "nixpkgs.")) {
bool static warned;
warnOnce(warned, "the syntax 'nixpkgs.<attr>' is deprecated; use 'nixpkgs:<attr>' instead");
result.push_back(std::make_shared<InstallableFlake>(*this, FlakeRef("nixpkgs"), std::string(s, 8)));
}
else if ((colon = s.rfind(':')) != std::string::npos) { else if ((colon = s.rfind(':')) != std::string::npos) {
auto flakeRef = std::string(s, 0, colon); auto flakeRef = std::string(s, 0, colon);
auto attrPath = std::string(s, colon + 1); auto attrPath = std::string(s, colon + 1);
@ -214,17 +220,8 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
result.push_back(std::make_shared<InstallableStorePath>(path)); result.push_back(std::make_shared<InstallableStorePath>(path));
} }
else {
result.push_back(std::make_shared<InstallableFlake>(*this, FlakeRef("nixpkgs"), s));
}
/*
else if (s == "" || std::regex_match(s, attrPathRegex))
result.push_back(std::make_shared<InstallableAttrPath>(cmd, s));
else else
throw UsageError("don't know what to do with argument '%s'", s); result.push_back(std::make_shared<InstallableFlake>(*this, FlakeRef("nixpkgs"), s));
*/
} }
} }