aboutsummaryrefslogtreecommitdiff
path: root/src/nix/develop.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-07-06 17:08:54 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-07-06 17:08:54 +0200
commitcd8eb8a7d1bd4d2405df9f0d6aeeaa3e24c7d593 (patch)
tree87cef1989aa5f5f4fbabf5ae341f503971a81286 /src/nix/develop.cc
parent54712aaf8a4d9d6a42232fe9b360fc72f35ed02d (diff)
nix develop: Fall back to "bash" if nixpkgs#bashInteractive is unavailable
Diffstat (limited to 'src/nix/develop.cc')
-rw-r--r--src/nix/develop.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index 0bd862daa..ae6a23346 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -307,9 +307,23 @@ struct CmdDevelop : Common, MixEnvironment
// prevent garbage collection until shell exits
setenv("NIX_GCROOT", gcroot.data(), 1);
- auto state = getEvalState();
- 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";
+ Path shell = "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};
restoreAffinity();