diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-05-10 16:42:35 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-05-10 16:43:41 +0200 |
commit | a9cbc2857f4dd3af738b76edea00d692fbcee63c (patch) | |
tree | 8ec884e9561997d301ba030b25ce8ba2601e4be3 | |
parent | 7062ebf5beb62b069dbf7e83f9c0dd92cf999cd3 (diff) |
nix develop: Find bin/bash in the bashInteractive outputs
-rw-r--r-- | src/nix/develop.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/nix/develop.cc b/src/nix/develop.cc index 1190b8348..3a99fff6f 100644 --- a/src/nix/develop.cc +++ b/src/nix/develop.cc @@ -512,9 +512,20 @@ struct CmdDevelop : Common, MixEnvironment Strings{"legacyPackages." + settings.thisSystem.get() + "."}, nixpkgsLockFlags); - shell = store->printStorePath( - Installable::toStorePath(getEvalStore(), store, Realise::Outputs, OperateOn::Output, bashInstallable)) - + "/bin/bash"; + bool found = false; + + for (auto & path : Installable::toStorePaths(getEvalStore(), store, Realise::Outputs, OperateOn::Output, {bashInstallable})) { + auto s = store->printStorePath(path) + "/bin/bash"; + if (pathExists(s)) { + shell = s; + found = true; + break; + } + } + + if (!found) + throw Error("package 'nixpkgs#bashInteractive' does not provide a 'bin/bash'"); + } catch (Error &) { ignoreException(); } |