@@ -300,12 +300,13 @@ static StorePath getDerivationEnvironment(ref<Store> store, ref<Store> evalStore
300
300
bmNormal,
301
301
evalStore);
302
302
303
+ // `get-env.sh` will write its JSON output to an arbitrary output
304
+ // path, so return the first non-empty output path.
303
305
for (auto & [_0, optPath] : evalStore->queryPartialDerivationOutputMap (shellDrvPath)) {
304
306
assert (optPath);
305
307
auto & outPath = *optPath;
306
- assert (store->isValidPath (outPath));
307
- auto outPathS = store->toRealPath (outPath);
308
- if (lstat (outPathS).st_size )
308
+ auto st = store->getFSAccessor ()->lstat (CanonPath (outPath.to_string ()));
309
+ if (st.fileSize .value_or (0 ))
309
310
return outPath;
310
311
}
311
312
@@ -495,17 +496,15 @@ struct Common : InstallableCommand, MixProfile
495
496
}
496
497
}
497
498
498
- std::pair<BuildEnvironment, std::string > getBuildEnvironment (ref<Store> store, ref<Installable> installable)
499
+ std::pair<BuildEnvironment, StorePath > getBuildEnvironment (ref<Store> store, ref<Installable> installable)
499
500
{
500
501
auto shellOutPath = getShellOutPath (store, installable);
501
502
502
- auto strPath = store->printStorePath (shellOutPath);
503
-
504
503
updateProfile (shellOutPath);
505
504
506
- debug (" reading environment file '%s'" , strPath );
505
+ debug (" reading environment file '%s'" , store-> printStorePath (shellOutPath) );
507
506
508
- return {BuildEnvironment::parseJSON (readFile ( store->toRealPath ( shellOutPath))), strPath };
507
+ return {BuildEnvironment::parseJSON (store->getFSAccessor ()-> readFile ( shellOutPath. to_string ( ))), shellOutPath };
509
508
}
510
509
};
511
510
@@ -634,7 +633,7 @@ struct CmdDevelop : Common, MixEnvironment
634
633
635
634
setEnviron ();
636
635
// prevent garbage collection until shell exits
637
- setEnv (" NIX_GCROOT" , gcroot.c_str ());
636
+ setEnv (" NIX_GCROOT" , store-> printStorePath ( gcroot) .c_str ());
638
637
639
638
Path shell = " bash" ;
640
639
0 commit comments