forked from lix-project/lix
nix develop: Fall back to "bash" if nixpkgs#bashInteractive is unavailable
This commit is contained in:
parent
54712aaf8a
commit
cd8eb8a7d1
1 changed files with 17 additions and 3 deletions
|
@ -307,9 +307,23 @@ struct CmdDevelop : Common, MixEnvironment
|
||||||
// prevent garbage collection until shell exits
|
// prevent garbage collection until shell exits
|
||||||
setenv("NIX_GCROOT", gcroot.data(), 1);
|
setenv("NIX_GCROOT", gcroot.data(), 1);
|
||||||
|
|
||||||
auto state = getEvalState();
|
Path shell = "bash";
|
||||||
auto bashInstallable = std::make_shared<InstallableFlake>(state, std::move(installable->nixpkgsFlakeRef()), Strings{"bashInteractive"}, Strings{"legacyPackages." + settings.thisSystem.get() + "."}, lockFlags);
|
|
||||||
auto shell = state->store->printStorePath(toStorePath(state->store, Build, bashInstallable)) + "/bin/bash";
|
try {
|
||||||
|
auto state = getEvalState();
|
||||||
|
|
||||||
|
auto bashInstallable = std::make_shared<InstallableFlake>(
|
||||||
|
state,
|
||||||
|
std::move(installable->nixpkgsFlakeRef()),
|
||||||
|
Strings{"bashInteractive"},
|
||||||
|
Strings{"legacyPackages." + settings.thisSystem.get() + "."},
|
||||||
|
lockFlags);
|
||||||
|
|
||||||
|
shell = state->store->printStorePath(toStorePath(state->store, Build, bashInstallable)) + "/bin/bash";
|
||||||
|
} catch (Error &) {
|
||||||
|
ignoreException();
|
||||||
|
}
|
||||||
|
|
||||||
auto args = Strings{std::string(baseNameOf(shell)), "--rcfile", rcFilePath};
|
auto args = Strings{std::string(baseNameOf(shell)), "--rcfile", rcFilePath};
|
||||||
|
|
||||||
restoreAffinity();
|
restoreAffinity();
|
||||||
|
|
Loading…
Reference in a new issue