1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 20:16:03 +01:00

nix develop: Use store->getFSAccessor()

This commit is contained in:
Eelco Dolstra 2025-09-08 09:39:44 +02:00
parent eff5043571
commit 332aaa6b72

View file

@ -299,12 +299,13 @@ static StorePath getDerivationEnvironment(ref<Store> store, ref<Store> evalStore
bmNormal,
evalStore);
// `get-env.sh` will write its JSON output to an arbitrary output
// path, so return the first non-empty output path.
for (auto & [_0, optPath] : evalStore->queryPartialDerivationOutputMap(shellDrvPath)) {
assert(optPath);
auto & outPath = *optPath;
assert(store->isValidPath(outPath));
auto outPathS = store->toRealPath(outPath);
if (lstat(outPathS).st_size)
auto st = store->getFSAccessor()->lstat(CanonPath(outPath.to_string()));
if (st.fileSize.value_or(0))
return outPath;
}
@ -494,17 +495,15 @@ struct Common : InstallableCommand, MixProfile
}
}
std::pair<BuildEnvironment, std::string> getBuildEnvironment(ref<Store> store, ref<Installable> installable)
std::pair<BuildEnvironment, StorePath> getBuildEnvironment(ref<Store> store, ref<Installable> installable)
{
auto shellOutPath = getShellOutPath(store, installable);
auto strPath = store->printStorePath(shellOutPath);
updateProfile(shellOutPath);
debug("reading environment file '%s'", strPath);
debug("reading environment file '%s'", store->printStorePath(shellOutPath));
return {BuildEnvironment::parseJSON(readFile(store->toRealPath(shellOutPath))), strPath};
return {BuildEnvironment::parseJSON(store->getFSAccessor()->readFile(shellOutPath.to_string())), shellOutPath};
}
};
@ -631,7 +630,7 @@ struct CmdDevelop : Common, MixEnvironment
setEnviron();
// prevent garbage collection until shell exits
setEnv("NIX_GCROOT", gcroot.c_str());
setEnv("NIX_GCROOT", store->printStorePath(gcroot).c_str());
Path shell = "bash";
bool foundInteractive = false;