bash: define DEFAULT_LOADABLE_BUILTINS_PATH for non-FHS builds

this compile-time constant becomes the runtime value for
BASH_LOADABLES_PATH when otherwise not set. it was added in bash 4.4,
with an upstream default of:
"/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:."
(see: <https://git.savannah.gnu.org/cgit/bash.git/tree/config-top.h?h=bash-5.2#n83>)
and is documented here:
<https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#index-enable>

nixpkgs' bash already builds these loadables: this patch simply improves
the ergonomics, from:

```
bash -i
$ BASH_LOADABLES_PATH="$(dirname $(which bash))/../lib/bash"
$ enable -f realpath realpath
$ realpath ...
```

to:

```
bash -i
$ enable -f realpath realpath
$ realpath ...
```

Co-authored-by: Arne Keller <2012gdwu+github@posteo.de>
This commit is contained in:
Colin
2024-02-18 07:52:30 +00:00
parent e6b629da27
commit 4eb1020650

View File

@@ -48,6 +48,7 @@ stdenv.mkDerivation rec {
'' + lib.optionalString (!forFHSEnv) ''
-DDEFAULT_PATH_VALUE="/no-such-path"
-DSTANDARD_UTILS_PATH="/no-such-path"
-DDEFAULT_LOADABLE_BUILTINS_PATH="${placeholder "out"}/lib/bash:."
'' + ''
-DNON_INTERACTIVE_LOGIN_SHELLS
-DSSH_SOURCE_BASHRC