mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Merge pull request #3542 from mkenigs/gcroots
Set GCROOT to store path to prevent garbage collection
This commit is contained in:
commit
06849c3090
1 changed files with 8 additions and 4 deletions
|
@ -200,13 +200,15 @@ struct Common : InstallableCommand, MixProfile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildEnvironment getBuildEnvironment(ref<Store> store)
|
std::pair<BuildEnvironment, std::string> getBuildEnvironment(ref<Store> store)
|
||||||
{
|
{
|
||||||
auto shellOutPath = getShellOutPath(store);
|
auto shellOutPath = getShellOutPath(store);
|
||||||
|
|
||||||
|
auto strPath = store->printStorePath(shellOutPath);
|
||||||
|
|
||||||
updateProfile(shellOutPath);
|
updateProfile(shellOutPath);
|
||||||
|
|
||||||
return readEnvironment(store->printStorePath(shellOutPath));
|
return {readEnvironment(strPath), strPath};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -253,7 +255,7 @@ struct CmdDevShell : Common, MixEnvironment
|
||||||
|
|
||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
auto buildEnvironment = getBuildEnvironment(store);
|
auto [buildEnvironment, gcroot] = getBuildEnvironment(store);
|
||||||
|
|
||||||
auto [rcFileFd, rcFilePath] = createTempFile("nix-shell");
|
auto [rcFileFd, rcFilePath] = createTempFile("nix-shell");
|
||||||
|
|
||||||
|
@ -276,6 +278,8 @@ struct CmdDevShell : Common, MixEnvironment
|
||||||
auto shell = getEnv("SHELL").value_or("bash");
|
auto shell = getEnv("SHELL").value_or("bash");
|
||||||
|
|
||||||
setEnviron();
|
setEnviron();
|
||||||
|
// prevent garbage collection until shell exits
|
||||||
|
setenv("NIX_GCROOT", gcroot.data(), 1);
|
||||||
|
|
||||||
auto args = Strings{std::string(baseNameOf(shell)), "--rcfile", rcFilePath};
|
auto args = Strings{std::string(baseNameOf(shell)), "--rcfile", rcFilePath};
|
||||||
|
|
||||||
|
@ -307,7 +311,7 @@ struct CmdPrintDevEnv : Common
|
||||||
|
|
||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
auto buildEnvironment = getBuildEnvironment(store);
|
auto buildEnvironment = getBuildEnvironment(store).first;
|
||||||
|
|
||||||
stopProgressBar();
|
stopProgressBar();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue