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

Peter Simons simons at cryp.to
Mon Sep 12 19:49:49 CEST 2011


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




More information about the nix-dev mailing list