mirror of
https://github.com/NixOS/nix.git
synced 2025-12-08 18:11:02 +01:00
nix develop: getBuildEnvironment return StorePath
This commit is contained in:
parent
9402a3bc2f
commit
a343452cac
1 changed files with 5 additions and 5 deletions
|
|
@ -304,6 +304,8 @@ static StorePath getDerivationEnvironment(ref<Store> store, ref<Store> evalStore
|
||||||
bmNormal,
|
bmNormal,
|
||||||
evalStore);
|
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)) {
|
for (auto & [_0, optPath] : evalStore->queryPartialDerivationOutputMap(shellDrvPath)) {
|
||||||
assert(optPath);
|
assert(optPath);
|
||||||
auto accessor = evalStore->requireStoreObjectAccessor(*optPath);
|
auto accessor = evalStore->requireStoreObjectAccessor(*optPath);
|
||||||
|
|
@ -497,15 +499,13 @@ 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 shellOutPath = getShellOutPath(store, installable);
|
||||||
|
|
||||||
auto strPath = store->printStorePath(shellOutPath);
|
|
||||||
|
|
||||||
updateProfile(shellOutPath);
|
updateProfile(shellOutPath);
|
||||||
|
|
||||||
debug("reading environment file '%s'", strPath);
|
debug("reading environment file '%s'", store->printStorePath(shellOutPath));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
BuildEnvironment::parseJSON(store->requireStoreObjectAccessor(shellOutPath)->readFile(CanonPath::root)),
|
BuildEnvironment::parseJSON(store->requireStoreObjectAccessor(shellOutPath)->readFile(CanonPath::root)),
|
||||||
|
|
@ -636,7 +636,7 @@ struct CmdDevelop : Common, MixEnvironment
|
||||||
|
|
||||||
setEnviron();
|
setEnviron();
|
||||||
// prevent garbage collection until shell exits
|
// prevent garbage collection until shell exits
|
||||||
setEnv("NIX_GCROOT", gcroot.c_str());
|
setEnv("NIX_GCROOT", store->printStorePath(gcroot).c_str());
|
||||||
|
|
||||||
Path shell = "bash";
|
Path shell = "bash";
|
||||||
bool foundInteractive = false;
|
bool foundInteractive = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue