What shell is `pkgs.runtimeShell`?

I’ve ran into pkgs.runtimeShell while looking through the code of a simple derivation helpers (writeShellScript and family), but can’t seem to find what it is defined as or why it exists. I’d be grateful for any pointers!

Experimentally, by checking the value in nix repl on two machines, I find it to be bash. Can I rely on that being generally the case, or would that be unsafe? If pkgs.runtimeShell can take multiple values, what is the benefit of picking it for a script (as helpers like writeShellScript do by default) over explicitly choosing a particular shell?

$ rg -i 'runtimeshell ='
11172:  runtimeShell = "${runtimeShellPackage}${runtimeShellPackage.shellPath}";
$ rg -i 'runtimeshellpackage ='
11173:  runtimeShellPackage = bash;

So it is an alias for bash.

And I think to name it “runtime shell” makes it easier to pin that to a particular version if necessary, while using bash in those directly might cause problems on bumps, which had to be fixed individually.


That makes sense. Thank you for the answer and the extra context!