mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 00:06:16 +02:00
Remove the nixpkgs.<attr> compatibility hack
Since we've changed a lot of things in the 'nix' command (e.g. rename 'nix run') there is not much point in keeping this around.
This commit is contained in:
parent
80f4b7b6f8
commit
ff394ff206
1 changed files with 25 additions and 39 deletions
|
@ -417,10 +417,6 @@ InstallableFlake::getCursor(EvalState & state, bool useEvalCache)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: extend
|
|
||||||
std::string attrRegex = R"([A-Za-z_][A-Za-z0-9-_+]*)";
|
|
||||||
static std::regex attrPathRegex(fmt(R"(%1%(\.%1%)*)", attrRegex));
|
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
||||||
ref<Store> store, std::vector<std::string> ss)
|
ref<Store> store, std::vector<std::string> ss)
|
||||||
{
|
{
|
||||||
|
@ -449,48 +445,38 @@ std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (auto & s : ss) {
|
for (auto & s : ss) {
|
||||||
if (hasPrefix(s, "nixpkgs.")) {
|
std::exception_ptr ex;
|
||||||
bool static warned;
|
|
||||||
warnOnce(warned, "the syntax 'nixpkgs.<attr>' is deprecated; use 'nixpkgs#<attr>' instead");
|
try {
|
||||||
result.push_back(std::make_shared<InstallableFlake>(*this,
|
auto [flakeRef, fragment] = parseFlakeRefWithFragment(s, absPath("."));
|
||||||
FlakeRef::fromAttrs({{"type", "indirect"}, {"id", "nixpkgs"}}),
|
result.push_back(std::make_shared<InstallableFlake>(
|
||||||
Strings{"legacyPackages." + settings.thisSystem.get() + "." + std::string(s, 8)}, Strings{}));
|
*this, std::move(flakeRef),
|
||||||
|
fragment == "" ? getDefaultFlakeAttrPaths() : Strings{fragment},
|
||||||
|
getDefaultFlakeAttrPathPrefixes()));
|
||||||
|
continue;
|
||||||
|
} catch (...) {
|
||||||
|
ex = std::current_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
if (s.find('/') != std::string::npos) {
|
||||||
std::exception_ptr ex;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto [flakeRef, fragment] = parseFlakeRefWithFragment(s, absPath("."));
|
result.push_back(std::make_shared<InstallableStorePath>(store, store->printStorePath(store->followLinksToStorePath(s))));
|
||||||
result.push_back(std::make_shared<InstallableFlake>(
|
|
||||||
*this, std::move(flakeRef),
|
|
||||||
fragment == "" ? getDefaultFlakeAttrPaths() : Strings{fragment},
|
|
||||||
getDefaultFlakeAttrPathPrefixes()));
|
|
||||||
continue;
|
continue;
|
||||||
|
} catch (NotInStore &) {
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
ex = std::current_exception();
|
if (!ex)
|
||||||
|
ex = std::current_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s.find('/') != std::string::npos) {
|
|
||||||
try {
|
|
||||||
result.push_back(std::make_shared<InstallableStorePath>(store, store->printStorePath(store->followLinksToStorePath(s))));
|
|
||||||
continue;
|
|
||||||
} catch (NotInStore &) {
|
|
||||||
} catch (...) {
|
|
||||||
if (!ex)
|
|
||||||
ex = std::current_exception();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::rethrow_exception(ex);
|
|
||||||
|
|
||||||
/*
|
|
||||||
throw Error(
|
|
||||||
pathExists(s)
|
|
||||||
? "path '%s' is not a flake or a store path"
|
|
||||||
: "don't know how to handle argument '%s'", s);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::rethrow_exception(ex);
|
||||||
|
|
||||||
|
/*
|
||||||
|
throw Error(
|
||||||
|
pathExists(s)
|
||||||
|
? "path '%s' is not a flake or a store path"
|
||||||
|
: "don't know how to handle argument '%s'", s);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue