summary refs log tree commit diff
path: root/pkgs/shells/bash
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-04-17 14:03:07 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2018-04-17 14:47:32 -0500
commitddaea6ac77177c91576568af4b6f6d85195559af (patch)
tree0292a346327a613a52b95492aea9ed76d8c55dfe /pkgs/shells/bash
parentd308ac923376b76183a0b4078f808ce40af8f86b (diff)
downloadnixlib-ddaea6ac77177c91576568af4b6f6d85195559af.tar
nixlib-ddaea6ac77177c91576568af4b6f6d85195559af.tar.gz
nixlib-ddaea6ac77177c91576568af4b6f6d85195559af.tar.bz2
nixlib-ddaea6ac77177c91576568af4b6f6d85195559af.tar.lz
nixlib-ddaea6ac77177c91576568af4b6f6d85195559af.tar.xz
nixlib-ddaea6ac77177c91576568af4b6f6d85195559af.tar.zst
nixlib-ddaea6ac77177c91576568af4b6f6d85195559af.zip
pkgs/shells: move extensions to subdirs
These are not reaal shells and should go into their parent shell
directory.
Diffstat (limited to 'pkgs/shells/bash')
-rw-r--r--pkgs/shells/bash/bash-completion/default.nix25
-rw-r--r--pkgs/shells/bash/nix-bash-completions/default.nix36
2 files changed, 61 insertions, 0 deletions
diff --git a/pkgs/shells/bash/bash-completion/default.nix b/pkgs/shells/bash/bash-completion/default.nix
new file mode 100644
index 000000000000..b5f600da8f7e
--- /dev/null
+++ b/pkgs/shells/bash/bash-completion/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "bash-completion-${version}";
+  version = "2.8";
+
+  src = fetchurl {
+    url = "https://github.com/scop/bash-completion/releases/download/${version}/${name}.tar.xz";
+    sha256 = "0kgmflrr1ga9wfk770vmakna3nj46ylb5ky9ipd0v2k9ymq5a7y0";
+  };
+
+  doCheck = true;
+
+  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i -e 's/readlink -f/readlink/g' bash_completion completions/*
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/scop/bash-completion;
+    description = "Programmable completion for the bash shell";
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.peti ];
+  };
+}
diff --git a/pkgs/shells/bash/nix-bash-completions/default.nix b/pkgs/shells/bash/nix-bash-completions/default.nix
new file mode 100644
index 000000000000..739dbd538a6e
--- /dev/null
+++ b/pkgs/shells/bash/nix-bash-completions/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  version = "0.6.5";
+  name = "nix-bash-completions-${version}";
+
+  src = fetchFromGitHub {
+    owner = "hedning";
+    repo = "nix-bash-completions";
+    rev = "v${version}";
+    sha256 = "10f70jw81vky52s3fidf7vzl725fihiypsw39825wnkpynayhmrg";
+  };
+
+  # To enable lazy loading via. bash-completion we need a symlink to the script
+  # from every command name.
+  installPhase = ''
+    commands=$(
+      function complete() { shift 2; echo "$@"; }
+      shopt -s extglob
+      source _nix
+    )
+    install -Dm444 -t $out/share/bash-completion/completions _nix
+    cd $out/share/bash-completion/completions
+    for c in $commands; do
+      ln -s _nix $c
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/hedning/nix-bash-completions;
+    description = "Bash completions for Nix, NixOS, and NixOps";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ hedning ];
+  };
+}