mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
No global eval settings in libnixexpr
Progress on #5638 There is still a global eval settings, but it pushed down into `libnixcmd`, which is a lot less bad a place for this sort of thing.
This commit is contained in:
parent
cb0c868da4
commit
52bfccf8d8
24 changed files with 102 additions and 71 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "eval.hh"
|
||||
#include "globals.hh"
|
||||
#include "util.hh"
|
||||
#include "eval-settings.hh"
|
||||
|
||||
#include "nix_api_expr.h"
|
||||
#include "nix_api_expr_internal.h"
|
||||
|
@ -106,7 +107,21 @@ EvalState * nix_state_create(nix_c_context * context, const char ** lookupPath_c
|
|||
for (size_t i = 0; lookupPath_c[i] != nullptr; i++)
|
||||
lookupPath.push_back(lookupPath_c[i]);
|
||||
|
||||
return new EvalState{nix::EvalState(nix::LookupPath::parse(lookupPath), store->ptr)};
|
||||
void * p = ::operator new(
|
||||
sizeof(EvalState),
|
||||
static_cast<std::align_val_t>(alignof(EvalState)));
|
||||
auto * p2 = static_cast<EvalState *>(p);
|
||||
new (p) EvalState {
|
||||
.settings = nix::EvalSettings{
|
||||
nix::settings.readOnlyMode,
|
||||
},
|
||||
.state = nix::EvalState(
|
||||
nix::LookupPath::parse(lookupPath),
|
||||
store->ptr,
|
||||
p2->settings),
|
||||
};
|
||||
loadConfFile(p2->settings);
|
||||
return p2;
|
||||
}
|
||||
NIXC_CATCH_ERRS_NULL
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue