Hack: Use legacyPackages from Nixpkgs

Nixpkgs doesn't provide a clean "packages" set yet, so until that's
the case, look for packages in "legacyPackages" as well.
This commit is contained in:
Eelco Dolstra 2019-05-29 21:30:22 +02:00
parent b70fc8f30c
commit 3488fa7c6c
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -236,9 +236,9 @@ struct InstallableFlake : InstallableValue
auto emptyArgs = state.allocBindings(0); auto emptyArgs = state.allocBindings(0);
// As a convenience, look for the attribute in
// 'provides.packages'.
if (searchPackages) { if (searchPackages) {
// As a convenience, look for the attribute in
// 'provides.packages'.
if (auto aPackages = *vProvides->attrs->get(state.symbols.create("packages"))) { if (auto aPackages = *vProvides->attrs->get(state.symbols.create("packages"))) {
try { try {
auto * v = findAlongAttrPath(state, *attrPaths.begin(), *emptyArgs, *aPackages->value); auto * v = findAlongAttrPath(state, *attrPaths.begin(), *emptyArgs, *aPackages->value);
@ -247,6 +247,17 @@ struct InstallableFlake : InstallableValue
} catch (AttrPathNotFound & e) { } catch (AttrPathNotFound & e) {
} }
} }
// As a temporary hack until Nixpkgs is properly converted
// to provide a clean 'packages' set, look in 'legacyPackages'.
if (auto aPackages = *vProvides->attrs->get(state.symbols.create("legacyPackages"))) {
try {
auto * v = findAlongAttrPath(state, *attrPaths.begin(), *emptyArgs, *aPackages->value);
state.forceValue(*v);
return v;
} catch (AttrPathNotFound & e) {
}
}
} }
// Otherwise, look for it in 'provides'. // Otherwise, look for it in 'provides'.