[Nix-dev] bash-interactive with support for completion

shea at shealevy.com shea at shealevy.com
Tue Sep 13 11:16:14 CEST 2011


Hi Peter,

I'm in favor of the change, though perhaps it should be accompanied by a
flag so that those who don't want it can easily override it in their
packageOverrides.

~Shea

> Hi guys,
>
> the following patches changes the interactive version of bash to include
> full completion support:
>
> --- a/pkgs/shells/bash/default.nix
> +++ b/pkgs/shells/bash/default.nix
> @@ -1,4 +1,4 @@
> -{stdenv, fetchurl, readline ? null, interactive ? false, texinfo ? null,
> bison}:
> +{stdenv, fetchurl, readline ? null, interactive ? false, texinfo ? null,
> bison, bashCompletion}:
>
>  assert interactive -> readline != null;
>
> @@ -52,13 +52,18 @@ stdenv.mkDerivation rec {
>      # Add an `sh' -> `bash' symlink.
>      ln -s bash "$out/bin/sh"
>
> +  '' + (if interactive then ''
> +    ensureDir "$out/etc"
> +    ln -s "${bashCompletion}/etc/bash_completion" "$out/etc/"
> +    ln -s "${bashCompletion}/etc/bash_completion.d" "$out/etc/"
> +  '' else ''
>      # Install the completion examples.
>      ensureDir "$out/etc"
>      cp -v "examples/complete/bash_completion" "$out/etc"
>
>      ensureDir "$out/etc/bash_completion.d"
>      cp -v "examples/complete/complete.gnu-longopt"
> "$out/etc/bash_completion.d"
> -  '';
> +  '');
>
>    meta = {
>      homepage = http://www.gnu.org/software/bash/;
>
> The normal bash (a.k.a. stdenv) is not affected. I would like to commit
> the
> patch, but before I do I wonder whether anyone sees a problem with it?
>
> Take care,
> Peter
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at cs.uu.nl
> https://mail.cs.uu.nl/mailman/listinfo/nix-dev
>





More information about the nix-dev mailing list