Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/libcmd/command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ref<Store> StoreCommand::getStore()

ref<Store> StoreCommand::createStore()
{
auto store = getStoreConfig()->openStore();
auto store = getStoreConfig()->openStore(SecretContext{});
store->init();
return store;
}
Expand Down Expand Up @@ -167,7 +167,12 @@ ref<EvalState> EvalCommand::getEvalState()
{
if (!evalState) {
evalState = std::allocate_shared<EvalState>(
traceable_allocator<EvalState>(), lookupPath, getEvalStore(), fetchSettings, evalSettings, getStore());
traceable_allocator<EvalState>(),
lookupPath,
getEvalStore(),
fetchers::FetchContext{fetchSettings, {}},
evalSettings,
getStore());

evalState->repair = repair;

Expand Down
6 changes: 3 additions & 3 deletions src/libcmd/common-eval-args.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ EvalSettings evalSettings{
auto flakeRef = parseFlakeRef(rest, {}, true, false);
debug("fetching flake search path element '%s''", rest);
auto [accessor, lockedRef] =
flakeRef.resolve(fetchSettings, *state.store).lazyFetch(fetchSettings, *state.store);
flakeRef.resolve(state.fetchContext, *state.store).lazyFetch(state.fetchContext, *state.store);
auto storePath = nix::fetchToStore(
fetchSettings, *state.store, SourcePath(accessor), FetchMode::Copy, lockedRef.input.getName());
state.allowPath(storePath);
Expand Down Expand Up @@ -177,7 +177,7 @@ SourcePath lookupFileArg(EvalState & state, std::string_view s, const std::files
const auto & fetchSettings = state.fetchSettings;

if (EvalSettings::isPseudoUrl(s)) {
auto accessor = fetchers::downloadTarball(*state.store, fetchSettings, EvalSettings::resolvePseudoUrl(s));
auto accessor = fetchers::downloadTarball(*state.store, state.fetchContext, EvalSettings::resolvePseudoUrl(s));
auto storePath = fetchToStore(fetchSettings, *state.store, SourcePath(accessor), FetchMode::Copy);
return state.storePath(storePath);
}
Expand All @@ -186,7 +186,7 @@ SourcePath lookupFileArg(EvalState & state, std::string_view s, const std::files
experimentalFeatureSettings.require(Xp::Flakes);
auto flakeRef = parseFlakeRef(std::string(s.substr(6)), {}, true, false);
auto [accessor, lockedRef] =
flakeRef.resolve(state.fetchSettings, *state.store).lazyFetch(state.fetchSettings, *state.store);
flakeRef.resolve(state.fetchContext, *state.store).lazyFetch(state.fetchContext, *state.store);
auto storePath = nix::fetchToStore(
fetchSettings, *state.store, SourcePath(accessor), FetchMode::Copy, lockedRef.input.getName());
state.allowPath(storePath);
Expand Down
4 changes: 2 additions & 2 deletions src/libcmd/installable-flake.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ std::pair<Value *, PosIdx> InstallableFlake::toValue(EvalState & state, AutoCall
return {&getCursor(state, autoCall)->forceValue(), noPos};
}

std::vector<ref<eval_cache::AttrCursor>> InstallableFlake::getCursors(EvalState & state, AutoCall)
std::vector<ref<eval_cache::AttrCursor>> InstallableFlake::getCursors(EvalState & state, AutoCall autoCall)
{
auto evalCache = openEvalCache(state, getLockedFlake());

Expand All @@ -163,7 +163,7 @@ std::vector<ref<eval_cache::AttrCursor>> InstallableFlake::getCursors(EvalState
try {
auto attr = root->findAlongAttrPath(AttrPath::parse(state, attrPath));
if (attr) {
res.push_back(ref(*attr));
res.push_back(autoCall == AutoCall::Yes ? (*attr)->autoCall() : ref(*attr));
} else {
suggestions += attr.getSuggestions();
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcmd/installables.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ void completeFlakeRef(AddCompletions & completions, ref<Store> store, std::strin
Args::completeDir(completions, 0, prefix);

/* Look for registry entries that match the prefix. */
for (auto & registry : fetchers::getRegistries(fetchSettings, *store)) {
for (auto & registry : fetchers::getRegistries(fetchers::FetchContext{fetchSettings, {}}, *store)) {
for (auto & entry : registry->entries) {
auto from = entry.from.to_string();
if (!hasPrefix(prefix, "flake:") && hasPrefix(from, "flake:")) {
Expand Down
4 changes: 2 additions & 2 deletions src/libexpr-c/nix_api_expr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ EvalState * nix_eval_state_build(nix_c_context * context, nix_eval_state_builder
try {
auto fetchSettings = std::make_unique<nix::fetchers::Settings>(std::move(builder->fetchSettings));
auto settings = std::make_unique<nix::EvalSettings>(std::move(builder->settings));
auto ownedState =
std::make_shared<nix::EvalState>(builder->lookupPath, builder->store, *fetchSettings, *settings);
auto ownedState = std::make_shared<nix::EvalState>(
builder->lookupPath, builder->store, nix::fetchers::FetchContext{*fetchSettings, {}}, *settings);
auto & stateRef = *ownedState;
void * p = ::operator new(sizeof(EvalState), static_cast<std::align_val_t>(alignof(EvalState)));
return new (p) EvalState{stateRef, std::move(fetchSettings), std::move(settings), std::move(ownedState)};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected:
LibExprTest(ref<Store> store, auto && makeEvalSettings)
: LibStoreTest()
, evalSettings(makeEvalSettings(readOnlyMode))
, state({}, store, fetchSettings, evalSettings, nullptr)
, state({}, store, fetchers::FetchContext{fetchSettings, {}}, evalSettings, nullptr)
{
}

Expand Down
3 changes: 2 additions & 1 deletion src/libexpr-tests/dynamic-attrs-bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ static void BM_EvalDynamicAttrs(benchmark::State & state)
EvalSettings evalSettings{readOnlyMode};
evalSettings.nixPath = {};

auto stPtr = std::make_shared<EvalState>(LookupPath{}, store, fetchSettings, evalSettings, nullptr);
auto stPtr = std::make_shared<EvalState>(
LookupPath{}, store, fetchers::FetchContext{fetchSettings, {}}, evalSettings, nullptr);
auto & st = *stPtr;
Expr * expr = st.parseExprFromString(exprStr, st.rootPath(CanonPath::root));

Expand Down
4 changes: 3 additions & 1 deletion src/libexpr-tests/get-drvs-bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ struct GetDerivationsEnv
settings.nixPath = {};
return settings;
}())
, statePtr(std::make_shared<EvalState>(LookupPath{}, store, fetchSettings, evalSettings, nullptr))
, statePtr(
std::make_shared<EvalState>(
LookupPath{}, store, fetchers::FetchContext{fetchSettings, {}}, evalSettings, nullptr))
, state(*statePtr)
{
autoArgs = state.buildBindings(0).finish();
Expand Down
3 changes: 2 additions & 1 deletion src/libexpr-tests/regex-cache-bench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ static void BM_EvalManyBuiltinsMatchSameRegex(benchmark::State & state)
EvalSettings evalSettings{readOnlyMode};
evalSettings.nixPath = {};

auto stPtr = std::make_shared<EvalState>(LookupPath{}, store, fetchSettings, evalSettings, nullptr);
auto stPtr = std::make_shared<EvalState>(
LookupPath{}, store, fetchers::FetchContext{fetchSettings, {}}, evalSettings, nullptr);
auto & st = *stPtr;
Expr * expr = st.parseExprFromString(std::string(exprStr), st.rootPath(CanonPath::root));

Expand Down
Loading
Loading