mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 09:36:15 +02:00
Call lockFlake once and store in _lockedFlake
This commit is contained in:
parent
04821bc171
commit
0858793604
2 changed files with 16 additions and 7 deletions
|
@ -408,8 +408,7 @@ ref<eval_cache::EvalCache> openEvalCache(
|
||||||
std::tuple<std::string, FlakeRef, InstallableValue::DerivationInfo> InstallableFlake::toDerivation()
|
std::tuple<std::string, FlakeRef, InstallableValue::DerivationInfo> InstallableFlake::toDerivation()
|
||||||
{
|
{
|
||||||
|
|
||||||
auto lockedFlake = std::make_shared<flake::LockedFlake>(
|
auto lockedFlake = getLockedFlake();
|
||||||
lockFlake(*state, flakeRef, lockFlags));
|
|
||||||
|
|
||||||
auto cache = openEvalCache(*state, lockedFlake, true);
|
auto cache = openEvalCache(*state, lockedFlake, true);
|
||||||
auto root = cache->getRoot();
|
auto root = cache->getRoot();
|
||||||
|
@ -455,9 +454,9 @@ std::vector<InstallableValue::DerivationInfo> InstallableFlake::toDerivations()
|
||||||
|
|
||||||
std::pair<Value *, Pos> InstallableFlake::toValue(EvalState & state)
|
std::pair<Value *, Pos> InstallableFlake::toValue(EvalState & state)
|
||||||
{
|
{
|
||||||
auto lockedFlake = lockFlake(state, flakeRef, lockFlags);
|
auto lockedFlake = getLockedFlake();
|
||||||
|
|
||||||
auto vOutputs = getFlakeOutputs(state, lockedFlake);
|
auto vOutputs = getFlakeOutputs(state, *lockedFlake);
|
||||||
|
|
||||||
auto emptyArgs = state.allocBindings(0);
|
auto emptyArgs = state.allocBindings(0);
|
||||||
|
|
||||||
|
@ -493,12 +492,19 @@ InstallableFlake::getCursor(EvalState & state, bool useEvalCache)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<flake::LockedFlake> InstallableFlake::getLockedFlake() const
|
||||||
|
{
|
||||||
|
if (!_lockedFlake)
|
||||||
|
_lockedFlake = std::make_shared<flake::LockedFlake>(lockFlake(*state, flakeRef, lockFlags));
|
||||||
|
return _lockedFlake;
|
||||||
|
}
|
||||||
|
|
||||||
FlakeRef InstallableFlake::nixpkgsFlakeRef() const
|
FlakeRef InstallableFlake::nixpkgsFlakeRef() const
|
||||||
{
|
{
|
||||||
auto lockedFlake = lockFlake(*(cmd.getEvalState()), flakeRef, cmd.lockFlags);
|
auto lockedFlake = getLockedFlake();
|
||||||
|
|
||||||
auto nixpkgsInput = lockedFlake.flake.inputs.find("nixpkgs");
|
auto nixpkgsInput = lockedFlake->flake.inputs.find("nixpkgs");
|
||||||
if (nixpkgsInput != lockedFlake.flake.inputs.end()) {
|
if (nixpkgsInput != lockedFlake->flake.inputs.end()) {
|
||||||
return std::move(nixpkgsInput->second.ref);
|
return std::move(nixpkgsInput->second.ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ struct InstallableFlake : InstallableValue
|
||||||
Strings attrPaths;
|
Strings attrPaths;
|
||||||
Strings prefixes;
|
Strings prefixes;
|
||||||
const flake::LockFlags & lockFlags;
|
const flake::LockFlags & lockFlags;
|
||||||
|
mutable std::shared_ptr<flake::LockedFlake> _lockedFlake;
|
||||||
|
|
||||||
InstallableFlake(ref<EvalState> state, FlakeRef && flakeRef,
|
InstallableFlake(ref<EvalState> state, FlakeRef && flakeRef,
|
||||||
Strings && attrPaths, Strings && prefixes, const flake::LockFlags & lockFlags)
|
Strings && attrPaths, Strings && prefixes, const flake::LockFlags & lockFlags)
|
||||||
|
@ -110,6 +111,8 @@ struct InstallableFlake : InstallableValue
|
||||||
std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>>
|
std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>>
|
||||||
getCursor(EvalState & state, bool useEvalCache) override;
|
getCursor(EvalState & state, bool useEvalCache) override;
|
||||||
|
|
||||||
|
std::shared_ptr<flake::LockedFlake> getLockedFlake() const;
|
||||||
|
|
||||||
FlakeRef nixpkgsFlakeRef() const override;
|
FlakeRef nixpkgsFlakeRef() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue