@@ -248,6 +248,8 @@ EvalState::EvalState(
248248 }
249249 , repair(NoRepair)
250250 , emptyBindings(0 )
251+ , corepkgsFS(make_ref<MemorySourceAccessor>())
252+ , corepkgsPath(CanonPath(store->printStorePath (StorePath::random(" source" ))))
251253 , storeFS(
252254 makeMountedSourceAccessor (
253255 {
@@ -301,7 +303,6 @@ EvalState::EvalState(
301303
302304 accessor;
303305 }))
304- , corepkgsFS(make_ref<MemorySourceAccessor>())
305306 , internalFS(make_ref<MemorySourceAccessor>())
306307 , derivationInternal{corepkgsFS->addFile (
307308 CanonPath (" derivation-internal.nix" ),
@@ -327,6 +328,9 @@ EvalState::EvalState(
327328 corepkgsFS->setPathDisplay (" <nix" , " >" );
328329 internalFS->setPathDisplay (" «nix-internal»" , " " );
329330
331+ storeFS->mount (corepkgsPath, corepkgsFS);
332+ allowPath (corepkgsPath.abs ());
333+
330334 countCalls = getEnv (" NIX_COUNT_CALLS" ).value_or (" 0" ) != " 0" ;
331335
332336 assertGCInitialized ();
@@ -904,9 +908,9 @@ void Value::mkStringMove(const char * s, const NixStringContext & context)
904908 mkString (s, encodeContext (context));
905909}
906910
907- void Value::mkPath (const SourcePath & path)
911+ void Value::mkPath (const CanonPath & path)
908912{
909- mkPath (&*path. accessor , makeImmutableString (path. path .abs ()));
913+ mkPath (makeImmutableString (path.abs ()));
910914}
911915
912916
@@ -2098,7 +2102,7 @@ void ExprConcatStrings::eval(EvalState & state, Env & env, Value & v)
20982102 else if (firstType == nPath) {
20992103 if (hasContext (context))
21002104 state.error <EvalError>(" a string that refers to a store path cannot be appended to a path" ).atPos (pos).withFrame (env, *this ).debugThrow ();
2101- v.mkPath (state. rootPath ( CanonPath (str () )));
2105+ v.mkPath (CanonPath (str ()));
21022106 } else
21032107 v.mkStringMove (c_str (), context);
21042108}
@@ -2356,16 +2360,16 @@ BackedStringView EvalState::coerceToString(
23562360 // slash, as in /foo/${x}.
23572361 v.payload .path .path
23582362 : copyToStore
2359- ? store->printStorePath (copyPathToStore (context, v.path ()))
2363+ ? store->printStorePath (copyPathToStore (context, rootPath ( v.path () )))
23602364 : ({
23612365 auto path = v.path ();
2362- if (path. accessor == rootFS && store->isInStore (path. path .abs ())) {
2366+ if (store->isInStore (path.abs ())) {
23632367 context.insert (
23642368 NixStringContextElem::Path{
2365- .storePath = store->toStorePath (path.path . abs ()).first
2369+ .storePath = store->toStorePath (path.abs ()).first
23662370 });
23672371 }
2368- std::string (path.path . abs ());
2372+ std::string (path.abs ());
23692373 });
23702374 }
23712375
@@ -2476,7 +2480,7 @@ SourcePath EvalState::coerceToPath(const PosIdx pos, Value & v, NixStringContext
24762480
24772481 /* Handle path values directly, without coercing to a string. */
24782482 if (v.type () == nPath)
2479- return v.path ();
2483+ return rootPath ( v.path () );
24802484
24812485 /* Similarly, handle __toString where the result may be a path
24822486 value. */
@@ -2635,13 +2639,6 @@ void EvalState::assertEqValues(Value & v1, Value & v2, const PosIdx pos, std::st
26352639 return ;
26362640
26372641 case nPath:
2638- if (v1.payload .path .accessor != v2.payload .path .accessor ) {
2639- error<AssertionError>(
2640- " path '%s' is not equal to path '%s' because their accessors are different" ,
2641- ValuePrinter (*this , v1, errorPrintOptions),
2642- ValuePrinter (*this , v2, errorPrintOptions))
2643- .debugThrow ();
2644- }
26452642 if (strcmp (v1.payload .path .path , v2.payload .path .path ) != 0 ) {
26462643 error<AssertionError>(
26472644 " path '%s' is not equal to path '%s'" ,
@@ -2808,9 +2805,7 @@ bool EvalState::eqValues(Value & v1, Value & v2, const PosIdx pos, std::string_v
28082805
28092806 case nPath:
28102807 return
2811- // FIXME: compare accessors by their fingerprint.
2812- v1.payload .path .accessor == v2.payload .path .accessor
2813- && strcmp (v1.payload .path .path , v2.payload .path .path ) == 0 ;
2808+ strcmp (v1.payload .path .path , v2.payload .path .path ) == 0 ;
28142809
28152810 case nNull:
28162811 return true ;
@@ -3125,7 +3120,7 @@ SourcePath EvalState::findFile(const LookupPath & lookupPath, const std::string_
31253120 }
31263121
31273122 if (hasPrefix (path, " nix/" ))
3128- return {corepkgsFS, CanonPath (path.substr (3 ))} ;
3123+ return rootPath (corepkgsPath / CanonPath (path.substr (3 ))) ;
31293124
31303125 error<ThrownError>(
31313126 settings.pureEval
0 commit comments