use flake's nixpkgs to find bashInteractive
This commit is contained in:
parent
8fbc8540d3
commit
04821bc171
3 changed files with 20 additions and 2 deletions
|
@ -286,9 +286,8 @@ struct CmdDevShell : Common, MixEnvironment
|
|||
|
||||
std::string getBashPath(ref<Store> store)
|
||||
{
|
||||
auto flakeRef = FlakeRef::fromAttrs({{"type","indirect"}, {"id", "nixpkgs"}});
|
||||
auto state = getEvalState();
|
||||
auto lockedFlake = std::make_shared<flake::LockedFlake>(lockFlake(*state, flakeRef, lockFlags));
|
||||
auto lockedFlake = std::make_shared<flake::LockedFlake>(lockFlake(*state, installable->nixpkgsFlakeRef(), lockFlags));
|
||||
auto cache = openEvalCache(*state, lockedFlake, true);
|
||||
auto root = cache->getRoot();
|
||||
|
||||
|
|
|
@ -493,6 +493,18 @@ InstallableFlake::getCursor(EvalState & state, bool useEvalCache)
|
|||
return res;
|
||||
}
|
||||
|
||||
FlakeRef InstallableFlake::nixpkgsFlakeRef() const
|
||||
{
|
||||
auto lockedFlake = lockFlake(*(cmd.getEvalState()), flakeRef, cmd.lockFlags);
|
||||
|
||||
auto nixpkgsInput = lockedFlake.flake.inputs.find("nixpkgs");
|
||||
if (nixpkgsInput != lockedFlake.flake.inputs.end()) {
|
||||
return std::move(nixpkgsInput->second.ref);
|
||||
}
|
||||
|
||||
return Installable::nixpkgsFlakeRef();
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
||||
ref<Store> store, std::vector<std::string> ss)
|
||||
{
|
||||
|
|
|
@ -57,6 +57,11 @@ struct Installable
|
|||
|
||||
virtual std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>>
|
||||
getCursor(EvalState & state, bool useEvalCache);
|
||||
|
||||
virtual FlakeRef nixpkgsFlakeRef() const
|
||||
{
|
||||
return std::move(FlakeRef::fromAttrs({{"type","indirect"}, {"id", "nixpkgs"}}));
|
||||
}
|
||||
};
|
||||
|
||||
struct InstallableValue : Installable
|
||||
|
@ -104,6 +109,8 @@ struct InstallableFlake : InstallableValue
|
|||
|
||||
std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>>
|
||||
getCursor(EvalState & state, bool useEvalCache) override;
|
||||
|
||||
FlakeRef nixpkgsFlakeRef() const override;
|
||||
};
|
||||
|
||||
ref<eval_cache::EvalCache> openEvalCache(
|
||||
|
|
Loading…
Reference in a new issue