aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-04-08 16:22:04 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-04-08 16:22:04 +0200
commit4023ae4cdf146b2ee491c12ec64e8605984bf49a (patch)
tree84524cd322710fe9319a7e946b7689e403434ba2 /src
parentd2875f678270b4c241055765ec65d9ddb66bd60f (diff)
nix: Support nixpkgs.<attrpath> for compatibility
Diffstat (limited to 'src')
-rw-r--r--src/nix/installables.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index bcb22349a..6d3969e95 100644
--- a/src/nix/installables.cc
+++ b/src/nix/installables.cc
@@ -203,6 +203,12 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
if (s.compare(0, 1, "(") == 0)
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) {
auto flakeRef = std::string(s, 0, colon);
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));
}
- 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
- throw UsageError("don't know what to do with argument '%s'", s);
- */
+ result.push_back(std::make_shared<InstallableFlake>(*this, FlakeRef("nixpkgs"), s));
}
}