1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-30 14:10:59 +01:00

Checkpoint

This commit is contained in:
Eelco Dolstra 2022-03-01 19:08:20 +01:00
parent 00b0fb27c1
commit 06c1edf889
18 changed files with 134 additions and 120 deletions

View file

@ -201,7 +201,7 @@ static std::map<FlakeId, FlakeInput> parseFlakeInputs(
static Flake readFlake(
EvalState & state,
const FlakeRef & lockedRef,
nix::ref<InputAccessor> accessor,
InputAccessor & accessor,
const InputPath & lockRootPath)
{
auto flakeDir = canonPath("/" + lockedRef.subdir);
@ -213,14 +213,14 @@ static Flake readFlake(
Value vInfo;
state.evalFile(flakePath, vInfo, true);
expectType(state, nAttrs, vInfo, Pos(foFile, state.symbols.create(state.packPath(flakePath)), 0, 0));
expectType(state, nAttrs, vInfo, Pos(foFile, state.symbols.create(flakePath.to_string()), 0, 0));
Flake flake {
// FIXME
.originalRef = lockedRef,
.resolvedRef = lockedRef,
.lockedRef = lockedRef,
.accessor = accessor,
.accessor = ptr(&accessor),
.flakePath = dirOf(flakePath.path),
};
@ -308,7 +308,7 @@ static Flake getFlake(
// FIXME: resolve
auto [accessor, input] = originalRef.input.lazyFetch(state.store);
return readFlake(state, originalRef, accessor, lockRootPath);
return readFlake(state, originalRef, state.registerAccessor(accessor), lockRootPath);
}
Flake getFlake(EvalState & state, const FlakeRef & originalRef, bool allowLookup, FlakeCache & flakeCache)
@ -324,7 +324,7 @@ Flake getFlake(EvalState & state, const FlakeRef & originalRef, bool allowLookup
static LockFile readLockFile(const Flake & flake)
{
SourcePath lockFilePath{flake.accessor, canonPath(flake.flakePath + "/flake.lock")};
SourcePath lockFilePath{*flake.accessor, canonPath(flake.flakePath + "/flake.lock")};
return lockFilePath.pathExists()
? LockFile(lockFilePath.readFile(), fmt("%s", lockFilePath))
: LockFile();
@ -703,7 +703,7 @@ void callFlake(EvalState & state,
emitTreeAttrs(
state,
{lockedFlake.flake.accessor, lockedFlake.flake.flakePath},
{*lockedFlake.flake.accessor, lockedFlake.flake.flakePath},
lockedFlake.flake.lockedRef.input,
*vRootSrc,
false,

View file

@ -61,7 +61,7 @@ struct Flake
FlakeRef originalRef; // the original flake specification (by the user)
FlakeRef resolvedRef; // registry references and caching resolved to the specific underlying flake
FlakeRef lockedRef; // the specific local store result of invoking the fetcher
ref<InputAccessor> accessor;
ptr<InputAccessor> accessor;
Path flakePath;
bool forceDirty = false; // pretend that 'lockedRef' is dirty
std::optional<std::string> description;